FC4 on a USB drive. (tummy.com, ltd. Journal Entry)
tummy.com: we do linux

Saturday September 10, 2005 at 15:26
Subject: FC4 on a USB drive.
Keywords: Technical
Posted by: Sean Reifschneider

This weekend we are at BazCamp, and Roger is working on getting his laptop booting from a USB hard drive, so he doesn't have to mess with his internal hard drive and it's software. The FC4 install works just fine if you do "linux expert". However, your options are to install the boot loader to /dev/hda (the internal hard drive) or /dev/sda1 (the partition on the USB). He removed his internal hard drive, and then did the install so it would put the MBR on /dev/sda. However, it required a bit more work...

However, the result was a kernel panic because it couldn't find the root file-system. It didn't load any of the modules necessary for USB on the root partition. After some mucking, I found that you had to do the following to get it up.

Boot on the CD/DVD with "linux rescue expert". Don't enable networking, but do mount the file-systems. Then run the following:

chroot /mnt/sysimage
mount /boot     # His system didn't mount boot for some reason
ls /boot
#  Make note of the version in the initrd file-name
#  For example: /boot/initrd-2.6.11-1.1369_FC4.img 
#  is version "2.6.11-1.1369_FC4"
rm /boot/initrd*
mkinitrd --with-usb 2.6.11-1.1369_FC4 /boot/initrd-2.6.11-1.1369_FC4.img
umount /boot
exit
exit

At this point it should reboot and boot to the point where it no longer panics when trying to find the root file-system or LVM logical volumes.
(Post Reply)

Comment
tbl
Subject: boot off fc4 from usb
hi :) i have tried what you wrote, but i get this erro : (for some reason, i prefer change the initrd name, and the path

[root@ws013 ~]# mkinitrd --with-usb 2.6.11-1.1369_FC4 /boot/usb5.img /lib/modules//boot/usb5.img is not a directory.
[root@ws013 ~]# mkinitrd --with-usb 2.6.11-1.1369_FC4 /tmp/usb5.img
/lib/modules//tmp/usb5.img is not a directory.
[root@ws013 ~]# mkinitrd --with-usb 2.6.11-1.1369_FC4 /tmp/usb-2.6.11-1.1369_FC4.img
/lib/modules//tmp/usb-2.6.11-1.1369_FC4.img is not a directory.
[root@ws013 ~]#

any idea ?

thx

larry

Comment
tbl
Subject: boot off usb fc4
okay the right syntaxe is : [root@ws013 ~]# mkinitrd --with-usb /boot/usb5.img 2.6.11-1.1369_FC4
Comment
Dimitris Koukoravas
Subject: FC4 on a USB drive.
Not Working. At boot i get a kernel panic - not syncing
Comment
Author: Sean Reifschneider
Subject: Kernel panic.
A kernel panic early in the boot process almost certainly means that you didn't properly re-generate the initial ramdisc to include the USB or file-system modules. This can be tricky, you may want to see if someone from your local Linux Users Group can spend some time with you on trying to track it down. Perhaps they have an installfest coming up?

Sean

Comment
Ethan
Subject: I got this to work
Thanks a lot for posting this information. I got USB booting to work following your steps.

Where did you find out about the "--with-usb" param? All of the stuff on the Web I was able to find talked about unzipping then mounting the initrd and editing linuxrc to add USB module loading.

Comment
Author: Sean Reifschneider
Subject: I don't honestly remember...
I can't reall where I found out about it. I first thought it was from the man page or from running it without any arguments, but neither of these show the --with-usb argument. However, I also looked in the log of pages I visited while setting this up, and I don't find any reference to --with-usb either. I could have used a browser on another machine to find it, or I might have just looked at the file /etc/mkinitrd and seen "--with-usb" in there and decided to try it.

Sean

Comment
Ethan
Subject: Very interesting
Thanks for the info. My next project is to make a CD that will allow me to boot the USB drive on systems that don't provide USB booting, such as my Sony laptop.

E

Comment
V.Ve.nkatasubramani
Subject: FC4 on USB ext HDD
Dear Sean

Thanks for your simple and very useful/powerful command. The FC4 is smoothly booting from external USB HDD (100 GB Seagate). Is there any similar way to boot FC3 from external USB HDD?

Thanks & Regards
vvs

Comment
Author: Sean Reifschneider
Subject: No idea about FC3.
I have no idea about FC3, the best bet is to just try it and see.

Of course, they are just handing FC3 over to Fedora Legacy, so it's hard to imagine why you'd want to.

Sean

Comment
Sean Hernon
Subject: Mounting problems
Hi,

I follow the instructions but when I boot into rescue mode it cannot find my fc4 installation automatically

I try to mount it manually with "mount /dev/sda2 /mnt/sysimage" but I get an error telling me there's no such file or directory.

Comment
Author: Sean Reifschneider
Subject: Unable to find USB device.
From what you're saying, it sounds like the rescue mode is not correctly finding your USB device. This could be because of issues with the USB device itself or the drivers for it that are in the rescue mode. Sorry, I don't have any quick fix for you.

Sean

Comment
Sean Hernon
Subject: Detected Devices
Is there any way of listing the detected devices?

Cheers.

Comment
Author: Sean Reifschneider
Subject: Listing devices
There are several, "cat /proc/scsi/scsi" will show SCSI devices, of which USB devices are considered one of, "dmesg" will display kernel messages.

Sean

Comment
Sean Hernon
Subject: Same for all FC4?
Would the initrd file that's made with the usb option be the same for all FC4, i.e could I download someone else's and then simply import it into my root partition?

Cheers, Sean.

Comment
Sean Hernon
Subject: Modprobe
Not sure if this is relevant at all, but when I try to run modprobe I get the error "Could not parse modules.dep". Is this normal?

Cheers, Sean.

Comment
Sean Hernon
Subject: Working
OK, I got it working. Word of warning for anyone with similar problems - when you're installing Fedora, let it do the automatic partitioning and then, if you like, review the partitions. My installation wasn't being detected by rescue mode because I made my own separate "/" and "/boot" directories on separate ext3 partitions, whereas the automatic partitioner creates a logical volume containing both - which is happily detected by the rescue mode. Strange thing is that when I went to reinstall FC4, it detected the previous installation that I'd put on sda2 (something that the rescue mode failed at), so hopefully that won't be an issue in FC5.

Also, I noticed that you said Roger removed his internal hard drive to get FC4 to choose sda as the place to write the boot loader to, as opposed to hda. This isn't necessary. Simply change the boot order in your bios so that the usb drive you're installing to is the hard drive highest up the list, i.e. just below your CD Drive.

Comment
Manish
Subject: booting FC5 from USB drive
I tried your steps but it returns following error

No modules available for kernel "/boot/initrd-2.6.15-1.2054_FC5.img"

Comment
Author: Sean Reifschneider
Subject: The order of the arguments to mkinitrd.
The order of the commands in the original message were reversed for mkinitrd. This is why it's telling you that it can't find modules for the kernel version "/boot/...". Switch the order of the last two parameters of mkinitrd so that the initrd file name (starting with "/boot") is first, and then the kernel version follows that. See the man page for "mkinitrd" for more details.

Sean