Monday, September 15, 2008

How to set up a Fedora Core 4 on a USB disk drive

Before you start, make sure your pc will boot off the USB drive - this is a bios setting, turn on the PC with the drive already attached and see if the bios gives the option to boot from it. If all is working, proceed as follows:

Install FC4 using the 'linux expert' command line boot option, the USB drive appears as /dev/sda, so partition and install to that drive. When asked, make sure that grub is installed to the boot sector of the USB drive. This is very important.

Once the system is in, boot up off the rescue CD, dont bother getting it to try and find your linux system, skip that stage and go to the command line. Now mount the / partition on /mnt/system (or whatever mount point it gives you) and the /boot partition on /mnt/system/boot.

Use chroot to change the root to /mnt/system (or wherever you mounted your drives to) and cd to /boot.

now issue the following command:

mkinitrd --preload=ehci-hcd --preload=usb-storage --preload=scsi_mod --preload=sd_mod /boot/[initrdname]-usb.img [kernel-no., as per the kernel you're loading, e.g. 2.6.12-...FC4]

the initrdname should be the same as the kernel, so you can identify it if you upgrade the kernel later - take a look at the existing .img file so you get a good idea what to call it. The kernel number is the same as the kernel you're loading, for instance my kernel filename might be 'vmlinuz-2.6.11-1.1369_FC4', so i'd put '2.6.11-1.1369_FC4' in this field.

Edit /boot/grub/grub.conf and make sure the entry for the kernel you're going to be booting uses the new ...-usb.img file not the original img file.

reboot the computer off the USB drive and check that everything works.

You'll need to repeat this each time you upgrade the kernel, but you dont need to use the rescue disk every time. After your yum or apt update, just cd back to the /boot directory and start from the mkinitrd command with the new kernel info, update grub and reboot.

And there you have it, a fully working USB boot! I keep a brief reminder of these instructions in a text file in my /boot partition, just so I dont forget how to do it on the infrequent occasions that the kernel is updated.

1 comment:

Unknown said...

Well before this post i was unknown about this idea. Will i am studying the post carefully and trying to to understand the process. Thanks for the post, if in case of problem i will come back on the blog to discuss it with you.
Now i have to fix my inbox problem and i have to run pst recovery for this purpose. Thanks