Installing Windows 10 on another hard drive alongside Ubuntu 18.04

6,073

Solution 1

The current recommendation when installing Windows 10 on any system with multiple disk seems to be to temporarily disconnect all the disks except the one you are planning to install Windows to, and reconnect them only after the installation is complete.

This is because the modern versions of windows will use multiple partitions, and although the installer asks which disk/partition to use for the Windows C: drive, it doesn't necessarily use the same disk for those other partitions (and no, it won't ask about those other partitions specifically). Disconnecting the other disks will remove the unpredictability. After the installation is complete, you should check the boot order in the UEFI/BIOS settings, and adjust as necessary.

Running sudo update-grub in Linux might be enough to allow Ubuntu to detect the presence of Windows and add it as a menu item in GRUB.

If UEFI boot scheme is being used

If your system uses UEFI, the Windows' installer will register a new bootloader setting in the system NVRAM, typically named Windows Boot Manager and place it as the first in the boot order. And if your system firmware auto-deletes any boot entries referring to non-existent disks, disconnecting your Ubuntu system disks will cause the bootloader registration for it to be removed from the system NVRAM.

Before installing a second OS to a dual-boot system that's currently booting Linux in UEFI mode, you should familiarize yourself with the efibootmgr command, record the current UEFI bootloader entry used by Linux (run efibootmgr -v and save the output!) and make sure you have a live Linux media, or a Linux installation media that you can use to boot the system in rescue mode, in UEFI mode. That way, if your system firmware removes Ubuntu's bootloader registration when the Linux system disk is disconnected for Windows installation, you'll be easily restore it by booting from an external media and using efibootmgr to restore the boot registration. The required command would be similar to this:

efibootmgr -c -d /dev/sda -L "Ubuntu Linux" -l \\EFI\\Ubuntu\\grubx64.efi

(The bootloader registration in NVRAM is based on GPT partition UUIDs, so it won't be a problem if your Linux system disk is not detected using the same device name when booting from an external media. Just tell efibootmgr what the device containing your UEFI bootloader is currently known as, and it will do the job correctly.)

But that's the worst case. In the best case, the firmware won't auto-delete the boot entry, and the only thing you'll need to do after installing Windows and reconnecting the other disk is to visit the firmware settings ("BIOS settings") and flip the "Ubuntu" boot entry back into the first priority slot.

Solution 2

Start of first installing the windows on the seperate drive with an ESP(if your system has UEFI firmware) then in grub adding an entry to chainload windows' BOOTMGR efi file

After installing windows with the ESP do in grub prompt:

ls #it will return somedrives for ex. (hd0) (hd0,gpt1) (hd0,gpt2) (hd1) (hd2) (hd2,gpt1) (hd2,gpt2)

Now the (hdx,gpt2) things one might of them be the Windows' ESP lets assume its (hd2,gpt2)

In linux write to the /etc/default/grub.d/40_custom file

menuentry "Windows Boot" { set root=(hd2,gpt2) chainloader /EFI/Microsoft/Boot/bootmgfw.efi }

and save the file then execute

sudo grub-mkconfig -o /boot/grub/grub.cfg Reboot and you should see an 'Windows Boot' entry

Share:
6,073

Related videos on Youtube

J. Liljamo
Author by

J. Liljamo

Student from Finland.

Updated on September 18, 2022

Comments

  • J. Liljamo
    J. Liljamo over 1 year

    I'm currently running Ubuntu as my operating system but wanted to install Windows as my secondary OS for a couple of games I miss. I have Ubuntu on my 256gb SSD and I have a 2tb HDD, and I was wondering if I can install Windows 10 to that drive without breaking my current OS or the loader (grub I think). I didn't find any articles on this (probably because I'm searching for the wrong things. I don't know) so if anyone can link me an article or tell me straight in the comments, that would be appreciated. Thanks in advance and sorry for my bad English I'm Finnish.