Why would you encrypt a zfs zvol device with gbde ? Because you can, and it is easy.
1.You stay away from system,boot&root partitions so you don't have boot problems.
2. Most private data is relative small. And fits in one directory with subdirectories.
Note : zfs allows encryption by itself but this method is more instructive.
Load the kernel module,
Create the zvol
Set the volmode
Make a lock file directory
Encrypt the device. Enter a passphrase. As blocksize you can choose 4096 which is 512*8
Format the encrypted device to UFS
Mount the encrypted device,
Set ownership & rwx flags,
The encrypted directory /private is ready to be used
A script to attach&mount,
A script to unmount&detatch,
1.You stay away from system,boot&root partitions so you don't have boot problems.
2. Most private data is relative small. And fits in one directory with subdirectories.
Note : zfs allows encryption by itself but this method is more instructive.
Load the kernel module,
Code:
kldload geom_bde.ko
Code:
zfs create -V 10G ZPOOL/private
Code:
zfs set volmode=full ZPOOL/private
Code:
mkdir /etc/gbde
Code:
gbde init /dev/zvol/ZPOOL/private -i -L /etc/gbde/private.lock
Code:
newfs -U -j -O 2 /dev/zvol/ZPOOL/private.bde
Code:
mkdir /private
mount /dev/zvol/ZPOOL/private.bde /private
Code:
chown myuser:mygroup /private
chmod 700 /private
A script to attach&mount,
Code:
/sbin/gbde attach /dev/zvol/ZPOOL/private -l /etc/gbde/private.lock
/sbin/mount /dev/zvol/ZPOOL/private.bde /private
/bin/df -H | /usr/bin/grep private
A script to unmount&detatch,
Code:
/sbin/umount /private
/bin/df -H | /usr/bin/grep private
/sbin/gbde detach /dev/zvol/ZPOOL/private