# Correct placement of partitions for a dual-boot setup.



## Micrified (Aug 9, 2022)

*Context*

I'm dual booting. I've got both operating systems installed on separate NVMe drives. The layout is as follows: 


```
root@system:~ # gpart show nda0 nda1
=>
34         1953521664 nda0 GPT           (932G)
34         2014            - free -      (1.0M)
2048       204800        1 efi           (100M)
206848     32768         2 ms-reserved   (16M)
239616     1952238221    3 ms-basic-data (932G)
1952477837 1395            - free -      (986K)
1952479232 1042432       4 ms-recovery   (509M)
1953521664 3471            - free -      (1.7M)
=>
40         488397088 nda1 GPT            (233G)
40         1024         1 freebsd-boot   (512K)
1064       984            - free -       (492K)
2048       4194304      2 freebsd-swap   (2.0G)
4196352    484200448    3 freebsd-zfs    (231G)
488396800  328            - free -       (164K)
```

*Problem*

In my infinite wisdom, both drives have individual GPT partitions. I wanted to be able to dual-boot the disks, but I've realised that neither system's boot-loader will be able to detect the other's partition, because they reside on different disks entirely. 

*Question*

What's the best solution to my problem? My goal is to have FreeBSD as the "main" boot loader, with an option to boot to my second OS (Window). Do I have a correct understanding of my quandary with the boot loader? Should I repartition the larger disk, install the smaller OS on it (FreeBSD), and then use the second disk as storage? 

Thank's in advanced for any input


----------



## bsduck (Aug 9, 2022)

With operating systems residing on separate disks, dual booting is easy, you can use the UEFI boot selector: just press F9 at boot (or whatever key depending on your machine) and select the disk to boot from. No need to mess with bootloaders.


----------



## Alain De Vos (Aug 10, 2022)

I can inform what I do and works very fine. I make room on my first disk (ID:0) for a small void-linux partition.
Then I'll boot legacy & use the linux grub bootloader to boot ANY OS, eg. freebsdbootloader-on-ufs which i use to boot freebsd-on-zfs , Linux , Windows , etc ...


----------



## Micrified (Aug 11, 2022)

bsduck 

Thanks for the suggestion! Unfortunately, my BIOS does not seem to have a key for selecting the disk to boot from. Rather, I need to navigate through a few BIOS menus to reach it every time. I'll probably have to try something else if I want a more automated experience.


----------



## rsronin (Aug 11, 2022)

Maybe refind can help with this.


----------



## Alain De Vos (Aug 11, 2022)

Micrified said:


> bsduck
> 
> Thanks for the suggestion! Unfortunately, my BIOS does not seem to have a key for selecting the disk to boot from. Rather, I need to navigate through a few BIOS menus to reach it every time. I'll probably have to try something else if I want a more automated experience.


Same for me. It takes the Master-Boot-Record of the "first" disk as recognized by the bios.
But as i installed linux grub it refers to the grub conf which allows me to boot "everywhere".


----------



## Micrified (Aug 11, 2022)

Alain De Vos said:


> I can inform what I do and works very fine. I make room on my first disk (ID:0) for a small void-linux partition.
> Then I'll boot legacy & use the linux grub bootloader to boot ANY OS, eg. freebsdbootloader-on-ufs which i use to boot freebsd-on-zfs , Linux , Windows , etc ...


Do you think I could simply do this on FreeBSD without creating another partition and installing something like void linux? For example:

1. Obtain and build the GRUB2 source on FreeBSD
2. Mount the /efi partition of my Windows10 disk somewhere in FreeBSD
2. Run the install command 
	
	



```
grub-install --target=x86_64-efi --efi-directory=/path/to/mounted/efi --bootloader-id=GRUB
```
?


----------



## Alain De Vos (Aug 11, 2022)

My experience is that FreeBSD is fit to boot freebsd.
For multi-booting other operating systems you might need linux-grub or an alternative is a Windows boot loader like easybsd.








						EasyBCD
					

EasyBCD is a software utility for Windows that lets you control and configure the BCD/BOOTMGR bootloader for Windows Vista, Windows 7, Windows 8, and Windows 10 for dual-boots.




					neosmart.net
				



But that last one might be more  difficult to configure.


----------



## SirDice (Aug 11, 2022)

You could just copy /boot/loader.efi to that existing efi partition. But I'm not sure if loader(8) will be able to find the freebsd-zfs partition on the other disk. It searches the disk it started from (nda0 in this case). Never tried to boot it from a different disk. 

My current set up is dual booting with EFI and rEFInd but both FreeBSD and Windows 10 are on the same disk.


----------



## Alain De Vos (Aug 11, 2022)

Some bios are more "intelligent" then other as for booting. So it can depend on the bios of the PC what is possible.


----------



## bsduck (Aug 11, 2022)

Micrified said:


> 1. Obtain and build the GRUB2 source on FreeBSD


It's available in FreeBSD ports, see sysutils/grub2-pcbsd and sysutils/grub2-efi.


----------



## Micrified (Aug 12, 2022)

bsduck SirDice

Really appreciate the input. I think I'll try copying 
	
	



```
boot/loader.efi
```
 to the 
	
	



```
efi
```
 partition on my larger disk as SirDice mentioned. Then see if it gets picked up there. I'll update here as soon as I do


----------

