Sunday, November 16, 2008

Installing Fedora Core 9 on Western Digital Passport

Hi all,

Here was the scenario: I have an 80 GB SATA hard drive. I have Windows XP installed on it. Now my idea was to keep my current hard disk configuration unchanged and install a flavour of Linux on an external drive (which is generally a USB interface). With this intention I bought a 160 GB Western Digital Passport USB drive (an excellent drive I must say). I decided to install latest version of fedora FEDORA CORE 9. When I plug in my external disk the resultant device identities are:

/dev/sda -------> 80 GB SATA
/dev/sdb -------> 160 GB WESTERN DIGITAL PASSPORT

1. Now I started out the installation of fedora, choose "linux expert" by typing in at the boot prompt when you boot from fedora CD. But I just followed the normal install routine
2. Did a fresh install, and selected my Western digital drive for installation. Then I did a custom partition of the drive. For every partition I also gave the drive on which to partition i.e /dev/sdb
3. Now I selected the External drive to install GRUB.
4. The installation went perfect and everything was done. Then I did a reboot and through the fedora CD went into the rescue mode by typing "linux rescue" at boot prompt.
5. Select No for Network service when ask and skip the next dialogue box that comes up, you will now be taken up to the shell promp sh.3.2#
6. In my case my boot partition was /dev/sdb1 and root partition was /dev/sdb2. Enter the following set of commands:
mkdir /mnt/source
mkdir /mnt/source/boot
mount /dev/sdb2 /mnt/source
mount /dev/sdb1 /mnt/source/boot
chroot /mnt/source

Remember to execute boot commands in that order. The chroot is to use paths relative to the root directory.
7. Now we will create the initrd image to include modules for USB so that we can boot from our external drive. For this enter the following command:

mkinitrd --with-usb --preload ehci-hcd --preload usb-storage --preload scsi_mod --preload sd_mod
/boot/initrd_usb.gz 2.6.25-14.fc9.i686

The last part of the command is the kernel version. Substitute for the kernel version that you are installing.
8. This with create an initrd image by the name "initrd_usb.gz"
Now you have to replace the intird- entry from the grub.conf file in /boot/grub directory with the "initrd_usb.gz" that we have just created. Also remember to remove the initrd image present in /boot directory before going for a reboot.
9. Now enter the following set of commands:
exit -------> this will exit the chroot
umount /mnt/source/boot
umount /mnt/source
exit --------> to reboot

10. Enter in the bios on reboot and make you boot drive to point to External Drive, in my case Western Digital passport from the First boot device options. Make Sure first that your BIOS supports booting from external drives. Now my PC was bought in 2005 so you have a benchmark as to your BIOS will boot from the USB drive or not.


But I followed the above procedure in 2 scenarios.

1. Initially, in my first attempt, I also had fedora installed on the internal SATA disk. And I followed the above procedure to intsall FEDORA 9 on my WD drive but the booting stopped after diplaying GRUB at startup and nothing happend not even the stage 1. Then using an UBUNTU LIVE CD fiesty fawn I did a "grub-install /dev/sdb". And now I was fucked because I had tinkered the GRUB on my internal hard disk. I wasn't able to boot into windows also. This is a common occurrence to almost any individual that tinkers with GRUB. But there is nothing to worry here if you have Windows 98 CD. Just boot from it and at the command prompt use the command:
fdisk /mbr
This will fix remove GRUB from your mbr and you will atleast boot into your windows partition.
But this was only a part of the story. Now if I boot up using USB I would get to GRUB STAGE 1.5 and Error 17 would come up and bump, nothing happend.
2. Then I again installed FEDORA 9.Though this time I didn't have GRUB Installed in my internal drive. I followed the install procedure and installed grub from the UBUNTU LIVE CD FIESTY FAWN, by typing "grub" to get into the grub command line
grub> root (hd1,0)
grub> setup (hd1)
grub> quit

Voila!! I had set up grub on my external drive explicitly.
Did a reboot and bingo I got to the stage where I got the splash screen displaying boot options, but when I selected fedora it again gave me Error 17: unknown file system type 0x7 Press an key to continue.......... and on key press it again return to menu.
I edited the menu option by pressing "e" and changed the root (hd1,0) to root (hd0,0) pressed enter and then "b" to boot with selected option and then HURRRRRRRRRRAHHHHHHHHHHH, my 4 days of hand banging into every blog concerning GRUB finally paid of. From here one can figure out that when you boot from a disk which has GRUB on it, GRUB assumes that the drive is hd0 though when you install it can see multiple drives and gives it some other number i.e hd1 or hd2 etc. Thus when you boot up remember to change it to hd0 as it did at the grub command edit feature. To make this permanent, boot into the drive and changed the grub.conf entry and you're done.

Fellas this has been an exhausting exercise and I had been working for close to 35+ hours on getting my drive to boot up. I am now adept at handling any of your queries in this regard. Feel free to comment and/or query. I will be more than happy to every problem of yours.
And lastly, thanks to all the linux community forums, its members and other netizens whose little pieces of information I have gathered to get things to work. But I must admit that there was no single place where I could get all of it. So clubbed everything together here, for every individual to refer to. I hope this helps, and apologies for any typos. I have rechecked all commands here. They have been practically implemented in process and so they work 100%.


1 comment:

Deepika said...

Thanks for sharing your experiences. It helped me a lot!!