public:zfs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
public:zfs [2026-10-06 21:17] – removed - external edit (Unknown date) 127.0.0.1public:zfs [2026-10-13 18:15] (current) – [Create a dataset] weichbr
Line 1: Line 1:
 +====== 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 with ''zdb -C <pool>'' what value it uses.
 +      * Only set it, if it's wrong. ''ashift=12'' for 4K physical sectors
 +   * Set ''autotrim=on'' for SSDs
 +   * When creating a pool ''-o'' is for pool options. To pass options to the root dataset, use ''-O''.
 +
 +A good set of defaults for a new pool:
 +''-o autotrim=on -O acltype=posixacl -O xattr=sa -O normalization=formD -O compression=zstd -O atime=on -O relatime=on -O %%"%%com.sun:auto-snapshot%%"%%=false''
 +
 +
 +==== Create a dataset ====
 +
 +   * ''zfs create <pool>/<dataset>''
 +   * Disabling ''atime'' is no longer necessary, just make sure that both ''atime'' and ''relatime'' are ''on''
 +   * For encryption specify: ''-o encryption=on -o keyformat=raw -o keylocation=file:/%%//%%path/to/key''
 +   * Enable compression: ''-o compression=zstd''
 +   * ''recordsize'' of 128K is default. When storing large files, e.g., media, set this higher, e.g., 1M
 +
 +Creating a dataset with encryption:
 +''echo -n password | zfs create pool/dataset -o compression=zstd -o normalization=formD -o xattr=sa -o acltype=posixacl -o atime=on -o relatime=on -o %%"%%com.sun:auto-snapshot%%"%%=false -o encryption=on -o keyformat=passphrase -o keylocation=file:/%%//%%dev/stdin''