Running linux with windows in dual boot mode is not hassle free at all. Specially if you reinstall or repair windows, your linux system will disappear. As a newbie you may stop using linux or reinstall it again instead of solving the problem. In this article I will share my experience on how to recover the boot option for linux. I will cover two well known linux distro ubuntu 8 and fedora 7. I will try to cover the fail safe situation here.
In both Fedora and Ubuntu this task includes two basic steps. These are:
- Enter into your existing hard disk linux system.
- Setup GRUB Boot Loader using GRUB program.
a. Enter into your existing hard disk linux system.
Fedora 7:
In fedora recovering grub is easy task as fedora automatically mount the existing system image to /mnt/sysimage in rescue mode.
- Insert the fedora installation cd to boot from cd.
- When the boot menu appear enter the rescue mode. A message will be prompt saying mounting the existing fedora system on /mnt/sysimage, click ok.
- In rescue mode you will be in a shell
- Enter the following command
#chroot /mnt/sysimage
- Now you are in your existing fedora operating system.
Ubuntu 8.04 LTS:
In ubuntu you will have to mount the existing system image manually.
- Insert the ubuntu live cd and start a live session from cd.
- open the terminal window
- the following command will display currently mounted device or harddisk partitions
#df -h
- get the device name for /boot if exists or / (root) partition say /dev/sda9.
- enter the following command
#sudo mkdir ubuntu
#sudo mount -t ext3 /dev/sda9 ubuntu - If you have separate /usr partition say /dev/sda7 enter the following command too.
#sudo mount -t ext3 /dev/sda7 ubuntu/usr
- Enter the following command to mount /proc and /dev and change chroot.
#sudo mount -t proc none ubuntu/proc
#sudo mount -o bind /dev/ ubuntu/dev
#sudo chroot ubuntu /bin/bash - Now you are in your existing ubuntu operating system.
b. Setup GRUB Boot Loader using GRUB program.
In grub you are mainly required to find the boot device and set the root to bood device.
- Insert the ubuntu live cd and start a live session from cd.
#grub
- Find the existing boot device using following command. Which will out put something like (hd0,0) or (hd0,5) say (hdX,Y).
#grub> find /boot/grub/stage1
- Use the above output in the following two commands.
#grub> root (hdX,Y)
#grub> setup (hdX)
#grub> quit - if everything is ok then you are done. just reboot the system.
This article is completely based on my current experience and I am still a newbie in linux environment. so there may have sevaral other options to do the same task.