Sunday, February 24, 2008

Tips & Tricks: re-installing MBR on a dual boots

if you happen to have both Windows and Linux or dual boot on a single pc (which is cool ^_^) and have problem with windows (for example a file has been corrupt, malware or virus infection) and you happen to reinstall the windows.

what happen is that the MBR was also re-written. So, what you'll do to make dual boot possible again rather reinstalling linux in the system (which is no trouble at all since installing linux is faster than windows)is just follow this quick steps ^_^

1. boot with linux cd (usually called LIve CD)
2. login as root (usually the username and password for Live CD is "root" and "root")
3. got to the terminal
4. type "mount /dev/hda1 /mnt/hda1" (without the quote ^_^)
this command mount (hda1) which is a partition of your hardrive to directory "mnt/hda1"
5. type "chroot /mnt/hda1 /bin/bash"
this commands relocate the /bin/bash directory to the hda1 rather than to the Live CD
6. type "grub-install /dev/hda"
this command re-install GRUB to the hda partition

replace the drive letter(hda,hdb,hdc depends how many drives you have) as per your installation.
if you have more than one partition mount all of them ie \ home usr etc. etc.
then it should work ok.

hope his helps ^_^

No comments: