How to Manually Make a Ubuntu USB Flash Drive from the command line while running from the Ubuntu Live CD. Upon completion, the user will be able to boot and run a Portable Ubuntu from a USB drive. This tutorial utilizes multiple partitions to enable the user to save changes and settings back to the flash thumb drive and restore them persistently. Note that the second partition must be labeled “casper-rw” or “writable” on some newer variants in order to use the “persistent” feature and save changes back to the stick to be restored on subsequent boots.
Portable Bootable Ubuntu USB Linux
Ubuntu® is a product of Canonical ltd and is based on Debian Linux. It is both user friendly and stable. Ubuntu’s famous slogan is (it should “Just Work”, TM)
Distribution Home Page: Project Page
Minimum Flash Drive Capacity: 1 GB
Persistent Feature: Yes
- USB flash drive
- Ubuntu ISO
- CD Burner/Recorder
- 7-zip (or another ISO extracting tool)
How to Make a Ubuntu USB from the command line
Note: This manual command line based tutorial is older and may or may not work as expected on newer versions. You can always use the Universal USB Installer instead, as it can be used to install the latest versions.
How to Partition and make a USB flash drive bootable:
- Download an Ubuntu ISO file and burn it to CD.
- Restart your computer (booting from the Live CD).
- Insert your USB flash drive.
- Open a terminal window and type sudo su
- Now type fdisk -l to list available drives/partitions (note which device is your flash drive Example: /dev/sdb). Throughout this tutorial, replace all instances of x with your flash drive letter. For example, if your flash drive is sdb, replace x with b.
- Type umount /dev/sdx1
- Type fdisk /dev/sdx
- type p to show the existing partition and d to delete it.
- type p again to show any remaining partitions (if partitions exist, repeat the previous step).
- type n to make a new partition.
- type p for primary partition.
- type 1 to make this the first partition.
- hit enter to use the default 1st cylinder.
- type +750M to set the partition size.
- type a to make this partition active.
- type 1 to select partition one.
- type t to change the partition filesystem.
- type 6 to select the fat16 file system.
- type n to make another new partition.
- type p for primary partition.
- type 2 to make this the second partition.
- hit enter to use the default cylinder.
- hit enter again to use the default last cylinder.
- type w to write the new partition table.
- Type umount /dev/sdx1 to unmount the partition.
- Type mkfs.vfat -F 16 -n usb /dev/sdx1 to format the first partition.
“Alternately you can try mkfs.vfat -F 32 -n usb /dev/sdx1 (doesn’t always work)”
- Type umount /dev/sdx2 to ensure the partition is unmounted.
- Type mkfs.ext2 -b 4096 -L casper-rw /dev/sdx2 to format the second partition.
- Remove and Re-insert your flash drive.
- Back at the terminal, type sudo apt-get install syslinux mtools
- Type syslinux -sf /dev/sdx1
- Restart your computer, remove the CD and boot back into Windows.
Using Windows to prepare and move the files to the USB Stick:
- Create a folder named USB on your computer.
- Download UBconvert.zip and extract the files to the USB folder.
- Move the Ubuntu 6.10 ISO downloaded earlier to the USB folder.
- Click fixu.bat from the USB folder (follow on screen instructions).
- Move all files from the ubuntu directory to your memory stick.
- Reboot your computer and set your system BIOS to boot from USB-HDD or USB-ZIP. Also set the “Hard Disk Boot Priority” if necessary.
You should now be booting into Ubuntu Linux from a USB flash drive. Enjoy your Bootable Ubuntu USB!