==================== Universal Boot Drive ==================== Optical media are annoying because they're large, slow, and difficult to modify. However, we still use them as rescue disks and install media. I decided to switch to using USB flash drives instead. This page will show you how to set up a custom universal boot drive to replace your rescue disks and install media. There are other pages out there that will show you how to make a thumb drive bootable, but most of them use syslinux. Grub is much more convenient, especially for a rescue disk. This page will also show how to use a thumb drive to boot into a Fedora netinstall. Installing Grub --------------- There is no need to reformat your thumb drive. If you really want it to be ext3, that's fine. However, it can be handy to keep it as a FAT filesystem so that you can use it to transfer ordinary files and to distinguish it more easily from your normal hard drive. I let GNOME automatically mount my drive /dev/sdb1 as /media/BOOTDRIVE, and then ran the following (make sure you specify the right partition):: root@maggie:~# grub-install --recheck --root-directory=/media/BOOTDRIVE /dev/sdb grep: /media/BOOTDRIVE/boot/grub/device.map: No such file or directory mv: cannot stat `/media/BOOTDRIVE/boot/grub/device.map': No such file or directory Probing devices to guess BIOS drives. This may take a long time. Installation finished. No error reported. This is the contents of the device map /media/BOOTDRIVE/boot/grub/device.map. Check if this is correct or not. If any of the lines is incorrect, fix it and re-run the script `grub-install'. (fd0) /dev/fd0 (hd0) /dev/sda (hd1) /dev/sdb root@maggie:~# Then, delete device.map for good measure (this file will just confuse us anyway) and create a grub.conf file:: root@maggie:~# rm /media/BOOTDRIVE/boot/grub/device.map root@maggie:~# touch /media/BOOTDRIVE/boot/grub/grub.conf root@maggie:~# At this point, the USB flash drive is bootable and will bring up a Grub menu. Although it's a minimal boot disk, this is enough to rescue a system that has a corrupted or overwritten MBR. All of the following additions are optional. Splash Image ------------ Of course you'll want a lovely splash image. Create a splash image by picking a source image and running the following ImageMagick command:: convert -resize 640x480! -colors 14 -depth 8 /path/to/original.jpeg /media/BOOTDRIVE/boot/grub/splash.xpm.gz Add the following line to boot/grub/grub.conf on the thumb drive:: splashimage=(hd0,0)/boot/grub/splash.xpm.gz If you're too lazy to make your own splash image, there are plenty of free ones out there. Memtest86+ ---------- To add a memory tester to the boot drive, first make sure that you have Memtest86+ installed (in Fedora, do "yum install memtest86+"). Copy the binary to your boot disk with a command like:: root@maggie:~# cp /boot/memtest86+-2.10 /media/BOOTDRIVE/boot/memtest86+ root@maggie:~# Add the following lines to boot/grub/grub.conf on the USB boot drive:: title Memtest86+ root (hd0,0) kernel /boot/memtest86+ Fedora Installer and Rescue --------------------------- You can add Fedora installers and rescue images for either i386 or x86_64 or both. Create a directory for each architecture that you want:: root@maggie:~# mkdir /media/BOOTDRIVE/boot/f10-i386 root@maggie:~# mkdir /media/BOOTDRIVE/boot/f10-x86_64 root@maggie:~# The next step is to download the images for each architecture. The following command downloads the i386 kernel image:: root@maggie:~# cd /media/BOOTDRIVE/boot/f10-i386 root@maggie:/media/AML/boot/f10-i386# wget http://mirrors.kernel.org/fedora/releases/10/Fedora/i386/os/images/pxeboot/vmlinuz --2008-12-15 12:05:14-- http://mirrors.kernel.org/fedora/releases/10/Fedora/i386/os/images/pxeboot/vmlinuz Resolving mirrors.kernel.org... 204.152.191.39, 204.152.191.7 Connecting to mirrors.kernel.org|204.152.191.39|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2567024 (2.4M) [text/plain] Saving to: `vmlinuz' 100%[======================================>] 2,567,024 2.32M/s in 1.1s 2008-12-15 12:05:22 (2.32 MB/s) - `vmlinuz' saved [2567024/2567024] root@maggie:/media/AML/boot/f10-i386# The kernel and initrd images are mandatory. The install.img files are great to have, but they are each about 110 MB, so they may not fit on a small thumb drive. Here are the URLs for one particular mirror:: http://mirrors.kernel.org/fedora/releases/10/Fedora/i386/os/images/pxeboot/vmlinuz http://mirrors.kernel.org/fedora/releases/10/Fedora/i386/os/images/pxeboot/initrd.img http://mirrors.kernel.org/fedora/releases/10/Fedora/i386/os/images/install.img http://mirrors.kernel.org/fedora/releases/10/Fedora/x86_64/os/images/pxeboot/vmlinuz http://mirrors.kernel.org/fedora/releases/10/Fedora/x86_64/os/images/pxeboot/initrd.img http://mirrors.kernel.org/fedora/releases/10/Fedora/x86_64/os/images/install.img The final step is to add entries in grub.conf for each kernel. There will need to be one entry for each architecture, and the contents of the entry depends on whether or not an install.img is included. The following entries assume that install.img is included on the USB flash drive:: title Install Fedora 10 x86_64 root (hd0,0) kernel /boot/f10-x86_64/vmlinuz stage2=hd:/dev/sdb1:/boot/f10-x86_64/install.img initrd /boot/f10-x86_64/initrd.img title Install Fedora 10 i386 root (hd0,0) kernel /boot/f10-i386/vmlinuz stage2=hd:/dev/sdb1:/boot/f10-i386/install.img initrd /boot/f10-i386/initrd.img It may not be accurate to assume that the USB flash drive is always loaded as /dev/sdb, but if the drive assignments are different, just edit the entry from within Grub. If the install.img is not included on the flash drive, then add the following entries to grub.conf instead:: title Install Fedora 10 x86_64 root (hd0,0) kernel /boot/f10-x86_64/vmlinuz stage2=http://mirrors.kernel.org/fedora/releases/10/Fedora/x86_64/os/images/install.img initrd /boot/f10-x86_64/initrd.img title Install Fedora 10 i386 root (hd0,0) kernel /boot/f10-i386/vmlinuz stage2=http://mirrors.kernel.org/fedora/releases/10/Fedora/i386/os/images/install.img initrd /boot/f10-i386/initrd.img Rescue entries depend on the same kernel and initrd images as the installer. The only difference is that "rescue" is appended to the grub.conf entries:: title Fedora 10 x86_64 Rescue root (hd0,0) kernel /boot/f10-x86_64/vmlinuz stage2=hd:/dev/sdb1:/boot/f10-x86_64/install.img rescue initrd /boot/f10-x86_64/initrd.img title Fedora 10 i386 Rescue root (hd0,0) kernel /boot/f10-i386/vmlinuz stage2=hd:/dev/sdb1:/boot/f10-i386/install.img rescue initrd /boot/f10-i386/initrd.img Extras ------ You may add entries to grub.conf to reboot or halt the machine:: title Reboot reboot title Halt halt Troubleshooting --------------- If you boot the USB drive and you get a Grub prompt instead of the menu, it's possible that your version of Grub needs the configuration file to be named menu.lst instead of grub.conf. If the drive has a single filesystem that spans the whole drive, Grub will not be able to read it. Grub expects there to be a partition table. The error message in this case is: "The file /media/BOOTDRIVE/boot/grub/stage1 not read correctly."