mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2024-11-20 10:12:06 +01:00
added hdd used info
This commit is contained in:
parent
3ad873b6ad
commit
7c36c1a0a9
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
>&2 echo "# managing the data drive(s) with old EXT4 or new BTRFS"
|
>&2 echo "# managing the data drive(s) with old EXT4 or new BTRFS"
|
||||||
>&2 echo "# blitz.datadrive.sh [status|tempmount|format|fstab|raid|link|swap|clean|snapshots]"
|
>&2 echo "# blitz.datadrive.sh [status|tempmount|format|fstab|raid|link|swap|clean|snapshot]"
|
||||||
echo "error='missing parameters'"
|
echo "error='missing parameters'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -187,6 +187,22 @@ if [ "$1" = "status" ]; then
|
|||||||
echo "hddGotBlockchain=0"
|
echo "hddGotBlockchain=0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# used space - at the moment just string info to display
|
||||||
|
if [ ${isBTRFS} -eq 0 ]; then
|
||||||
|
# EXT4 calculations
|
||||||
|
hdd_used_space=$(df -h | grep "/dev/${hdd}" | sed -e's/ */ /g' | cut -d" " -f 3 2>/dev/null)
|
||||||
|
hdd_used_ratio=$(df -h | grep "/dev/${hdd}" | sed -e's/ */ /g' | cut -d" " -f 5 | tr -dc '0-9' 2>/dev/null)
|
||||||
|
hddUsedInfo="${hdd_used_space} (${hdd_used_ratio}%)"
|
||||||
|
else
|
||||||
|
# BRTS calculations
|
||||||
|
# TODO: this is the final/correct way - make better later
|
||||||
|
# https://askubuntu.com/questions/170044/btrfs-and-missing-free-space
|
||||||
|
datadrive=$(df -h | grep "/dev/${hdd}1" | sed -e's/ */ /g' | cut -d" " -f 5)
|
||||||
|
storageDrive=$(df -h | grep "/dev/${hdd}2" | sed -e's/ */ /g' | cut -d" " -f 5)
|
||||||
|
hddUsedInfo="${datadrive} & ${storageDrive}"
|
||||||
|
fi
|
||||||
|
echo "hddUsedInfo='${hddUsedInfo}'"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
Loading…
Reference in New Issue
Block a user