Back Up And Restore MBR

I have a computer with multiple operating systems installed. Windows XP and Ubuntu are the main OSs I use regularly. Beside these two I also have Open Solaris and Fedora Linux installed on my computers. Booting into any of these is not a problem because I use GRUB bootloader installed by Ubuntu Linux. Problem came  when I wanted to reinstall WindowsXP as it had become too sluggish due to possible virus infection ( it was taking me around 15 minutes to boot WindowsXP). After reinstallation windows bootloader was going to wipe out grub bootloader. So I decided to back up  Master Boot Record (MBR). I logged into Ubuntu, opened a terminal and backed up MBR with following command

sudo dd if=/dev/sda of=original.mbr bs=512 count=1

This created a copy of MBR in the file original.mbr from my harddisk /dev/sda. After backing up MBR I reinstalled windows. Now to get back the original GRUB bootloader, I booted Ubuntu Live CD. After the desktop was fully loaded, I opened a terminal and mounted my Ubuntu Partition on the harddisk under /mnt directory Ubuntu of Live CD. Then I enetered into home directory with

sudo cd /mnt/home/charles

Now I could see the file original.mbr in my home directory. To restore the original MBR issued the following command in the terminal

sudo dd if=original.mbr of=/dev/sda bs=512 count=1

Now my original GRUB bootloader was back and I could boot into any OS on my computer.

0 Comments:

Post a Comment




 

Original Blogger Template | Modified by Blogger Whore