You are not logged in.
I switched to btrfs today and noticed that conky doesn't show the correct size for my btrfs partitions.
So, i wrote a script to do that:
#!/bin/bash
# ~/.scripts/btrfs-size.sh
# use btrfs-show to print correct space estimates in conky
#
[[ $(id -u) -ne 0 ]] && echo "err, need root permissions" && exit 1
if [[ $1 = root ]];then
device=/dev/sda3
elif [[ $1 = home ]];then
device=/dev/sda5
elif [[ $1 = daten ]];then
device=/dev/sdb1
fi
used=$(btrfs-show $device | grep Total | awk '{print $7}' | tr -d MKGB)
total=$(btrfs-show $device | grep path | awk '{print $4}' | tr -d MKGB)
unit=$(btrfs-show $device | grep Total | awk -F'[0-9]' '{print $NF}')
echo $(calc ${total}-${used}) $unit
Adjust the $1 part and call the script in conky via
${exec sudo /path/to/btrfs-size.sh home}${color}
(add a NOPASSWD entry for btrfs-size.sh via visudo).
The script (resp. btrfs-show) needs root access and depends on "calc" for the calculation, so it's obviously not very well written. Feel free to improve .
Regards,
demian
Last edited by demian (2010-06-07 12:25:30)
no place like /home
github
Offline
instead of using calc cant you just use
echo $((${total}-${used})) $unit
?
Offline
Offline