motd.sh: fix zfs recursive snapshot usage
This commit is contained in:
parent
4ca796d515
commit
8748916cd7
6
motd.sh
6
motd.sh
@ -97,10 +97,10 @@ if test $(command -v zfs); then
|
||||
pcent=$(echo "($used/$ttlsize)*100" | bc -l | numfmt --format="%3.0f")
|
||||
gfxsize=$(numfmt --to=iec --format="%9f" $ttlsize)
|
||||
gfxused=$(numfmt --to=iec --format="%9f" $used)
|
||||
usedsnaprecursive=$(zfs get usedbysnapshots -r "$name" -H -p -t filesystem -o value | awk '{s+=$1} END {printf "%.0f", s}')
|
||||
usedsnappercent=$(echo "($usedsnaprecursive/$ttlsize)*100" | bc -l | numfmt --format="%3.0f")
|
||||
usedsnaprecursive=$(zfs get usedbysnapshots -r "$name" -H -p -t filesystem -o value | tail -n+2 | awk '{s+=$1} END {printf "%.0f", s}')
|
||||
usedsnappercent=$(echo "(($usedsnap + $usedsnaprecursive)/$ttlsize)*100" | bc -l | numfmt --format="%3.0f")
|
||||
useddspercent=$(echo "($usedds/$ttlsize)*100" | bc -l | numfmt --format="%3.0f")
|
||||
usedchildpercent=$(echo "($usedchild/$ttlsize)*100" | bc -l | numfmt --format="%3.0f")
|
||||
usedchildpercent=$(echo "(($usedchild - $usedsnaprecursive)/$ttlsize)*100" | bc -l | numfmt --format="%3.0f")
|
||||
DISKS+="$name $pcent% $gfxsize $gfxused $usedsnappercent $useddspercent $usedchildpercent x$compressratio\n"
|
||||
done <<< $(zfs list -H -p -d 0 -o name,available,used,usedsnap,usedds,usedchild,compressratio)
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user