ZFS starter
ZFS is a 128-bit file system and logical volume manager. It combines the concepts of a file system and a volume manager, so it can manage both the storage and organization of data without requiring a separate volume manager. ZFS uses a "copy-on-write" mechanism, meaning that it writes new data to a new location and updates metadata only after the write completes, which helps prevent data corruption. It has built-in support for snapshots and clones, allowing for instant backups and copies of data without duplicating the actual data. ZFS also includes checksumming for every block of data, helping to detect and automatically repair any data corruption that occurs over time.
Pool Creation
Create a pool on a single disk without dedup or compression features with 1 MB block size. Example for media files which are already compressed and large. Many of the settings are available on the dataset level, but the pool's properties will be the default for its datasets.
# create pool on a disk with a given UUID
zpool create tank1 /dev/disk/by-uuid/<UUID>
# deduplication is off by default, but make sure
zfs set dedup=off tank1
zfs set compression=off tank1
# turn access time updates off
zfs set atime=off tank1
zfs set recordsize=1M tank1
Dataset Creation
# turn on encryption and prompt the user for password
# encryption=on means aes-256-gcm by default
zfs create -o encryption=on -o keylocation=prompt -o keyformat=passphrase tank1/dataset1
Operation
# Encrypted datasets are not mounted by default.
# The mount command will prompt for the passphrase of the key.
zfs mount -l tank1/dataset1