Skip to content
Advertisement

can i get df-h with full percent on disk volume? [closed]

all i get is round percentage:

[root@UML-0297 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-os
                   15G   14G  244M  99% /
/dev/mapper/VolGroup00-sdisk
                   15G  6.4G  7.1G  48% /servicedisk
/dev/mapper/VolGroup00-snaps
                   71G  4.7G   63G   7% /snapshots
/dev/mapper/VolGroup00-crashdumps
                   76G  180M   72G   1% /var/crash
/dev/sda1              99M   39M   55M  42% /boot
tmpfs                  12G   92K   12G   1% /dev/shm
/dev/sdbz              53T  1.9T   52T   4% /fs1
17.0.0.3:/fs1/         53T  1.9T   52T   4% /mnt/bwfs

Advertisement

Answer

You probably want percentage with fractional digits, à la 12.579%, then try:

  df|awk '/dev/{if ($2>0.0) {printf "%s: %.3f%%n", $1, 100.0*$3/$2;}}'

Perhaps you want disk quotas, or use stat(1) with --file-system

Advertisement