ZFS Commands Cheat Sheet
My commonly used zfs
commands. I find the
Arch Wiki ZFS article
to be a great resource, and is more complete and meaningful
reference than my commonly used commands listed here.
Export a pool from a machine
This should be done before unplugging drives and plugging them into a new machine.
sudo zpool export mypool
List pools
sudo zpool list
List datasets
sudo zfs list
Change encrypted dataset key location
sudo zfs set keylocation=file:///keys/my.key mypool/mydataset
View/get encrypted dataset key location
sudo zfs get keylocation mypool/mydataset
Load the key for a dataset
sudo zfs load-key -r mypool/mydataset
Mount a dataset
sudo zfs mount mypool/mydataset
Change the mountpoint of a pool
sudo zfs set mountpoint=/mnt/whatever mypool
Change the mountpoint of a dataset
sudo zfs set mountpoint=/mnt/whatever mypool/mydataset
Create a zpool dataset with encryption
sudo zfs create -o encryption=on -o keyformat=raw -o keylocation=file:///keys/my.key mypool/mydataset
Destroy a zpool
zpool destroy mypool
Feel free to
contact me
with questions or feedback regarding this article.