Monday, 30 August 2010

Creating Fedora11 USB Installer With Grub

Introduction:

As the new OSes are coming in the market, to test and install these OSes requires DVDs to be created. An efficient method was required, so that DVD burning can be stopped. Since my Laptop can be booted from USB device , so It makes much sense to use USB devices (i.e. USB stick or USB drive) to do the installation. For this purpose and 8GB USB disk was used.

Prerequisites:

An already insalled and working linux distribution. My laptop already had Fedora Core 10.

Target OS.

Fedora-11 was used for this purpose. It can be downloaded from http://download.fedoraproject.org/pub/fedora/linux/releases/11/Fedora/i386/iso/Fedora-11-i386-DVD.iso

In case of Debian we had used different installer kernel and initrd image which had to be downloaded. But in case of Fedora-11 we will use the same Installer and initrd image which is available in its ISO file. For more information on Debian USB installer kernel see Preparing USB disk:

We wil create an ext2 partition with fdisk command. USB disk device name can be found from dmesg command output. Create a single partition on USB disk and make it bootable. All these activities are performed using fdisk commands. So if USB disk is called as /dev/sdb , it will have one partition as /dev/sdb1

Copy the required grub files to USB stick:
mount /dev/sdb1 /mnt
mkdir -p /mnt/boot/grub
cp /boot/grub/* /mnt/boot/grub
Copy the installer image and iso files to USB stick:
mount -o loop Fedora-11-i386-DVD.iso /tmp/image
cp /tmp/image/isolinux/vmlinuz /mnt/vmlinuz-fedora-11
cp /tmp/image/isolinux/initrd.img /mnt/initrd.img-fedora-11
cp -pr /tmp/image/images /mnt
cp Fedora-11-i386-DVD.iso /mnt

Note: vmlinuz and initrd.img files are available at two locations in ISO image. First location is isolinux/ and second is images/pxeboot/ . But kernel and initrd.img are exactly same. So it doesn't matter what files are copied. Also there is additional step of copy in Fedora-11 than in Debian.

Configure and Install Grub:
Edit /mnt/boot/grub/menu.lst to have following contents (or grub.conf).
title USB Fedora-11 Installer
root (hd0,0)
kernel /vmlinuz-fedora-11 rootdelay=10
initrd /initrd.img-fedora-11
It is important to have rootdelay option other wise installer will not kick off. This is required because USB flash drives take a bit longer to be prepared.
Now Install the grub bootloader to USB disk.
# grub
grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
Thats it. Boot the system from USB disk.

No comments:

Post a Comment