Skip to content

ZFS Notes

In this document, replace worldsgrave with the name of your zpool.

Compression

Use lz4 compression, it's fast and efficient.

zfs set compression=lz4 worldsgrave

Access Time

Turn off atime, it's useless.

zfs set atime=off worldsgrave

De-Duplication

De-Duplication

NEVER use de-dupe, it's a massive performance hit.

Scheduled Scrubing

Create the following files:

/etc/systemd/system/zfs-scrub@.service
[Unit]
Description=zpool scrub on %i

[Service]
Nice=19
IOSchedulingClass=idle
KillSignal=SIGINT
ExecStart=/usr/sbin/zpool scrub %i

[Install]
WantedBy=multi-user.target
/etc/systemd/system/zfs-scrub@.timer
[Unit]
Description=Monthly zpool scrub on %i

[Timer]
OnCalendar=monthly
AccuracySec=1h
Persistent=true

[Install]
WantedBy=multi-user.target

Enable and start the new service:

systemctl daemon-reload
systemctl enable zfs-scrub@worldsgrave.timer

Scheduled Snapshots

Install zrepl, see zrepl.yaml for reference.

Useful Commands

List datasets

zfs list -o type,name,available,used,logicalused,usedbysnapshots,compressratio,mountpoint

List snapshots

zfs list -t snapshot

Recordsize

 zfs get recordsize -t filesystem

Aliases

alias zls="zfs list -o type,name,available,used,logicalused,usedbysnapshots,compressratio,mountpoint"+
alias zsl="zfs list -t snapshot"