Rayhan’s blog (raynux.com)

Rayhan’s Personal Web Blog Site

Entries Comments


Recovering Ubuntu or Fedora Linux after installing windows

21 September, 2008 (01:40) | Fedora, Linux, Reference, Ubuntu

Tags: , , , , , ,


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.

  1. Insert the fedora installation cd to boot from cd.
  2. 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.
  3. In rescue mode you will be in a shell
  4. Enter the following command
    #chroot /mnt/sysimage
  5. 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.

  1. Insert the ubuntu live cd and start a live session from cd.
  2. open the terminal window
  3. the following command will display currently mounted device or harddisk partitions
    #df -h
  4. get the device name for /boot if exists or / (root) partition say /dev/sda9.
  5. enter the following command
    #sudo mkdir ubuntu
    #sudo mount -t ext3 /dev/sda9 ubuntu
  6. If you have separate /usr partition say /dev/sda7 enter the following command too.
    #sudo mount -t ext3 /dev/sda7 ubuntu/usr
  7. 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
  8. 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.

  1. Insert the ubuntu live cd and start a live session from cd.
    #grub
  2. 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
  3. Use the above output in the following two commands.
    #grub> root (hdX,Y)
    #grub> setup (hdX)
    #grub> quit
  4. 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.

«

  »

Comments

Comment from karar
Time: September 23, 2008, 12:49 am

plz tell me how i will mount XP drive from fedora 9?

Comment from rayhan
Time: September 25, 2008, 4:09 pm

Fedora 9 mounts XP partitions automatically. There is no need to mount it manually.

Comment from rayhan
Time: January 13, 2009, 3:38 am

it depends..

Comment from Raja
Time: June 6, 2009, 8:54 am

thx for the valuable comments…..

Write a comment