Booting from a USB Drive

Matt Graham danceswithcrows at usa.net
Mon Dec 6 16:27:21 MST 2010


From: Steve Holmes <steve at holmesgrown.com>
[USB drive, GRUB installed on its bootsector]
> Now when I boot the machine and choose USB from the BIOS boot menu,
> grub starts up but now the USB drive is (hd0) and the internal disk is
> (hd1).  Now at this point, I get the boot menu with the two Arch
> linux entries and after choosing the first one, the initial RAMFS
> loads so at this point, my USB drive is accessed fine.

It's using BIOS functions to read the kernel and ramfs/initrd/whatever at this
point, so this is only to be expected.

> But [after the kernel loads], my internal hard disk is being
> discovered to be /dev/sda and shown accordingly. This time,
> /dev/sdb wasn't even mentioned.  After getting dumped out into
> the emergency shell, I decided to try looking for /dev/disk
> and then went into the by-label directory and saw entries for sda1,
> sda3 and sda4.  No mention of my linux partition.  

Does your initrd/ramfs/whatever have the ehci_hcd, scsi_mod, sd_mod, usbcore,
and usb_storage modules available in it?  Are those modules loaded?  If this
thing was always going to run from a USB drive and I had control over the
kernel, I'd build a custom kernel with all those things built-in, not as
modules, to avoid that particular set of problems.  (BTDT back in 1999, but
with ELF binary support as <M>, seriously, so the kernel loaded but /sbin/init
couldn't execute.  Sigh.  It was a great learning experience.)

> even though it just loaded the RAMFS from that same device just
> a few moments before.  Does this make any sense?

Yes, if you know the intricacies of the semi-kludgy way the x86 boot process
and the bootloader do all of their junk :-P

>>> Steve Holmes <steve at holmesgrown.com>wrote:
>>>> the RAMFS boots fine and the final messages shown before it barfs
>>>> indicate that it found my internal hard drive and its 4 windows
>>>> partitions.  But then it shows /dev/sdb to be a mass storage
>>>> device but it never shows the 2 partitions (sdb1 and sdb2)

This is a totally different problem, and it doesn't totally jive with what you
wrote above ("/dev/sdb wasn't even mentioned").  If it can see the USB drive,
but it can't see the partitions on the drive, then the drive may have been put
together with a non-x86 partition layout.  In that case, you have to build the
kernel with support for whatever partition layout's on the drive.  There are a
bunch of them.  GPT, OS X, whatever, they can all be used for a Linux system. 
The x86 BIOS only groks a couple of them though.

-- 
Matt G / Dances With Crows
The Crow202 Blog:  http://crow202.org/wordpress/
There is no Darkness in Eternity/But only Light too dim for us to see



More information about the PLUG-discuss mailing list