Booting Linux userland from an External USB Flash Disk
For a long time, it’s been possible to boot Linux from an external drive such as USB flash, without requiring an initrd (initial ramdisk). You can do this with the “root=/dev/sda1″ kernel parameter, where sda1 is the partition on the USB flash device containing your userspace (may vary depending on your partitioning setup and if you have SCSI or SATA devices).
(Whether or not your BIOS can boot from USB or if you have to store the bootloader and kernel on a more common boot medium is another story)
As of Linux 2.6.10, the USB flash storage initialization changed, and a side effect of this made it no longer possible to boot Linux from USB flash like this. The change meant that, in situations like this, the kernel would try to mount the root filesystem (on the USB flash disk) before the usb-storage driver was fully initialized.
Users saw errors on bootup along the lines of:
VFS: Cannot open root device 'sda1' or unknown-block(8,1) Please append a correct 'root=' boot option Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,1)
Reverting this change was not an option (it was justified) so we had to find an alternative way to solve this problem.
After a few discussions, we decided that at this point in time there was no safe and elegant solution to the problem, so we had to go for a more simplistic approach. I wrote a patch which was accepted into Linux 2.6.11.
My patch added a rootdelay kernel parameter, which allows the user to specify a delay (in seconds) that the kernel should wait before trying to mount the root device. Since the kernel performs tasks in parallel, the usb-storage driver will continue initializing while the block layer is waiting for the specified delay, thus correcting the sequence of events.
So, to overcome this problem, you might use a grub configuration section such as:
title=My kernel which boots userland from a USB flash disk root (hd0,0) kernel /bzImage-2.6.14 root=/dev/sda1 rootdelay=10
Most users will be able to get away with a shorter delay (try 5 seconds), but some flash devices will require a longer delay.
This is a relatively minor feature, the change occurred a fair while ago, and the parameter is documented in Documentation/kernel-parameters.txt, but I’m still seeing a fair few people running into this problem. Hopefully this post will make the solution easier to find, until a more transparent solution is developed.