My first reaction was of frustration, but I decided to use the existing installation of Ubuntu to help me figure out how to go about getting my access to Windows back.
Here's what I did:
Firstly, when Ubuntu loads up, mount the windows partition (as if it were just another hard drive). There is a folder boot (which may/may not contain a sub-folder called grub). However, this is of no consequence to us. Then there is another folder called "Boot" (capital 'B') which contains all the boot files.Rename the former ('boot', the not so important one) to XYZ and rename the latter ("Boot", more valuable) to 'boot'. Yes all we did was change the case of 'Boot' to 'boot'.
Now open a terminal, perform a simple 'fdisk':
Shell:~$ sudo fdisk -l /dev/sda
Device Boot Start End Blocks Id System
---------------------------------------------------------------------------------------------------------------------------
/dev/sda1 * 1 4080 32771576 7 HPFS/NTFS
/dev/sda3 8585 30401 175245052+ b W95 FAT32
/dev/sda5 4081 8323 34081866 83 Linux
/dev/sda6 8324 8584 2096451 82 Linux swap / Solaris
This is what I got. Here my Windows 7 is loaded on /dev/sda1 which is NTFS. Now create a file in /etc/grub.d/ called 11_Windows
Shell:~$sudo nano /etc/grub.d/11_Windows
Nano is my text editor of choice. You can use anything you like ('gedit' etc.). In this file, write the following:
#!/bin/sh -e
echo "Adding Windows">&2
cat<
menuentry "Windows 7"{
set root=(hd0,1)
chainloader --force+1
}
EOF
Save it. Close it and return to the terminal. Now let's recap. You made the "Boot" folder of your windows partition "boot" and created a file in the /etc/grub.d/ directory.
Now simply run the utility to update the grub. You can do this by entering the following at the terminal:
Shell:~$sudo update-grub
Output (on my system):
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-20-generic
Found initrd image: /boot/initrd.img-2.6.31-20-generic
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Adding Windows
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
done
Notice how the "Adding Windows" appears. That happens to be the cute little script we just wrote tipping the odds in our favor. And voila!! Windows 7 is found on /dev/sda1 (which we verified manually a little while back)
Thats all there is to it. Hope this helps.
0 comments:
Post a Comment