Zfs optimization
Jump to navigation
Jump to search
ZFS Optimization Get & Set
Get current settings for pool
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 <pool_name>"
exit 1
fi
POOL="$1"
if ! zpool list "$POOL" > /dev/null 2>&1; then
echo "Error: Pool '$POOL' does not exist."
exit 1
fi
echo "=== ZFS Pool Alignment ==="
zpool get ashift "$POOL"
echo ""
echo "=== Dataset Optimizations ==="
zfs get recordsize,atime,compression "$POOL"
echo ""
echo "=== TRIM Status ==="
zpool get autotrim "$POOL"
echo ""
zpool status -t "$POOL"
Set optimization
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 <pool_name>"
exit 1
fi
POOL="$1"
if ! zpool list "$POOL" > /dev/null 2>&1; then
echo "Error: Pool '$POOL' does not exist."
exit 1
fi
zfs set recordsize=1M "$POOL"
zfs set atime=off "$POOL"
zpool set autotrim=on "$POOL"
echo "Optimization settings applied to pool '$POOL'."