Sunday, January 3, 2010

Dual boot HDD - using the GRUB bootloader

The old hard drive mentioned in my previous post has two partitions. Windows XP in the first partition and UBUNTU Linux in the second. The problem was that the old Master Boot Record was over-written when I repaired the Windows XP installation. As a consequence, I lost the GRUB bootloader and I could no longer access my Linux partition.

How the heck did I fix the Master Boot Record to give dual boot options?
  1. Reboot the computer using CTRL ALT DEL.
  2. Interrupt the start up sequence to change the BIOS settings. (Hold down the DEL key).
  3. Following the BIOS menu, change the boot sequence so the system will boot first from the CD drive.
  4. Save the settings and exit (F10 key usually)
  5. When the PC restarts, pop the UBUNTU Linux Installation Disc in the CD drive.
  6. At the UBUNTU menu, start a CD only session. (Don't install!!!).
  7. Open a terminal session to initiate GRUB. Enter the following commands:
  8. sudo grub
  9. find /boot/grub/stage1 (Will return the drive and partition numbers in the format hd?,?)
  10. root (hd?,?) (Where Linux root resides, (say) hd0,4 which is /dev/sda, partition 4)
  11. setup (hd?) (Writes the GRUB Bootstrap loader to the Master Boot Record on the nominated hd)
  12. quit
  13. Back up, then Edit the menu.lst file
  14. sudo cp /boot/grub/menu.lst menu.lst.old
  15. sudo gedit /boot/grub/menu.lst
As I have both Windows XP and UBUNTU Linux on the same drive all references in menu.lst should be to hd0 with partition references showing Windows XP at hd0,1 and Linux at hd0,4. Change the menu entries as necessary to suit.

  1. Delete any irrelevant menu references to operating systems other than those installed on the PC.
  2. Change the default start up operating system. This is given by 'default value'. It coincides with the menu line you would like the system to automatically boot into if there is no user input. (Count starts at 0 for the first menu line).
  3. Reboot and test each menu line and automatic boot for correct operation.
  4. If you get stuck, come back in via the CD as above and start again.
So thats how I managed to fix the GRUB Bootloader.

No comments:

Post a Comment