Adding nvme drive on 13.2 RC5 and changing to efi boot

I have a test machine that was originally configured with an earlier version of FreeBSD. The boot type was using GPT and freebsd.boot. I upgradeded the OS via a source compile to 13.2 RC5 and everything worked fine. I then decided to move to an efi boot process, which the mb supports. I added a second nvme drive, partitioned and labelled with with gpart, created the proper /boot/efi partition using msdosfs, copied over the loader.efi and bootx64.efi loaders, and edited the fstab file appropriately with the root on the new nvme drive. I kept the first nvme drive in place since I plan to use it for other purposes. The machine boots fine using efi, but each time it boots, it mounts the original root on the first nvme drive, ignoring what is in the fstab file.

I've tried mutiple things to overcome this, but none has worked. For example, in the boot loader, I did an lsdev
to locate the second nvme drive's root partition, which was disk2p2, and added, in the /boot/efi/efi/freebsd/loader.env the line rootdev=disk2p2. It boots fine with that entry, but again root is on the first nvme drive. I believe the efibootmgr variables are properly set, so I don't see that as a problem. Moreover, the mb reports the correct boot entries.

Any suggestions would be greatly appreciated.
 
I think I've solved this probem. The two root partitions, one on the original nvme drive and the second one on the new nvme drive had the same chars in the gpt label through 11 bytes followed by the the serial number. Not sure what length a gpt labrel should be, but I simplty changed the label on the old nvme drive (the one with freebsd.boot and the old root) so that it couldn't boot off that drive. It wouldn't boot off the new root, of course, but ended up in "select root mount mode". After fiddling a bit, I got it to mount the root on the new nvme drive, destroyed the partitions on the old nvme drive, and it now boots fine, using the efi partition and the root on the new nvme drive. I guess the moral is be careful about labeling drives.
 
Back
Top