Zfs configuration

From wikinotes

Documentation

ZFS tuning https://www.freebsd.org/doc/handbook/zfs-advanced.html

Locations

/boot/loader.conf configure vfs.zfs.* features
/etc/sysctl.conf configure vfs.zfs.* features

zpool

zpools can be configured with various options.
By default, new zpools are created with all options - you'll need to add new options manually for long-lived zpools.

version/featureset

# lists version of all detected pools
# '-' indicates you are using feature-flags instead of a release-version
zpool get version ${pool}

# add all available feature flags to zpool
# see `man zpool-features` for a complete list
zpool upgrade ${pool}
zpool get feature@{feature_name}  # get value of feature
zpool get all                     # list all features

Properties

In addition to features, you can configure pools with properties.

zpool get autoexpand ${zpool}     # query 'autoexpand' property
zpool set autoexpand=on ${zpool}  # enable 'autoexpand' property

Some Notable Properties

autoexpand  # zpool grows to fill all avail disk-space

memory limits

By default, ZFS is allowed to consume nearly all available ram if it needs it.
If you are hosting other applications on your server, you may want to reduce this cap.
Memory issues are rare - for my fileserver backup, if allowed ZFS will use all 32GB-mem in addition to all swap.


You can configure the max with vfs.zfs.arc_max.

# /boot/loader.conf  ~OR~  /etc/sysctl.conf

vfs.zfs.arc_max = 32233238528  # in bytes

Or interactively

sysctl vfs.zfs.arc_max  # 3223328528   (zfs can use up to) 
sysctl hw.physmem       # 34197721088  (total memory)

# sysctl get (vfs|hw)  # list options under category

See