Install windows after installing Ubuntu.
Installing Ubuntu after installing Windows is easy. But installing Windows after installing Ubuntu removes my grub installation. How can we safely install windows after installing Ubuntu.
Here's what we should do:
- Make space for windows.
- Install windows.
- Reinstall GRUB.
- Install the boot loader
MAKING SPACE FOR WINDOWS:
Open Gparted and make a partition for windows according to your requirements. Make note of current
/bootdevice. If that doesn't show up there, make note of the
/device. The device name is something like
You can install Gparted using the following commands:
sudo apt-get install gparted
OR you can use Gparted in your live Ubuntu CD.
Just install windows into the space (partition) that you've made in the previous step.
Now load your Ubuntu live CD. Open a terminal in the live session and enter the following commands:
If you do not have a separate /boot partition:
sudo mount /dev/DEVICENAME_FROM_STEP_ONE /mnt
sudo rm -rf /boot
sudo ln -s /mnt/boot /boot
If you have a separate /boot partition:
sudo mount /dev/DEVICENAME_FROM_STEP_ONE /boot
INSTALL THE BOOT LOADER:
Now type the following commands:
sudo apt-get update && sudo apt-get install grub-pc
sudo grub-install /dev/sda # NOTE THAT THERE IS NO DIGIT
sudo umount /boot
Now restart and you should be able to use both Ubuntu and Windows.