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.
November 14th, 2005 at 12:28 am
Could you not just make an option that tells it to wait until the partition (on whatever medium) becomes available?
November 14th, 2005 at 10:05 am
It’s not simple to implement that, but is probably the safest approach. I was contacted with someone who had a patch along these lines, and I asked him to send it upstream, but I don’t think that ever happened. I may dig it up and chase it myself.
April 11th, 2006 at 9:38 pm
Thanks a ton. This worked like a charm. Had seen other posts for kernel patches, but an additional grub option is much cleaner and easier to me.
May 29th, 2006 at 10:28 am
will it work on ARM with 2.6.8?
May 30th, 2006 at 6:43 pm
It should work on ARM, assuming you have the proper USB support!
Also see this link: http://ohhohe.tripod.com/files/linux_usb_flashdrive.pdf
July 26th, 2006 at 1:06 pm
I obtain the same error trying the boot of redhat (kernel 2.6.16.19) from connected external hard disk usb 2,0 to pcmcia card usb 2,0 on laptop. I have not understood like making to implement yours patch in order to insert the rootdelay. if I can have of the preciser detailed lists on like adding the patch. thanks. gilmore
July 2nd, 2007 at 1:50 am
This piece of your past helped me quickly realize what the problem in my configuration was. Thank you for saving me from a bout of frustration by taking the time to document this problem and it’s solution.
It really is the little things that make a big difference to us end users.
February 9th, 2008 at 4:20 am
And still, this post continues to serve the people in 2008.
I installed LFS-6.3 with kernel 2.6.22 on a USB stick, and couldn’t get it to work until I saw this pearl.
Thank you so much!
February 26th, 2008 at 11:11 am
Ditto! Now to test this once the system is free!
September 3rd, 2008 at 5:27 pm
Dsd, thanks for your post that helps me to understand this issue. Unfortunately boot up delay is still problem to me as I’m told to reduce it. I’m wondering whether there is solution now on 2.6.18? I see other people says (http://lkml.org/lkml/2006/10/1/65) other solution. thanks for your reply.
December 29th, 2008 at 7:23 am
Thanks very much for this post. This really solved my issues with booting from my usb stick.
February 3rd, 2009 at 10:43 pm
Awesome work man! I am using your parameter now during all my USB boot.
February 3rd, 2009 at 11:38 pm
[...] kernel 2.6.10, the USB flash storage initialization code got changed and hence we need to introduce the rootdelay [...]
August 22nd, 2009 at 7:28 am
Thank you very much! I’ve been stuck with this problem for a few hours now, this did the trick!
April 9th, 2010 at 3:31 pm
[...] adding rootdelay=10 to the kernel parameter in boot time. Here is the description of rootdelay by its author [...]
August 24th, 2018 at 12:21 pm
download permainan domino
dsd
December 24th, 2018 at 5:03 pm
Daftar Lirik lagu Daerah
dsd
December 25th, 2018 at 5:28 pm
Kuliner Bali
dsd
March 6th, 2019 at 4:59 am
Download site
dsd
March 15th, 2019 at 12:27 am
download
dsd
June 9th, 2019 at 9:37 pm
Download site
dsd
June 24th, 2019 at 2:12 pm
56
blog topic
July 23rd, 2019 at 5:59 am
Link alternatif bandarq terpercaya
dsd’s weblog » Blog Archive » Booting Linux userland from an External USB Flash Disk
December 2nd, 2019 at 8:12 pm
Poker Online
dsd’s weblog » Blog Archive » Booting Linux userland from an External USB Flash Disk