Created
February 12, 2026 00:03
-
-
Save WietseWind/998d736ac6038a5acbd0f4a25d96cac0 to your computer and use it in GitHub Desktop.
Proxmox ZFS tuning
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # ZFS Performance Tuning - Non-persistent (apply after each reboot) | |
| # Auto-detects pools, datasets, and disks | |
| set -e | |
| echo "=== ZFS Performance Tuning ===" | |
| # --- ARC: set to ~200GB (adjust if your servers have less RAM) --- | |
| ARC_MAX=214748364800 | |
| echo "Setting ARC max to $(( ARC_MAX / 1073741824 ))GB..." | |
| echo $ARC_MAX | tee /sys/module/zfs/parameters/zfs_arc_max | |
| # --- IO queue depths for SSDs --- | |
| echo "Setting IO queue depths..." | |
| echo 64 | tee /sys/module/zfs/parameters/zfs_vdev_sync_read_max_active | |
| sleep 1 | |
| echo 64 | tee /sys/module/zfs/parameters/zfs_vdev_sync_write_max_active | |
| sleep 1 | |
| echo 64 | tee /sys/module/zfs/parameters/zfs_vdev_async_read_max_active | |
| sleep 1 | |
| echo 64 | tee /sys/module/zfs/parameters/zfs_vdev_async_write_max_active | |
| #sleep 1 | |
| #echo 64 | tee /sys/module/zfs/parameters/zfs_vdev_async_max_active | |
| # --- txg timeout --- | |
| echo "Setting txg timeout to 10s..." | |
| echo 10 | tee /sys/module/zfs/parameters/zfs_txg_timeout | |
| # --- Set scheduler to none for all disks in ZFS pools --- | |
| echo "Setting IO scheduler to none for ZFS disks..." | |
| for POOL in $(zpool list -H -o name); do | |
| for DISK in $(zpool status "$POOL" | grep -E '^\s+(sd|nvme|vd)' | awk '{print $1}' | sed 's/[0-9]*$//'); do | |
| BLOCKDEV=$(echo "$DISK" | sed 's/p$//') | |
| if [ -f "/sys/block/$BLOCKDEV/queue/scheduler" ]; then | |
| echo " $BLOCKDEV -> none" | |
| echo none | tee /sys/block/$BLOCKDEV/queue/scheduler > /dev/null | |
| fi | |
| done | |
| done | |
| # --- atime=off on all ZFS filesystem datasets --- | |
| echo "Disabling atime on filesystem datasets..." | |
| for DS in $(zfs list -H -o name,type | awk '$2 == "filesystem" {print $1}'); do | |
| echo " atime=off on $DS" | |
| zfs set atime=off "$DS" | |
| done | |
| # --- sync=disabled on all pools --- | |
| echo "Disabling sync on all pools..." | |
| for POOL in $(zpool list -H -o name); do | |
| echo " sync=disabled on $POOL" | |
| zfs set sync=disabled "$POOL" | |
| done | |
| echo "" | |
| echo "=== Done. Current ARC size: ===" | |
| grep "^size" /proc/spl/kstat/zfs/arcstats | |
| echo "" | |
| echo "=== Pool overview: ===" | |
| zpool list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment