In this article, Mytour will guide you on how to boot and run Ubuntu from a USB drive and other Linux distributions. You can automatically save changes and installations on the USB drive and restore them each time you boot by using the second partition.
This way, you can run Ubuntu and configurations as well as files on other computers. Continue reading the article below for more details.
Note: The following instructions do not require Ubuntu 8.10 as the USB Ubuntu Creator has been pre-integrated.
Boot and Run Ubuntu from a USB Drive
Requirements
- USB 2.0 drive with a minimum capacity of 1GB.
- Ensure your computer is equipped with a CD drive (capable of booting from a USB drive. Newer motherboards should meet this requirement. Update BIOS from the computer manufacturer is recommended).
- Ubuntu LiveCD disk (if Ubuntu is already installed on your computer, you may skip this step).
- Proficiency in Terminal usage.
Visit ubuntu.com to download the Ubuntu LiveCD. Download the Ubuntu Desktop LiveCD ISO file and burn it to a CD using Nero or similar software.
Changing BIOS Boot Order
The next step you need to take is to change the BIOS boot order. Power on your computer, during startup press the key to access the BIOS Setup Utility. Depending on your computer, the keys may vary, but commonly it's F2 or Delete.
Navigate through the settings until you find the boot order setting. You can change the boot order to select your device as the first boot option.
Additionally, during startup, you'll have the option to temporarily boot from a specific device. You can use this option if you want to boot from a device just once.
Boot from Ubuntu LiveCD
Shut down your computer, then insert the CD into the CD/DVD tray on your computer. Next, power on your computer and set the BIOS to boot from the CD drive. It will load, and you'll see Ubuntu.
If Ubuntu is already installed on your computer, you can skip this step. Just turn on your computer and log in.
Format USB Drive
The next step now is to format the USB drive. In this guide, we'll create 2 partitions, one for the actual Ubuntu operating system and another for a different operating system to automatically save changes and settings on the USB drive and restore these settings every time it boots. Additionally, you can also store personal data on the second partition.
Backup all your data on the USB drive before proceeding with the steps. This operation will erase all files and data on your USB drive.
Step 1: Backup data on your USB drive.
Step 2: Open Terminal located in Applications.
Step 3: Enter sudo su into it.
Step 4: Enter fdisk -l into it and identify which device is your USB. Assume if your USB drive is sda, enter 'format sda1' into it.
Step 5: Enter the command 'umount /dev/sdb1'.
Step 6: Enter the command 'fdisk /dev/sdb'.
- Enter p to display the existing partitions and d to delete that partition.
- Enter p again to display the remaining partitions (if the partition exists, perform the above step to delete the partition).
- Enter n to create a new partition.
- Enter p for the primary partition.
- Type 1 to number the first partition.
Press Enter to use partition 1 as the default partition.
- Type +750M to set the partition size.
- Type a to activate the partition.
- Type 1 to select partition 1.
- Type t to change the file system partition.
- Type 6 to select fat16 file system.
- Type n to create a new partition.
- Type p for the primary partition.
- Type 2 to mark the second partition.
- Press Enter to use the default partition.
- Press Enter again to use the last partition as the default partition.
- Enter w to write the new partition table.
Step 7: Enter the command umount /dev/sdb1, then enter umount /dev/sdb2.
Step 8: Enter the command mkfs.vfat -F 16 -n Ubuntu /dev/sdb1. This command is to format the first partition.
Step 9: Next, enter the command mkfs.ext2 -b 4096 -L casper-rw /dev/sdb2 to format the second partition.
Step 10: Close the Terminal window and remove the USB drive.
Install Ubuntu on the USB Drive
After completing the USB drive formatting process, the next step is to install Ubuntu on the USB drive partition.
Step 1: Plug the USB drive into the computer.
Step 2: Open Terminal.
Step 3: Enter the command apt-get update.
Step 4: Access Ubuntu Packages to download Mtools to your machine and install. Then, proceed to download and install Syslinux.
Download Mtools to your machine and install from here: Download MTools
Download Syslinux to your machine and install from here: Download Syslinux
Step 5: In the Terminal window, enter the command syslinux -sf /dev/sdb1.
Step 6: Enter cd /cdrom.
Step 7: Enter the command 'cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz /media/Ubuntu/'.
Ignore any 'cannot create symbolic link' errors.
Step 8: Access the first partition on the USB drive and rename isolinux.cfg to syslinux.cfg.
Step 9: Edit syslinux.cfg similar to the attached file HERE
Completion
Simply restart your computer, and set it to boot from the USB drive in the BIOS.
If you're unable to boot and run Ubuntu from the USB drive, your USB drive's MBR may be corrupted. To fix the MBR error on the USB drive, in the Terminal window on Ubuntu, you enter the following command:
sudo apt-get install lilo
Then, continue with the command lilo -M /dev/sdb.
From now on, you can run Ubuntu anywhere and have all the settings and necessary files available.
Here Mytour just guided you on how to boot and run Ubuntu from a USB drive. If you don't want to continue running Ubuntu from a USB drive but want to install it directly on your computer, you can choose install Ubuntu alongside Windows 10, 8, 7 UEFI and GPT which is also quite simple and easy.
