Title.

I know there are tools to set up a linux distro's installer on a USB flashdrive. What I'm looking for is slightly different: I want to install a linux distro (a Debian derivative, but am still unsure which) on a USB hard drive, but I want to do it from a running system, rather that have to boot into installer mode.

The rationale is that this is the only active machine I have ATM. I guess this exists since that's how "live distros" with installers even function in the first place, but I haven't had much luck searching for information.

all 14 comments

sorted by: hot top controversial new old
[–] 5 points 2 months ago (2 children)

I'm not sure that I follow the rationale. If this is your only active machine, what is the issue with having to shut down and boot into an installer to install Linux?

Is your goal to overwrite your existing OS with Linux, or to dual boot?

  • source
  • hideshow 2 child comments
  • [–] [S] 3 points 2 months ago (1 child)

    No, my goal is to set up a portable hard drive to use as an external system (to eg.: connect to machines to repair/diagnose them) without having to spend the 2+ hours of install and configure off my one working machine ATM.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 2 months ago

    Ah, okay. Then yes, as others have mentioned, it sounds like you want a portable linux install.

    I keep around install USBs of both Arch Linux and Mint, as both boot into a live version of the distro, and I can either open a terminal to debug things, or arch-chroot into my arch install if I broke my bootloader or something.

  • source
  • parent
  • [–] 4 points 2 months ago* (last edited 2 months ago)

    It sounds to me like you are looking to create a "portable" linux install.
    This used to be quite common when linux was much less common.
    A lot of live distros, including ubuntu, support using an extra partition on the USB as the 'drive', so you boot to the standard live distro but your files and history are all there too.

    Here's a couple links. Google "portable linux" for more info.

    A general list of portable linux distros.
    https://www.ubuntupit.com/best-portable-linux-os-distros-to-install-run-from-usb/

    Detailed instructions on doing this.
    (I reviewed this, looks accurate, didn't really dig through it. Their method is to create an installer USB in one port, boot from it, and then install to another USB in another port. The UEFI directions at the end look a bit sus. YMMV.)
    https://coastipc.com/blog/post/creating-a-portable-linux-operating-system-on-a-usb-drive

  • source
  • [–] 3 points 2 months ago (1 child)

    debootstrap handles that, arch-install-scripts has got a lot of helpful tools. after the initial install, you arch-chroot to it and install stuff you want, via apt, tasksel, etc.

  • source
  • hideshow 1 child comment
  • [–] 2 points 2 months ago

    I think the most straigthforward solution for you would be to boot the live ISO installer in a virtual machine, and then connect the USB device to it and then install. This is mostly guaranteed to work, since it is already using the actual ISO.

    Alternatively, the program that most Linux distro's use to install nowadays is called calamares. And yes, you can install it on a non-live system.

    sudo apt install calamares calamares-settings-debian

    This might be easier, but it also might be harder, if say, the installer is not preconfigured with the various settings the live ISO comes with.

  • source
  • [–] 2 points 2 months ago

    Format the drive, mount it, chroot the filesystem, install. It's basically how you install Arch, the Archwiki will tell you how it's done.

  • source
  • [–] 2 points 2 months ago (1 child)

    What you want is to bootstrap using a tool called debootstrap

  • source
  • hideshow 1 child comment
  • [–] 2 points 2 months ago (1 child)

    If you want to run NixOS (which you don't seem to wamt) this is a possibility!

    Look up NixOS amywhere.

    Can install NixOS from almost any running Linux system live without boot USB.

    Requires a machine on the same network though.

    Pretty cool!

  • source
  • hideshow 1 child comment
  • [–] [S] 1 point 2 months ago

    NixOS sounds interesting for a Sometime when I have more experience, certainly!

    So far I've only had experience with a Nix thing that functions like a package manager, something like a Nix version of Brew.

  • source
  • parent
  • [–] 1 point 2 months ago (1 child)

    I would use a virtual machine

  • source
  • hideshow 1 child comment
  • [–] [S] 1 point 2 months ago

    Sounds one of the better approaches so far, yes. I'm giving virt-manager a try.

    (why didn't I think there would be a virtual machine program right there in the package manager???)

  • source
  • parent