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
  • 144
  • Is Ubuntu installed in UEFI mode? If so the order of OS installation in a multi-boot configuration is irrelevant. So yes, of course it can be done easily and safely, just arrange partitions in order to have enough unallocated space for Windows (the installer will use the preexisting ESP). However, as I always say, if you're asking this question you probably don't know enough to do do it safely? – ChanganAuto Aug 22 '21 at 13:19
  • Yes Ubuntu is installed in UEFI mode. – Jhon Aug 22 '21 at 13:24
  • So, here's the basic stuff you need to know: (1) Create unallocated space in the target drive (if a different drive skip this step); (2) Boot the Windows installer and in the step where it asks where to install select the free space and create a new NTFS partition, keep it selected and proceed with the installation; (3) Windows will change the boot order to itself so makes sure to open UEFI settings > Boot and change it back to Ubuntu (Grub); (4) boot Ubuntu and run sudo update-grub so it detects Windows. – ChanganAuto Aug 22 '21 at 13:39
  • 1
    Just be sure to boot Windows installer in UEFI mode. The mode you boot installer is the mode it installs. And with UEFI, it wants multiple small partitions. https://msdn.microsoft.com/en-us/library/windows/hardware/dn898510%28v=vs.85%29.aspx#RecommendedPartitionConfigurations If you try to install in old BIOS/MBR mode, it converts drive to MBR(msdos), totally erasing it. – oldfred Aug 22 '21 at 15:25
  • Previously in another device. I hade Ubuntu 18.04 LTS Some years ago, I installed windows in another disk (just as you mentioned), I tried to install windows, it was installed, I tried to boot into Ubuntu to do update-grub but no option to boot Ubuntu in BIOS. so again booted windows and saw that Ubuntu's disk was unallocated in diskmgmt.msc. No idea what happened. Now in this device also I am worried to lose Ubuntu. There are many programs that i need immediately. And if ubuntu is lost, it will take WHOLE DAY of me reinstalling ubuntu. – Jhon Aug 23 '21 at 04:16

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