Encrypting a zfs zvol with geli

Load the kernel module
Code:
kldload geom_eli.ko

Create the zvol & set the volmode
Code:
zfs create -V 5G ZT/private
zfs set volmod=full ZT/private

Initialise the key
Code:
dd if=/dev/random of=mykey bs=64 count=1

Create the eli device with this key and enter passphrase
Code:
geli init -s 4096 -K ./mykey /dev/zvol/ZT/private

Attach the eli device
Code:
geli attach -k ./mykey /dev/zvol/ZT/private

Create the zpool
Code:
zpool create gelipool /dev/zvol/ZT/private.eli

Write your data ....

Export the zpool
Code:
zpool export gelipool

Detach the eli device
Code:
geli detach /dev/zvol/ZT/private.eli

When all data no longer needed:
Code:
zfs destroy ZT/private
 
Back
Top