# EFI boot w/multi boot using efibootmgr how to add nvme drive?



## userxbw (Feb 5, 2020)

I've got this set up efi system partition fat32, FreeBSD, and Slackware on an 2tb nvme in linux it is seen as nvme (aka sdb), in here it is dev/nvd0. Using that designation in efibootmgr does not work.
I have the efi mounted in fstab (like in Linux)

```
$ cat /etc/fstab
# Device    Mountpoint    FStype    Options    Dump    Pass#
/dev/nvd0p2    /        ufs    rw    1    1
/dev/nvd0p5    /boot/efi        msdosfs rw      1       0
/dev/nvd0p3    /home        ufs    rw    2    2
/dev/nvd0p4    none        swap    sw    0    0
```
I took and used the one Slackware uses fat32 in Linux and added the loader.efi into it as in here,


			UEFI - FreeBSD Wiki
		



> cp /boot/loader.efi /mnt/EFI/BOOT/BOOTX64.efi


using FreeBSD dir name instead.

the boot partition is located on here,

```
fstyp /dev/nvd0p2
ufs
```
this first partition/slice is FreeBSDs EFI system fat16 (?).

```
$ fstyp /dev/nvd0p1
msdosfs
[/ocde]
incase one might be wonder what is /dev/nvd0p1 being used for.

efibootmgr showing in FreeBSD. it is to me like there are two separate efibootmgr's one on each system??? I am still a bit new to this type of booting system...

[code]
userx@FreeBSD.Yo.org:~
$ sudo efibootmgr
BootCurrent: 0009
Timeout    : 0 seconds
BootOrder  : 0009, 0008, 000E, 0011, 000C, 000A, 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007
+Boot0009* slackware-14.2+
Boot0008* Windows Boot Manager
Boot000E  USB:
Boot0011  USB:
Boot000C* ST2000LM007-1R8174 :
Boot000A* SPCC M.2 PCIe SSD-296D079612A00022219:
Boot0000  Startup Menu
Boot0001  System Information
Boot0002  Bios Setup
Boot0003  3rd Party Option ROM Management
Boot0004  System Diagnostics
Boot0005  System Diagnostics
Boot0006  System Diagnostics
Boot0007  System Diagnostics
```
trying to add it to efibootmgr I get

```
userx@FreeBSD.Yo.org:~
$ sudo efibootmgr -c -d /dev/nvd0 -p 2 -l \EFI\FreeBSD\BOOTX64.efi -L "FreeBSD"
efibootmgr: invalid option -- d
efibootmgr:    [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] [--help]
  [-c -l loader [-k kernel ] [-L label] [--dry-run] [-b Bootvar]]
userx@FreeBSD.Yo.org:~
$ sudo efibootmgr -c -d /dev/nvd0 -p 2 -l \EFI\FreeBSD\BOOTX64.efi -L "FreeBSD"
```

gpart

```
$ gpart show
=>        40  4000797287  nvd0  GPT  (1.9T)
          40        2048     1  efi  (1.0M)
        2088    73400320     2  freebsd-ufs  (35G)
    73402408   157286400     3  freebsd-ufs  (75G)
   230688808     6291456     4  freebsd-swap  (3.0G)
   236980264        2008        - free -  (1.0M)
   236982272      194560     5  efi  (95M)
   237176832    78125056     6  linux-data  (37G)
   315301888   146485248     7  linux-data  (70G)
   461787136  3539010184     8  linux-data  (1.6T)
  4000797320           7        - free -  (3.5K)
```


```
$ ls /dev/nv*
/dev/nvd0     /dev/nvd0p3   /dev/nvd0p6   /dev/nvme0
/dev/nvd0p1   /dev/nvd0p4   /dev/nvd0p7   /dev/nvme0ns1
/dev/nvd0p2   /dev/nvd0p5   /dev/nvd0p8
```


```
$ sudo efibootmgr -c -d /dev/nvme0 -p 2 -l \EFI\FreeBSD\BOOTX64.efi -L "FreeBSD"
efibootmgr: invalid option -- d
efibootmgr:    [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] [--help]
  [-c -l loader [-k kernel ] [-L label] [--dry-run] [-b Bootvar]]
```

what would be the drive designation? nvd0 is not working,  and nvme0 does not work either.


----------



## aragats (Feb 5, 2020)

The man page efibootmgr() confirms that there is no such option *-d* in FreeBSD's version.
The FreeBSD disk notation is correct, but why you'd need it? efibootmgr() deals with mounted partitions, this is from my laptop:
	
	



```
# efibootmgr -v
BootCurrent: 0007
Timeout    : 0 seconds
BootOrder  : 0007, 0005, 0003, 0004
+Boot0007* FreeBSD HD(1,GPT,53c98c1e-46f0-11ea-a86b-3448ed0d54cc,0x28,0x64000)/File(\EFI\freebsd\loader.efi)
                      nvd1p1:/EFI/freebsd/loader.efi /mnt/tmp//EFI/freebsd/loader.efi
 Boot0005* debian HD(1,GPT,0bbed502-cbb0-4d0a-ae54-79adadc23d7d,0x800,0x100000)/File(\EFI\debian\shimx64.efi)
                     nvd0p1:/EFI/debian/shimx64.efi (null)
....
```

According to the man page:
	
	



```
The efibootmgr program can be used to create new EFI boot variables. To
    create a new boot var pointing to an installation with its EFI partition
    mounted under /mnt, the given loader and a label "FreeBSD-11":

       efibootmgr -c -l /mnt/EFI/BOOT/BOOTX64.EFI -L FreeBSD-11
```


----------



## userxbw (Feb 5, 2020)

I'll try that suggeston, as this is a after market install of FreeBSD efi file so it needs to be added to its efibootmgr 

it too looks like freeBSD uses forward slashes / whereas Linux uses back slashes \


----------

