Last active
November 8, 2024 23:58
-
-
Save hamano/4484915d82e99bc3da57f2e29cc20702 to your computer and use it in GitHub Desktop.
dfree-btrfs.sh
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 | |
declare -a res=($(sudo /usr/bin/btrfs qgroup show --raw -rF . | tail -1)) | |
if [[ ${res[3]} == "none" ]]; then | |
declare -a res=($(df /fs | tail -1)) | |
MAX=${res[1]} | |
FREE=${res[3]} | |
else | |
MAX=$((res[3] / 1024)) | |
USE=$((res[2] / 1024)) | |
FREE=$((MAX - USE)) | |
fi | |
echo ${MAX} ${FREE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment