Re: Customized df -h



On Mon, 10 Aug 2009, David Bolt wrote:-

And now I've spotted a bug with this. The total is wrong when you have
nfs mounted file systems. Replacing these lines:

# Get the sizes and percentage
SIZE=$(echo "${TMPF}" | egrep '^\/dev|@' |awk '{t2 = t2 + $2}END{print t2}')
USED=$(echo "${TMPF}" | egrep '^\/dev|@' |awk '{t3 = t3 + $3}END{print t3}')
AVAI=$(echo "${TMPF}" | egrep '^\/dev|@' |awk '{t4 = t4 + $4}END{print t4}')

with these:

SIZE=$(echo "${TMPF}" | egrep '^\/dev|@|:' |awk '{t2 = t2 + $2}END{print t2}')
USED=$(echo "${TMPF}" | egrep '^\/dev|@|:' |awk '{t3 = t3 + $3}END{print t3}')
AVAI=$(echo "${TMPF}" | egrep '^\/dev|@|:' |awk '{t4 = t4 + $4}END{print t4}')

fixes it for me.

davjam@moray:~/Documents> df-h
Filesystem Size Used Avail Use% Mounted on
donnas.davjam.org:/videos 466G 195G 272G 42% /mounts/donnas/videos
udev 2.0G 540K 2.0G 1% /dev
/dev/loop0 7.7G 7.7G 0 100% /mnt
/dev/mapper/500GB-500_home 410G 134G 277G 33% /home
/dev/mapper/500GB-tmp 9.7G 152M 9.1G 2% /tmp
/dev/mapper/500GB-usr 20G 5.1G 14G 27% /usr
/dev/mapper/500GB-var_log 1.5G 66M 1.4G 5% /var/log
/dev/sda1 160M 16M 137M 11% /boot
/dev/sda5 20G 1.2G 18G 7% /
/dev/sdb1 233G 108G 126G 47% /local/drive-f
/dev/sdc1 96G 62G 35G 64% /local/photographs
/dev/sdc5 96G 23G 74G 24% /local/DVD_temp
/dev/sdc6 95G 37G 53G 41% /local/music
/dev/sdc7 178G 136G 42G 77% /local/ISOs
-------------------------------------------------------------------
All in GB 1630G 705G 918G
All in TB 1.59T .68T .89T 43% @moray x86_64
-------------------------------------------------------------------


Regards,
David Bolt

--
Team Acorn: http://www.distributed.net/ OGR-NG @ ~100Mnodes RC5-72 @ ~1Mkeys/s
openSUSE 10.3 32b | openSUSE 11.0 32b | |
openSUSE 10.3 64b | openSUSE 11.0 64b | openSUSE 11.1 64b |
RISC OS 3.6 | RISC OS 3.11 | openSUSE 11.1 PPC | TOS 4.02
.