Ubuntu – Can Ubuntu be installed to the pendrive it was booted from

system-installationusbusb-drive

A person has a computer with no HDD but 16GB RAM and USB3 port.

Also has 16GB USB3 pendrive with Ubuntu Live on it, (Non persistent).

The computer is then started with the pendrive using toram.

The pendrive is then removed and reinserted while the O/S is running.

Is the O/S that is running in RAM able to do a "Full" install to the pendrive?

This was asked in:

Can I install Ubuntu onto a USB flash drive using the SAME flash drive?

However for some reason this unique question was marked as "Duplicate".

Best Answer

  • I was too curious to wait for you to check if it works. So I tried and here is my result:

    Yes, it works with the following recipe :-)

    • Create a live-only drive by cloning ubuntu-16.04.1-desktop-amd64.iso to a 32 GB USB 3 pendrive with mkusb

    • Add the boot option toram and boot

    • When running live, unmount all mounted partitions in the pendrive (in this case it was only one), run in a terminal window

      sudo umount /media/{and press the TAB key for 'tab completion'}
      # or
      sudo umount /media/*/*  # if more than one partition
      

      Check that all partitions on the pendrive are unmounted with

      df
      
    • Start the installer with the desktop icon

    • Follow the instructions like any other installation

    • Reboot

    I did it in a laptop computer with 4 GiB RAM in BIOS mode without any internal drive.

    If there is an internal drive, things may be more tricky in order to avoid writing bootloading things to the internal drive, but this is not due to the fact that it is installed to the same drive as the system was booted from.

    -o-

    Edit 1: I tested in UEFI mode. The final 'Reboot' got stuck at the plymouth 'five dots'.

    and when rebooted, the installed system works. A better alternative is to

    • 'Continue testing' instead of reboot

    • Flush the buffers in a terminal window

      sync
      
    • Reboot the live system

    and it finishes and reboots beautifully.

    -o-

    Edit 2: You find help how to add the boot option toram at this link,

    How to unmount a live DVD/USB?

  • Related Question