Welcome

Troves being gleaned while surfing on the Internet mostly about computer/IT/system skills and tricks, Welcome here ...
Powered By Blogger

Disclaimer

This blog is written by the owner with real practices and tests and intended to hold all original posts except there is a clear declaration for referencing from others. Thanks for tagging with the source link or other tips for reference from here if you would like to quote partial or full text from posts in this blog.

Friday, December 31, 2010

Restore Linux installation after installing Windows 7 which overwrote the MBR

By default Linux uses the grub Bootloader to manage OS booting with support of multiple OS, and this makes Linux, Fedora distribution say, really gentle as it is generous to keep its predecessors in the context of multiple boot of operating systems.

As such if you install Linux on top of current Windows system, the installer simply adds an boot item for the existing windows start up. It is not true the other way around, however!

When you install a Windows OS on top of current Linux, windows bootloader will not care about things already exist and bit of bluntly overwrite the grub bootloader thus make you lose the Linux boot.

Good news is there do be a way to remedy this loss, the marvellous guy I will be thankful to get the grub back is grub4dos.

Here we go from Windows 7!


2. unpack and retrieve following files
glrdr
glrdr.mbr
menu.lst

place them under the root directory of the boot partition in Windows like C:\

3. expand a slot for the grub bootloader in current Windows bootloader (bootmgr) using bcdedit :

bcdedit /create /d "Grub4Dos" /application bootsector
note to record the id generated in the output.

then use this same id with following commands:
bcdedit /set {id} device partition=C:
bcdedit /set {id} path \grldr.mbr
bcdedit /displayorder {id} /addlast

As a result this will add an item for grub4dos in the Windows bootloader, so that we can boot Linux through grub4dos indirectly.

4. add boot item in the grub bootloader
edit menu.lst to make sure it contains item(s) for the "lost" Linux boot, it should seem like the example below:

default 0
timeout 3
hiddenmenu title Windows 7
find --set-root --ignore-floppies /bootmgr
chainloader /bootmgr

title Fedora (2.6.31.5-127.fc12.x86_64)

root (hd0,0)/boot
kernel /vmlinuz-2.6.31.5-127.fc12.x86_64 ro root=/dev/sda1 LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc
KEYTABLE=us rhgb quiet
initrd /initramfs-2.6.31.5-127.fc12.x86_64.img

title fedora (2.6.32.21-168.fc12.x86_64)

root (hd0,0)/boot
kernel /vmlinuz-2.6.32.21-168.fc12.x86_64 ro root=/dev/sda1 LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc
KEYTABLE=us rhgb quiet
initrd /initramfs-2.6.32.21-168.fc12.x86_64.img



If you do not remember what the file names are such as initramfs-2.6.31.5-127.fc12.x86_64.img and vmlinuz-2.6.31.5-127.fc12.x86_64, esp. those other values like the stuff on the kernel line (" root=/dev/sda1 LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet), you can
find a tool to look at the /boot/grub/grub.conf in the current Windows, a reliable one I have ever use is ext2fs which can be downloaded from http://www.chrysocome.net/explore2fs. For other similar tools, Google around with "ext file explorer for windows".

5. Now restart windows, in the boot menu, select "Grub4Dos" you will see the classical GRUB  interface and you can select the Linux boot item with different kernel version therein. By this, we get Linux installation back and enjoy the dual or multiple boot at one host. In fact the Linux boot restoration steps described above is somewhat similar to that for fresh installation of Linux from Windows 7 without using a Boot CD/DVD.


 
Further problems are welcome to be posted as comments below.

1 comment:

asghar said...

THANKS ADMIN FOR THIS GREAT POST. I LOVE YOUR CONTANT.
Rapid SEO Tool Crack and this tool will evaluate the speed of loading and performance of the URL on both mobile and desktop. The tool then evaluates your website’s performance using a score of zero to 100.
Rekordbox DJ Crackis a cloud-associated DJ stage appropriate for DJs at all levels. Any place you are in your excursion now, Rekordbox Crack is the main DJ programming you’ll require as you progress to the following stage and then some.