Install Windows after Linux and dual-boot

With the new GRUB 2′s recent release, there has been a lot of messing around with GRUB Legacy which, to be honest, there's no need for. This tutorial will assume that you have Linux installed on your hard drive/virtual machine and just installed Windows to it but have lost your choice of booting Linux on startup. This is caused by Microsoft wanting their virus to pwn the rest and they overwrite the MBR only for their own operating systems. So we are going to re-install GRUB to the MBR.

There's only one requirement: You need a Live CD with which you can boot into.

Using your Live CD, boot into the Ubuntu pre-installed environment. Once in, make sure that your Linux partition is mounted. You can check this by copying the following and seeing the same or similar output to the command-line:

And take a note the designation for the disk /dev/sda which you will be using later, and the directory in /media. It may even be /dev/hda depending on your hard drive's framework. And also, the long directory with letters and numbers after /media/. This is the directory of the partition. In the example, I'll use my own but you may need to change yours accordingly.

ls /media/bdd1efeb-e61f-467a-968c-8cea0af9349b/boot

Now that you've got what you need mounted, run the following command to rewrite GRUB to your MBR:

sudo grub-install --root-directory=/media/bdd1efeb-e61f-467a-968c-8cea0

If this did not work and you get BIOS warnings, try:

sudo grub-install --root-directory=/media/0d104aff-ec8c-44c8-b811-92b99

If for some reason the GRUB menu does not display Windows after your reboot, run into Ubuntu, open a terminal and run the following command:

sudo update-grub2

Now all you have to do is reboot making sure to boot to your hard drive and not to the live CD. GRUB should be installed and both Ubuntu and Windows should have been automatically detected and listed in the menu.

The Master Boot Record will execute GRUB as the initial bootloader. The Windows bootloader is contained within the Windows partition and will then be chainloaded by the GRUB bootloader.

It should work now.


0 Response to "Install Windows after Linux and dual-boot"

Post a Comment