df -h and du -h different

Latest response

Hi,

with df -h I get 8.6 GB for a mount point. With du -h in the same directory I get 18 GB. The same can be observed with other mount points. Does anyone have an explanation for this?

Regrads,

Andi

Responses

Hi Andi,

This article from Tyler Carrigan (Enable Sysadmin) explains the main differences between df and dh in an understandable way. :)

Regards,
Christian

Hi Christian,

Thank you for the fast answer. But I know what the difference is between df and du.

The problem is, df only shows 8.6 GB and du 18 GB.

This would make df useless if df displays the wrong size.

Regards,

Andi

Hi Andi,

Well, this seems to be a question that pops up every now and then ... two examples, hope it helps. :)

https://serverfault.com/questions/57098/du-vs-df-difference

https://serverfault.com/questions/275206/disk-full-du-tells-different-how-to-further-investigate

Regards,
Christian

There are legitimate reasons why the du size might be bigger then df size, for example if there is any compression or de-duplication on the file system then du could be reporting the apparent space used whereas df may report the real disk space used on the disk. In particular if you are using xfs filesystems on RHEL8 then using cp --reflink to copy a file within a filesystem should increase the size reported by du but not that by df, as it uses the same blocks for both files but du doesn't know that.

We have a knowledgebase page on this also: The df and du commands provide different system information

Thank you Jamie for providing this comprehensive solution article. Haven't come across it before ... very useful. :)

Regards,
Christian

Hello Jamie,

Thank you for the knowledgebase page . But this is not my problem. In the knowledgebase page the problem is explained if du is smaller than df. I know the problem with [Mounted-over] and [Open / deleted]. My problem is that df is smaller than du.

Regards,

Andi

I think we'd need to investigate your specific filesystem layout and files to fully quantify the behaviour. Please feel free to open a support case for this.