I've been running Vista on my Home PC for the last couple of weeks. Now, before installing Vista, I was running Windows XP with Ubuntu installed on a separate partition. Grub was installed in the MBR, and I could choose either to boot into XP or Ubuntu. When I installed Vista, I made sure it installed over my XP partition. Vista re-wrote the MBR with its own bootloader, no surprises there! In the history of windows, it showed scant respect to any other bootloaders or OS for that matter. So now I couldn't boot into Ubuntu. I had to figure out a way to get back to dual-booting.
I decided to use Vista's bootloader to boot Linux. On Windows XP, you only had to modify boot.ini. On Vista this has been replaced with Boot Configuration Data(BCD). To make changes to BCD, we need to use a command line program called Bcdedit. Bcdedit /help displays the help for this tool.
First I needed the grub bootloader information to be copied into a file. So I pop in any linux installation disk, and reboot my machine to boot from the CD. Then I enter the rescue mode. On my PC, Ubuntu was installed in partition 4 of my hard disk. But Grub was installed only in the MBR, which was over-written by Vista. No problem, first I install Grub to partition 4 of my hard disk!
# grub-install --root-directory=/mnt/sysimage /dev/hda4
Note that my root partition was mounted under /mnt/sysimage. Now to copy the bootloader into a file, I ran the following commands.
# cd /
# dd if=/dev/hda4 of=./boot.lnx bs=512 count=1
Now I reboot into Vista, and copy the file "boot.lnx" from my linux partition to Windows. To do this, I used the program Explore2fs. I saved the file in "C:\". Now I had to run Bcdedit to add a new section to the BCD. I started a command-prompt with Administrator previliges and ran the following commands.
C:\> bcdedit /copy {ntldr} /d "Linux"
The output of this command is a hex number which is a reference for the new entry. Copy this hex number.
C:\> bcdedit /set {HexNumber} device boot
Replace {HexNumber} with the hex number displayed previously.
C:\> bcdedit /set {HexNumber} path \boot.lnx
C:\> bcdedit /displayorder {HexNumberl} /addlast
Now I was able to boot into Ubuntu using Vista's boot menu.
No comments:
Post a Comment