Ubuntu – Dual Boot on separate drives – best configuration

dual-boothard driveuefi

I am about to setup my new Laptop using a dual boot configuration of Ubuntu and Windows 10. I have previously used one drive and partitioned it to contain both the OS. Now, I have a 128Gb PCIe SSD and a 512Gb SSD. I would like my smaller drive to contain only the Ubuntu system and storage and the larger one to be only concerned with windows.

I understand that there are generally two ways to set this up:

Unplugging unused drive on install

  1. unplug 1 drive and install first OS on plugged in the drive

  2. unplug drive with the new system installed, plug in other drive and install 2nd OS

  3. plug-in all drives and configure BIOS/UEFI to select default startup disk
  4. on startup enter BIOS/UEFI to go into the non-default system

Using bootloader

  1. All drives remain in the machine for each installation
  2. install Windows first because Linux installations seem to be more considerate about dual boot setups and leave the windows
    installation in-tact
  3. After Windows is installed, install Linux and select secondary drive as system and data partition
  4. A boot loader should be created enabling to pick boot system on machine startup

Obviously, I used the second option with my previous setup, since unplugging a partition is physically impossible =). The bootloader ubuntu created for me worked fine, BUT it would default into Linux. This meant sticking to the pc while it booted and quickly cycling to the windows option when booting into my prefered OS – which is Windows.

I would like to have Windows set as my default boot OS, with a convenient way to enter my secondary OS (Ubuntu) when needed. All this being done with each OS installed on a separate drive.

Considering the methods mentioned above, what are the best practices to make this happen? Are there additional considerations or methods I have not mentioned?

Best Answer

You're trying to apply BIOS knowledge to an EFI-based computer, and that will lead you astray. (Note that EFI/UEFI is a replacement for the older BIOS. Many people -- and even manufacturers -- refer to EFIs as "BIOSes," but this is misleading.) In particular:

plug in all drives and configure BIOS/UEFI to select default startup disk

Under BIOS, boot loader code is read from a disk's Master Boot Record (MBR), so it's common to refer to "booting a disk" or something similar, and this is reasonably accurate. Under EFI, though, boot loader code is stored as ordinary files on an EFI System Partition (ESP). Importantly, a single ESP can contain multiple boot loaders, and you can have any number of ESPs. The computer knows which boot loader to run because that information in stored in NVRAM. Thus, although boot code is read from a disk, "booting a disk" is ambiguous at best, and downright deceptive in many contexts.

Instead, you should think of booting a file, and always keep in mind that the file to be booted is referenced in NVRAM. A further complication is that many (but not all) EFIs delete those NVRAM references if the file to be booted disappears. Thus, routinely unplugging disks so you can boot or install an OS on another disk can render the computer unable to boot the OS on the unplugged disk, even when you plug it back in. This fact makes the sort of disk-juggling you describe in your first option inadvisable. (It can be made to work, but if you try, it's imperative that you understand how your computer handles its NVRAM-based pointers to boot loaders, so that you can re-create any entries that are deleted.)

You should also be aware that Ubuntu has a bug that causes it to install its boot loader (GRUB) to the first ESP it finds (normally on /dev/sda), even if you try to tell it to do otherwise. It's possible to work around this bug by temporarily changing partition type codes.

Overall, if you intend to leave both disks in the computer for the long haul, I suggest you not be too concerned with completely isolating the two OSes from each other. In particular, don't obsess about isolating their boot loaders; just let the installers put the boot loaders where they want to put them. This should work fine for most purposes. If you intend to move the disks from one computer to another from time to time, though, you'll need to be more careful and learn more about ESP type codes, how your computer handles NVRAM entries pointing to boot loaders, etc.

As to making Windows the default OS, that's easily accomplished with a tool like GRUB Customizer. I can't offer specific advice on using it, though, since I avoid GRUB whenever possible. (I maintain the rEFInd boot manager, which can also be configured to boot Windows by default by changing the default_selection line in refind.conf.)

For more information on how EFI-mode booting works, I recommend reading one or more of the following:

Finally, modern EFIs provide a feature, known as the Compatibility Support Module (CSM), which enables them to boot using BIOS-mode boot loaders. (See my page on the CSM, referenced above.) If learning the EFI-mode ways seems like too much hassle to you, you can keep doing things in the BIOS way by using your computer's CSM; however, that poses its own risk. In particular, many computers never completely disable EFI-mode boot support, so you can easily end up with one OS installed in BIOS mode and the other in EFI mode, which will be harder to manage than either an all-EFI or an all-BIOS installation. Also, some EFIs lack a CSM, and it's likely that manufacturers will begin dropping the CSM in the future, so sticking with BIOS-mode booting will simply delay your need to learn about EFI-mode booting. IMHO, it's better to take an hour or two to learn the basics of EFI-mode booting than to try to stick with BIOS-mode booting via a CSM.

Related Question