Last active
April 11, 2026 08:06
-
-
Save mwyau/dc18410b567a7479e44853d6fa6c654b to your computer and use it in GitHub Desktop.
dfree-zfs for Samba ZFS pools
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 | |
| POOLS=$(df -PT | awk '$2~"zfs" && $7~path {print $1}' path="^$(realpath ${1:-/mnt})" | awk -F'/' '{print $1}' | sort | uniq) | |
| USED=0 | |
| AVAIL=0 | |
| for pool in ${POOLS[@]}; do | |
| (( USED += $(zfs get -o value -Hp used $pool) )) | |
| (( AVAIL += $(zfs get -o value -Hp available $pool) )) | |
| done | |
| TOTAL=$(( USED + AVAIL )) | |
| echo $TOTAL $AVAIL 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment