How to fully install Ubuntu on USB Flashdrive? [duplicate]
Rather than to install dual-OS on my laptop, I would like to install Ubuntu on my flashdrive (USB flash memory, or whatever you call it). So, whenever I want to run my Ubuntu, I will just plug my flashdrive to the USB port and run it from there by change the boot sequence in BIOS.
Is it possible?
Full Install to USB
11.10 is too old, Latest LTS, (Long Term Service), release is 18.04.
Full installs are more stable and secure than persistent installs, but not as quick to make. They are better at utilizing disk space as no fixed size casper-rw file or partition is required. They are not very good for use of installing Ubuntu.
Following is a step by step how to install 18.04 on a 16GB flash drive with options for separate Home partition and Windows compatible data partition:
- Create a live USB or DVD using SDC, UNetbootin, mkusb, etc.
- Turn off and unplug the computer. (See note at bottom)
- Unplug the power cable from the hard drive or unplug the hard drive from the laptop.
- Plug the computer back in.
- Insert the flash drive.
- Insert the Live USB or Live DVD.
- Start the computer, the USB/DVD should boot.
- Select language.
- Select install Ubuntu.
- Select Keyboard layout
- Select "Continue".
- Select installation type and "Download updates while installing Ubuntu" and Select "Install third-party software ...", (optional).
- Select "Continue".
- At "Installation type" select "Something else". (Full disk encryption is now working with flash drives).
- Select "Continue".
- Confirm target device is correct.
- Select "New Partition Table".
- Click Continue on the drop down.
(Optional FAT32 data partition for use on Windows machine)
- Click "Free space" and "+".
- Make "Size..." about 2000 MB.
- Select "Primary".
- Location = "Beginning of this space".
- "Use as:" = "FAT32 file system".
- "Mount point" = "/windows".
- Select "OK"
(Non Optional Root Partition)
- Click "free space" and then "+".
- Select "Primary", "Size ..." = 4500 to 6000 MB, "Beginning of this space", Ext4, and Mount point = "/" then OK.
(Optional home partition)
- Click "free space" and then "+".
- Select "Primary", "New partition size ..." = 1000 to 6000 MB, Beginning of this space, Ext2, and Mount point = "/home" then OK.
(Optional swap space, allows hibernation)
- Click "free space" and then "+".
- Select "Primary", "New partition size ..." = remaining space, (1000 to 2000 megabytes, or same size as RAM), Beginning of this space and "Use as" = "swap area" then OK.
(Important)
- Confirm "Device for boot loader installation" points to the root of the USB drive. Default should be OK if HDD was unplugged.
Click "Install Now".
Select your location.
- Select "Continue".
- Insert your name, computer name, username, password and select if you want to log in automatically or require a password.cscameron
- Select "Continue".
- Wait until install is complete.
- Turn off computer and plug in the HDD.
- Replace the computer's cover.
Note: You may omit disabling the hard drive if after partitioning you choose to install grub to the root of the USB drive you are installing Ubuntu to, (ie sdb not sdb1). Be cautious, many people have overwritten the HDD MBR as default location for boot loader is sda, any items in the internal drive's grub will be added to the USB's grub. You may do an update-grub later.
Here's another way: Use Virtualbox to install Ubuntu. You only need one USB drive, and don't have to worry about screwing up your current installation of Windows. Edit: With this method, you're ony using Virtualbox to install Ubuntu. You don't use it to run Ubuntu at all. Once it's installed, Virtualbox is no longer needed.
Plug in your USB and open up the Disk Management
utility. Take note of the drive number that your USB drive shows up as. Open up cmd
and run:
VBoxManage internalcommands createrawvmdk -filename "C:\Users\<user_name>\VirtualBox VMs\<VM_folder_name>\<file_name>.vmdk" -rawdisk \\.\PhysicalDrive#
This will create a file that points to the physical drive you've entered (in this case, your USB drive). Now, just start Virtualbox as an administrator and create a new VM as usual, but, when you're prompted to create a drive—select the option that allows you to choose an already-existing drive, and point Virtualbox to the .vmdk file you've just made.
Note: I've used this on Linux quite a few times. In fact, I used it to install Windows on the 2nd harddrive in my computer without a USB. I've never used Windows to install another thing; the commands are slightly different, but I assume things like, when one needs to use sudo
in Linux, running the command (e.g. - Virtualbox) as an administrator is sufficiently equivalent.
Sources:
- https://www.serverwatch.com/server-tutorials/using-a-physical-hard-drive-with-a-virtualbox-vm.html