0

I want to dual boot Windows 10 with Ubuntu 20.04 LTS. I currently have Ubuntu 20.04 LTS and now I want to install Windows 10 on my machine without loosing Ubuntu's Data and Programs. I have already backed up Ubuntu so, there is no problem if I lose Ubuntu. But if possible I don't want to... So, Can I install Windows 10 after installing Ubuntu 20.04 LTS without losing it? If yes please suggest me, or if not, I am also ready to reinstall everything But as long as possible I don't want to lose Ubuntu.

Thank You very much.

Jhon
  • 164

1 Answers1

1

Installing Windows after Ubuntu is not the recommended process for a dual boot Windows and Ubuntu system, but it is possible.

Here's the general outline:

  1. Make space for Windows
  2. Install Windows
  3. Mount the /boot directory or partition
  4. Install the bootloader (GRUB)

Step Zero – Backup your important data before doing anything

Step One – Make space for Windows

Open up GParted, and make sure that you have at least 20 GB available for Windows 7, either as a partition you can remove, or as unpartitioned space. If it's a partition, remove it from GRUB to make sure it doesn't break your Ubuntu install — GParted will complain if anything bad is about to happen.

Make note of current /boot device. If that doesn't show up there, make note of the / device. The device name is something like sda5.

Step Two – Install Windows

Install Windows 7 into the space you just made

Step Three – Mount /boot

Note: Instead of mounting the boot directory or partition from the installation in the live media environment you can specify the path with the --boot-directory parameter for grub-install, more information on the manpage.

Load up from your Ubuntu live CD, and then run these commands.

  • If you DO NOT have a separate /boot partition:

      sudo mount /dev/DEVICENAME_FROM_STEP_ONE /mnt
      sudo rm -rf /boot    # Careful here, make sure YOU ARE USING THE LIVE CD. I tried it, it works.
      sudo ln -s /mnt/boot /boot
    
  • If you have a SEPARATE /boot partition:

      sudo mount /dev/DEVICENAME_FROM_STEP_ONE /boot
    

Step Four – Install the bootloader

Note: These instructions were initially written for Windows 7 and BIOS booting computers. If you have UEFI and Windows 8 and above you probably need to replace grub-pc with grub-efi-amd64 in sudo apt-get install grub-pc.

Then continue with those 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

And restart. It should work fine and boot both systems. Source