Sunday, April 20, 2008

Recovering OpenSolaris/Solairs/Linux after Windows Installation

I was running a dual boot configuration with two OSes: Windows XP and Solaris XDE 01/08. I upgraded my system memory but I couldn't visualize the performance difference. This, and a few other reasons made me to opt for a fresh Windows XP installation.

As usual, Windows wiped out the MBR and set it's own partition as active. Following this, I lost my GRUB bootloader and hence the option to boot into Solaris. I played and searched around a little bit and found a couple of good tweaks to recover a Solaris/OpenSolaris boot option, or a Linux boot option by actually recovering the GRUB bootloader.

Recovering GRUB for Linux is different then doing the same for Solaris. Generally Linux installation updates the MBR to load the GRUB, but a Windows installation cleans this MBR. To recover it follow this:
  • Get a live CD of your Linux Distribution,
  • Boot the Linux from this CD,
  • Open a Terminal,
  • Get into GRUB by typing this: sudo grub
  • Then you need to know abou the sequence number of your previous Linux partition (if you don't remember this, you can get an idea from Windows disk management utility).
  • Once you are sure about it, type this if it was the first partiton: root (hd0,0)
    or this if it was second partition on the second harddisk: root (hd0,1)
  • Finally type this: setup (hd0)

You're done!

For Solaris/OpenSolaris, Follow this procedure:
  • Get a OpenSolaris Installation Disk,
  • Boot from CD,
  • type 'c' at boot menu to get the GRUB command line,
  • Type this: rootnoverify (hdX,Y)
    replace X by hdd number, and Y by the sequence number of partition where Solaris is installed. e.g. rootnoverify (hd0,0) for first harddisk and first partition.
  • Now make the Solaris partition active. Type this: makeactive
  • Now chainload the bootsect, which implies that the GRUB bootloader, which is installed through your Solaris will be loaded when you'll startup your system.
  • To do this, type the following: chainloader +1
  • Finally type: boot

You're done!

197 comments: