Ubuntu – How to boot Linux from a 16gb USB flash drive

bootext2live-cdUbuntuusb-flash-drive

I'm trying to install Linux on a single partition of a USB flash drive that's larger than 4gb.

The first place I went to is http://pendrivelinux.com. I can follow these instructions for installing Xubuntu 9.04 perfectly, which unfortunately break down when I try to scale it up beyond 4gb.

There are several other tools to do this (unetbootin and usb-creator) which follow a very similar formula.

I figured out that a big problem of mine was that all of these tools assume the USB drive is formatted in FAT32, which unfortunately cannot hold a single file larger than 4gb. This is unfortunate because I want to use just one partition, so that my persistance file, casper-rw, looks like one big partition to the OS once I've booted off of the USB drive.

I then tried following a myriad of instructions involving formatting the drive as one large ext2 filesystem and using extlinux to create a single bootable ext2 file system.

This doesn't work for me however, after about 20 attempts verifying and slightly tweaking the formula, I cannot seem to get a "good" bootable ext2 file system built. I'm not entirely sure what's going on, but it seems as though no matter how hard I try, I cannot get the ext2 file system to remain coherent after copying the Linux ISO contents over, copying the MBR, and executing extlinux to create the ext bootloader.

Every time, after I follow these steps (in any order) and reboot, I get an unbootable USB drive. If I then mount the drive under Linux again, I see a mess of a file system (inodes have clearly been screwed up somewhere along the way).

I suspected that the USB drive wasn't being fully flushed, so I tried using the "sync" and "unmount" commands before rebooting which didn't affect things at all.

I guess I have several possible questions – but let's start with the obvious – is there something I'm missing to create a bootable ext2 USB flash drive that's large (e.g. 16gb)?

Best Answer

Ubuntu now includes a "install to USB" option in the system menu. This is your best bet and does not require trying to cram a large file onto the stick - instead, files are stored "normally", which means you'll be able to get around the 4Gb barrier.

Install gparted to assist with this:

sudo apt-get install gparted
sudo gparted

If the GUI method doesn't work, try directly formatting through the command line instead.

The file size limitation still applies, so if you plan on having large files, Ext2 is still your best choice. Format it as Ext2 and then use the provided tool to do the install.

If you're stuck in a chicken-and-egg situation (only have a Windows install to work with but no live Linux install) you could burn the ISO to a CD, boot the CD, download and install the partition program, run it to partition the stick, and then run the USB install from there.