Solved Procedure to setup dual boot with 2nd disk

jbo@

Developer
I am dealing with a workstation (desktop) which has an m.2 NVMe drive with Windows 10 installed. I would like to setup dual boot with FreeBSD 13.0. The Windows disk is pretty full so I would be adding in another m.2 NVMe drive to install FreeBSD.

I would like to understand the process of setting up dual boot. The machine is already using EFI.
As the existing drive (the one with Windows 10 on it) is directly mounted on the mainboard the huge CPU tower cooler is preventing access to remove the drive without removing the CPU cooler itself.
If possible, I would like to avoid removing the CPU cooler just to plug out the Windows 10 drive.

Could somebody explain the process of getting this up & running without destroying the existing Windows 10 environment? I take it that I'd simply add the 2nd NVMe drive to the computer, then install FreeBSD on it. What happens after that? What needs to happen on the EFI side to recognize both boot options? As the Windows 10 disk already has a 100 MB ESP I take it that during installation of FreeBSD I should prevent the installer from creating another ESP and instead add the bootloader for FreeBSD on the existing ESP? Is this merely a manner of mounting the ESP in the FreeBSD environment and copying the booloader or does this need some sort of further steps?

I'd be thankful for any kind of input on this :)
 
Different persons have different solutions for this.
What I always did was create a small linux partition.
Shrink the Windows partion with linux-gparted.
And use Linux-grub to chainload the freebsd-loader which loads the kernel.
Previous i used for Windows,
As it allows to boot diffent O.S.
Maybe other persons have other solutions.
 
Or instead of GRUB (which IMHO is quite brittle, especially with ZFS/BEs...), just use EFI - e.g. via rEFInd...
 
I take it that I'd simply add the 2nd NVMe drive to the computer, then install FreeBSD on it.
If you pick ZFS you can select for GPT (BIOS+EFI). Select only GPT (BIOS) there. If you select UFS you don't really have an option to select which type of boot to install. You don't need the efi partition the installer will create on the disk. And I've heard of systems that went completely bonkers when confronted with "two" ESP partitions.

As the Windows 10 disk already has a 100 MB ESP I take it that during installation of FreeBSD I should prevent the installer from creating another ESP and instead add the bootloader for FreeBSD on the existing ESP? Is this merely a manner of mounting the ESP in the FreeBSD environment and copying the booloader or does this need some sort of further steps?
That's the gist of it. You can copy /boot/loader.efi to the ESP, save it as something like EFI/BOOT/FreeBSDx64.efi. Then use efibootmgr(8) to add an additional EFI boot option. That's one way, you can then use the BIOS/UEFI boot selector to switch. Downside of this method is that you're not really presented with an option menu, if you don't use the boot selector the system is automatically going to boot whichever OS was set as the default. In this respect applications like rEFInd are a little more useful, you get a nice snazzy customizable boot selector and it'll boot a 'default' OS after some time-out. You have a little more flexibility.
 
I use grub to chain-load the freebsd boatloader on a ufs partition, which loads the freebsd kernel off a zfs partition.
This setup works very fine as ufs filesystem is well understood by the grub loader. And this setup is flexible to boot other operating systems.
For instance alpine-linux-on-zfs.
 
According to what I read here it seems to be quite different from a machine to another. Some computers like mine (HP) don't need anything special for this: I can install an OS on a second disk the same way I would on the first, and then just select the one I want to boot from by pressing F9 when the computer starts.
 
Thank you for the various inputs.

If you pick ZFS you can select for GPT (BIOS+EFI). Select only GPT (BIOS) there. If you select UFS you don't really have an option to select which type of boot to install. You don't need the efi partition the installer will create on the disk. And I've heard of systems that went completely bonkers when confronted with "two" ESP partitions.
I definitely want to use ZFS! So if I understand you correctly the idea is to pick the GPT (BIOS) option in the installer so it won't create an ESP?

That's the gist of it. You can copy /boot/loader.efi to the ESP, save it as something like EFI/BOOT/FreeBSDx64.efi. Then use efibootmgr(8) to add an additional EFI boot option. That's one way, you can then use the BIOS/UEFI boot selector to switch. Downside of this method is that you're not really presented with an option menu, if you don't use the boot selector the system is automatically going to boot whichever OS was set as the default. In this respect applications like rEFInd are a little more useful, you get a nice snazzy customizable boot selector and it'll boot a 'default' OS after some time-out. You have a little more flexibility.
That sounds pretty much what I want.

So if I understand correctly, the process would look like this:

  1. Install 2nd disk in the computer
  2. Install FreeBSD 13.0 using the installer on the 2nd disk. Make sure to select GPT (BIOS) to prevent creation of an additional ESP
  3. After setup of FreeBSD, manually copy the /boot/loader.efi to the ESP on the 1st disk (the Windows 10 disk)
  4. Use either efibootmgr or rEFInd to add the new boot option
  5. Enjoy happyness

Does that seem about right?
 
So if I understand you correctly the idea is to pick the GPT (BIOS) option in the installer so it won't create an ESP?
Correct. It actually doesn't matter how you boot the system, there's no further configuration differences between EUFI or CSM booting. It's only a matter of having the correct EFI files or the freebsd-boot partition.

Does that seem about right?
Sounds all good to me.
 
Back
Top