Created
May 12, 2014 07:30
-
-
Save steveh/7356e2ba93af5869f385 to your computer and use it in GitHub Desktop.
Samba dfree and zfs on Ubuntu 14.04
This file contains 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
# File: /etc/samba/smb.conf | |
dfree command = /usr/local/bin/dfree |
This file contains 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
# File: /etc/sudoers | |
ALL ALL = NOPASSWD: /usr/local/bin/zfs-get-used, /usr/local/bin/zfs-get-available |
This file contains 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 | |
# File: /usr/local/bin/dfree | |
CUR_PATH=$PWD | |
FILESYSTEM=$(df -PT $CUR_PATH | tail -1 | awk '{print $2}') | |
if [ $FILESYSTEM = 'zfs' ]; then | |
USED=$(sudo zfs-get-used $CUR_PATH) | |
AVAIL=$(sudo zfs-get-available $CUR_PATH) | |
AVAIL_KB=$(expr $AVAIL / 1024) | |
TOTAL_KB=$(expr $USED / 1024 + $AVAIL / 1024) | |
echo $TOTAL_KB $AVAIL_KB | |
else | |
df -PT $CUR_PATH | tail -1 | awk '{print $3" "$5}' | |
fi |
This file contains 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 | |
# File: /usr/local/bin/zfs-get-available | |
zfs get -o value -Hp available $1 |
This file contains 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 | |
# File: /usr/local/bin/zfs-get-used | |
zfs get -o value -Hp used $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also works on AlpineLinux
Kernel: 6.1.56-0-lts
Samba: 4.18.5-r0
ZFS: 2.1.11-1
Client: Win 11 Pro