Wednesday, February 07, 2007

GRUB Bootloader Mistake Correction

I have discovered this correction empirically, having accidentally set up GRUB incorrectly, causing my Windows partition not booting up and returning to the GRUB boot loader screen.


The Mistake


I made the mistake while setting up GRUB.


my partition layout is this:


/dev/sda1 - windows
/dev/sda2 - /boot
/dev/sda3 - /


when i set up GRUB, I typed this:


grub > root (hd0,1) <- sets the root drive to /boot
grub > setup (hd0,0) <- sets up grub on my windows partition
grup > quit <- quits grub


The mistake was the ’setup (hd0,0)’ command I ran, which should have been only ’setup (hd0)’.


This caused GRUB to write the MBR into the Windows partition, so when I booted up, I could only boot to Linux.

The Solution


To fix the problem, I ran a simple ’mount’ command:


mount -o errors=recover /dev/sda1 /mnt/windows


The result allowed me to mount to /mnt/windows with no errors. I was able to look through every directory and read from desired text files as well as write to the text files.


Conclusion


I’m surprised that GRUB even followed through and wrote to my Windows partition. But, for all those who run in to this problem, I give you the solution.

-- Cheers