Solved Procedure to setup dual boot with 2nd disk

jbodenmann

Well-Known Member

Reaction score: 153
Messages: 311

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 :)
 

Alain De Vos

Daemon

Reaction score: 648
Messages: 2,168

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.
 

sko

Aspiring Daemon

Reaction score: 403
Messages: 708

Or instead of GRUB (which IMHO is quite brittle, especially with ZFS/BEs...), just use EFI - e.g. via rEFInd...
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,325
Messages: 38,841

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.
 

Alain De Vos

Daemon

Reaction score: 648
Messages: 2,168

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.
 

bsduck

Active Member

Reaction score: 199
Messages: 244

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.
 
OP
jbodenmann

jbodenmann

Well-Known Member

Reaction score: 153
Messages: 311

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?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,325
Messages: 38,841

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.
 
OP
jbodenmann

jbodenmann

Well-Known Member

Reaction score: 153
Messages: 311

Thank you for all the provided information.
Everything worked out well!
 
Top