Skip to content

Instantly share code, notes, and snippets.

@heartshare
Forked from Alveel/zfs.md
Created December 14, 2020 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heartshare/f7f64f1a50ebf6a2c19713d661e5c673 to your computer and use it in GitHub Desktop.
Save heartshare/f7f64f1a50ebf6a2c19713d661e5c673 to your computer and use it in GitHub Desktop.
My ZFS setup for backuppc

Partitioning

# Logical volume is on an SSD/NVMe
lvcreate <vgname> --size 4G --name slog

zpool create tank raidz2 -o ashift=12 -O atime=off -O canmount=off -O compression=lz4 -O normalization=formD -O mountpoint=/opt/backups -O xattr=sa \
    /dev/vdb /dev/vdc /dev/vdd /dev/vde /dev/vdf /dev/vdg
zfs create tank/backuppc
zfs create tank/incoming
zfs create tank/restore
zpool add tank log <vgname>-slog

Parameters explained

Devices

/dev/vdb
/dev/vdc
/dev/vdd
/dev/vde
/dev/vdf
/dev/vdg

ARC, L2ARC and ZIL/SLOG

Adaptive Replacement Cache

Useful for increasing read speeds.

ARC is in RAM.

L2ARC is on a separate device. With only 16 GB RAM, configuring L2ARC is not beneficial. From 32 GB or higher read performance increases can be seen. Every block on L2ARC uses a bit of RAM. Formula: https://www.reddit.com/r/zfs/comments/4glcfb/l2arc_scoping_how_much_arc_does_l2arc_eat_on/d2iu4py/

Monitoring ARC: http://fibrevillage.com/storage/169-zfs-arc-on-linux-how-to-set-and-monitor-on-linux

ZIL/SLOG

ZFS Intent Log / Separate Intent Log

Default ZIL is on the pool itself. Using a SLOG on a faster device than is running the pool can improve performance, especially when writing small random IO. It does not matter much for large IOs.

It should be noted that if the SSD fails while there's still data not committed to the pool, that data will be lost.

Notes for Backuppc

Disable compression in backuppc as we already have practically transparent compression in zfs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment