[CentOS] Disk usage incorrectly reported by du

Robert Nichols rnicholsNOSPAM at comcast.net
Wed Mar 19 13:29:29 UTC 2014


On 03/19/2014 07:14 AM, Radu Radutiu wrote:
> I have an ext4  filesystem for which the reported disk usage is not
> correct.
...
> Here is the du output for for one directory exhibiting the problem:
>
> #du -h |grep \/51
> 201M    ./51/msg/8
> 567M    ./51/msg/9
> 237M    ./51/msg/6
> 279M    ./51/msg/0
> 174M    ./51/msg/10
> 273M    ./51/msg/2
> 341M    ./51/msg/7
> 408M    ./51/msg/4
> 222M    ./51/msg/11
> 174M    ./51/msg/5
> 238M    ./51/msg/1
> 271M    ./51/msg/3
> 3.3G    ./51/msg
> 3.3G    ./51
>
> after changing the directory and running du again I get different numbers
>
> #cd 51
> du -h
> 306M    ./msg/8
> 676M    ./msg/9
> 351M    ./msg/6
> 338M    ./msg/0
> 347M    ./msg/10
> 394M    ./msg/2
> 480M    ./msg/7
> 544M    ./msg/4
> 407M    ./msg/11
> 312M    ./msg/5
> 326M    ./msg/1
> 377M    ./msg/3
> 4.8G    ./msg
> 4.8G    .

The space used by hard-linked files will be included only in the first
directory where they are encountered.  In your first case, linked files
seen prior to the /51 directory would not have had their space included
again under that directory. In the second case, _only_ the /51 directory
is being examined, so all space will be included.

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.




More information about the CentOS mailing list