This is a zfs cheatsheet that I’ll be able to keep it for future reference. The cheatsheet will be divided into two parts, zpool comands and zfs commands.
Zpool related
To create a mirror ( min two devices ) zpool create mpool mirror To create a stripe ( min 1 device ) zpool create spool To create raidz (min 3 devices ) zpool create raidzpool raidz Obtain all properties from a zpool zpool get all pool_name
ZFS related
To create normal zfs filesystem zfs create -o mountpoint=/path/to/mount testpool/example1 To create a snapshot zfs create snapshot testpool/example1@snap_name To create a recursive snapshot zfs create -r snapshot testpool/example1@snap_name To delete a snapshot zfs delete testpool/example1@snap_name To delete recursively snapshot zfs delete -r testpool@snap_name To send a snapshot to another host. zfs send testpool/dataset@snap_name |ssh remote_host zfs recv testpool2/new_dataset@snapshot To send a dataset and all of it's descendants datasets with options zfs send -vR testpool@backup |zfs receive -vd -F test2pool Defining several option while creating a zfs dataset. zfs create -o quota=10G -o recordsize=8k -o mountpoint=/mnt/test,compression=on,dedup=on rpool/test_ds Obtain all the properties for a zfs dataset zfs get all pool_name/dataset
NOTE: While creating a new dataset with options, the ones that require numbers like quota and recordsize need to have separate -o.