Shell Open extra Geli disks & ZFS encrypted disks during boot

So I would like to be able to open and mount two encrypted "disks" during boot before the NFS server starts.
Can I use /etc/rc.local and /etc/rc.shutdown to open and close those disks?

Also, one disk is a geli encrypted external drive and the other it is a two disk striped pool with ZFS encryption.
The zfs one is easy, but regarding the GELI one: Is there some kind of partition uuid that I could use in a sh to open and close the geli encryption?
 
Besides custom scripts, FreeBSD has already system files permitting attaching and mounting geli(8) providers during boot, fstab(5) for example. Assuming externel drive partition is GPT labeled and geli(8) init "gpt/externgeli"

/etc/fstab
Code:
/dev/gpt/externgeli.eli       /media/externgeli   ufs     rw,late,failok      1       1

Partition uuid's are possible to utilize, but unwieldy to use:
Rich (BB code):
 % glabel list
...
Geom name: da1p1
Providers:
1. Name: gptid/6c865bf1-def0-11ef-a8d9-0800274cfdbf
...


Importing ZFS pools and mounting native encrypted datasets have also a system file: /etc/rc.d/zfskeys, but apparently that script is not functional anymore (tested on 14.1 and 14.2):
Code:
 # sysrc zfskeys_enable=YES
zfskeys_enable: NO -> YES

 # service zfskeys start
No key loaded for tank/enc.
Key file prompt not found, empty or unreadable. Skipping tank/enc..

 # zfs get all tank/enc | grep key
tank/enc  keylocation           prompt                 local
tank/enc  keyformat             passphrase             -
tank/enc  keystatus             unavailable            -

 # zfs mount -l tank/enc
Enter passphrase for 'tank/enc':

 # zfs get keystatus tank/enc
NAME      PROPERTY   VALUE        SOURCE
tank/enc  keystatus  available    -

/etc/rc.shutdown to open and close those disks
FreeBSD system files take care of detaching (and un-mounting filesystems) automatically geli(8) providers and native encrypted ZFS datasets, no need to create custom script entries.
 
Back
Top