#!/bin/bash set -e # ---------------------------------------------------------------------------------------------- # --------------------------- ZFS ARC & Memory Snapshot for Unraid ----------------------------- # ---------------------------------------------------------------------------------------------- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/../common.sh" # Load central config load_master_conf # Parse CLI args (supports --dry-run) parse_args "$@" # Functions show_zfs_arc() { echo "--- ARC / Metadata Stats ---" grep -iE '^(c|meta|arc_meta_used|demand_metadata_misses|mru_ghost_metadata|mfu_ghost_metadata)' /proc/spl/kstat/zfs/arcstats } show_memory_status() { echo "--- Memory Status ---" free -h | awk 'NR==1 || /Mem:/' } # MAIN echo "===== ZFS ARC & Memory Snapshot: $(date) =====" if [ "$DRY_RUN" = true ]; then echo "[DRY-RUN] Would display ARC and memory stats" else echo "" show_zfs_arc echo "" show_memory_status fi echo "=============================================="