ZFS Cheatsheet
Create a pool
- Get disk ids from
/dev/disk/by-id, do not use/dev/sdX zpool create <name> <type> <disks>- Example:
zpool create ssds mirror nvme-Samsung_SSD_980_TB_ABCD nvme-Samsung_SSD_980_TB_EFGH - Don't set
ashift, let zfs figure it out. You can check withzdb -C <pool>what value it uses.- Only set it, if it's wrong.
ashift=12for 4K physical sectors
- Set
autotrim=onfor SSDs - When creating a pool
-ois for pool options. To pass options to the root dataset, use-O.
Create a dataset
zfs create <pool>/<dataset>- Disabling
atimeis no longer necessary, just make sure that bothatimeandrelatimeareon - For encryption specify:
-o encryption=on -o keyformat=raw -o keylocation=file:///path/to/key - Enable comporession:
-o compression=zstd recordsizeof 128K is default. When storing large files, e.g., media, set this higher, e.g., 1M