Skip to content

Instantly share code, notes, and snippets.

@timsonner
Last active July 19, 2026 22:05
Show Gist options
  • Select an option

  • Save timsonner/9cde7c63edb6ddd6a77d559322db4101 to your computer and use it in GitHub Desktop.

Select an option

Save timsonner/9cde7c63edb6ddd6a77d559322db4101 to your computer and use it in GitHub Desktop.
Cap ZFS ARC to free RAM under VMs / high memory pressure

One-liners to limit ZFS ARC (live + permanent) so it doesn’t eat most of your RAM next to KVM/libvirt guests. Defaults leave arc_max uncapped; 4–8 GB is a good desktop/VM ceiling.

Live:

# 8 GB ZFS ARC Cache
echo $((8 * 1024 * 1024 * 1024)) | sudo tee /sys/module/zfs/parameters/zfs_arc_max
# 4 GB ZFS ARC Cache
echo $((4 * 1024 * 1024 * 1024)) | sudo tee /sys/module/zfs/parameters/zfs_arc_max

Permanent:

# 8 GB ZFS ARC Cache
echo 'options zfs zfs_arc_max=8589934592' | sudo tee /etc/modprobe.d/zfs.conf && sudo update-initramfs -u 
# 4 GB ZFS ARC Cache
echo 'options zfs zfs_arc_max=4294967296' | sudo tee /etc/modprobe.d/zfs.conf && sudo update-initramfs -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment