bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

df: inconsistent and misaligned output


From: Benno Schulenberg
Subject: df: inconsistent and misaligned output
Date: Fri, 08 Aug 2008 15:21:31 +0200
User-agent: KMail/1.9.9

Hi,

Using the --block-size option of df with a mere letter or with a 
number plus a letter gives different results:

$ df -B 1M
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/hda9                 7060      4347      2713  62% /
temporary                  237         0       237   0% /dev/shm
/dev/hda11               17257     12833      4424  75% /home

$ df -B M
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/hda9                7060M     4347M     2713M  62% /
temporary                 237M        0M      237M   0% /dev/shm
/dev/hda11              17257M    12833M     4424M  75% /home

The latter output is incorrect: there are no 7060 million blocks of 
1M on hda9.  For ls and du this may be the desired effect, for df 
it is wrong, or at least confusing.

When using strange block sizes (which result in a decimal part), the 
header line gets slightly misaligned:

$ df -B 2345
Filesystem         2.4kB-blocks      Used Available Use% Mounted on
/dev/hda9              3156696   1943669   1213028  62% /
temporary               105684         0    105684   0% /dev/shm
/dev/hda11             7716410   5738231   1978180  75% /home

When using --print-type, the content line for longer device names 
gets displaced:

$ df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/hda9 reiserfs     7228956   4451076   2777880  62% /
temporary    tmpfs      242020         0    242020   0% /dev/shm
/dev/hda11
          reiserfs    17670880  13140772   4530108  75% /home

This may be the intended effect, but it looks awful.  Why not give 
the Type column a little more breathing space?  (And why, for that 
matter, reserve space for the Type column when it is not being printed; 
why not push the other columns a bit further to the left then?)

When using --print-type together with --portability, output can get 
misaligned for longer device names:

$ df -T -P
Filesystem    Type 1024-blocks      Used Available Capacity Mounted on
/dev/hda9 reiserfs     7228956   4451076   2777880      62% /
temporary    tmpfs      242020         0    242020       0% /dev/shm
/dev/hda11 reiserfs  17670880  13140772   4530108      75% /home

Further, when using tiny block sizes (or huge disks), output will get 
severely misaligned:

$ df -B 1
Filesystem           1B-blocks      Used Available Use% Mounted on
/dev/hda9            7402450944 4557901824 2844549120  62% /
temporary            247828480         0 247828480   0% /dev/shm
/dev/hda11           18094981120 13456154624 4638826496  75% /home

df should either refuse to print this (and suggest using -H or -h or a 
larger blocksize), or resize the column widths to make the numbers fit.

Finally, why do --si and --human-readable use different column widths 
when there is no apparent need for that?

$ df -HT
Filesystem    Type     Size   Used  Avail Use% Mounted on
/dev/hda9 reiserfs     7.5G   4.6G   2.9G  62% /
temporary    tmpfs     248M      0   248M   0% /dev/shm
/dev/hda11
          reiserfs      19G    14G   4.7G  75% /home
$ df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/hda9 reiserfs    6.9G  4.3G  2.7G  62% /
temporary    tmpfs    237M     0  237M   0% /dev/shm
/dev/hda11
          reiserfs     17G   13G  4.4G  75% /home


Benno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]