1) Using rescue disk, boot ubuntu or any other unix flavour..
2) Give fdisk -l
command to see on which partition windows is installed.
3) Mount the /boot
partition of linux in /media
directory.
4) Give chroot /media
to change ur root to /media.
5) Open the /boot/grub/grub.cfg
file and edit it. Add the following lines if not present or if present modify it.
menuentry "Windows" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root 14445AFA445ADE54
chainloader +1
}
I am supposing that windows is present in /dev/sda2
and 14445AFA445ADE54
is the UUID of ur partition /dev/sda2`..You have to replace it with the UUID of ur windows partition.You can find that by
Go to /dev/disk/by-uuid
directory.
Do ls -l
.
You will output like this ..
lrwxrwxrwx 1 root root 10 Aug 1 20:16 14445AFA445ADE54 -> ../../sda2
lrwxrwxrwx 1 root root 10 Aug 1 20:16 322C5AEB2C5AAA1D -> ../../sda1
lrwxrwxrwx 1 root root 10 Aug 1 20:16 7d41ed63-16cb-493c-91ce-02f7b3146fb6 -> ../../sda5
lrwxrwxrwx 1 root root 10 Aug 1 20:16 88e4dc0b-c986-4e1f-84a2-c09731555dec -> ../../sda7
lrwxrwxrwx 1 root root 10 Aug 1 20:16 c8ad3ea8-5467-4f22-803d-9584d32d8a79 -> ../../sda6
By matching the partition, you can find its corresponding UUID.
Reboot the pc. Now it shud work.
You can't boot Windows from a grub rescue prompt, unless the partition with the grub modules is available. That's why you get the unknown command error. Your best solution is to reinstall the Windows bootloader. To do this boot from a Windows 7 repair CD or the Windows Installation DVD to a repair prompt and run:
bootrec /fixmbr
If you don't have a Windows repair CD or Installation DVD, it's also possible to install a Windows-like bootloader from an Ubuntu CD/USB if you have one of those:
sudo apt-get install lilo
sudo lilo -M /dev/sda mbr
Note that lilo
will popup a large warning screen, but it's safe to ignore it as this refers to when it's used to boot linux.
This is what it looks like to use lilo
(note the command is case-sensitive):
bcbc@neptune:~$ sudo apt-get install lilo
[sudo] password for bcbc:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
lilo-doc
The following NEW packages will be installed:
lilo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 275 kB of archives.
After this operation, 807 kB of additional disk space will be used.
Get:1 http://mirror.csclub.uwaterloo.ca/ubuntu/ precise/main lilo amd64 1:23.2-2 [275 kB]
Fetched 275 kB in 1s (198 kB/s)
Preconfiguring packages ...
Selecting previously unselected package lilo.
(Reading database ... 505850 files and directories currently installed.)
Unpacking lilo (from .../lilo_1%3a23.2-2_amd64.deb) ...
Processing triggers for man-db ...
Setting up lilo (1:23.2-2) ...
bcbc@neptune:~$ sudo lilo -M /dev/sda mbr
Backup copy of /dev/sda in /boot/boot.0800
The Master Boot Record of /dev/sda has been updated.
bcbc@neptune:~$
You'll see a warning that looks like this - it can be ignored when you use lilo
as a windows-style bootloader:
Best Answer
You installed the first stage grub loader to the mbr of the hardrive and put the rest of grubs files in your boot partition on the usb drive. To do what you want you need to put grub onto the mbr of the usb drive, repair the mbr of the windows drive (vista equivalent of
fdisk /mbr
) and change your boot order to boot from usb first, if present, then hard disk.