Skip to content

Instantly share code, notes, and snippets.

Last active Apr 11, 2022
What would you like to do?
disk free for samba that can determine fs type and calculate accordingly.
#Originally by stanislavs from post
#Used some updated code from github user umito / Peter on that site to clean up the non zfs code.
if [[ `findmnt -n -o FSTYPE -T "$PWD" | grep -c zfs` > 0 ]]
# echo "DEBUG: this is zfs"
USED=$((`zfs get -o value -Hp used $PWD` / 1024)) > /dev/null
AVAIL=$((`zfs get -o value -Hp available $PWD` / 1024)) > /dev/null
TOTAL=$(($USED+$AVAIL)) > /dev/null
# echo "DEBUG: this is not zfs "
df $PWD | tail -1 | awk '{print $2" "$4}'
Copy link

briancline commented Jun 22, 2018

Thanks - works well for both my ZFS for Linux samba shares and non-ZFS shares under Ubuntu 18.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment