Monday, 5 November 2012

du vs df commands

A few days ago I learnt the difference between the du and the df commands, so I thought that I would write it here so that I can safely forget about it :)

df - report file system disk space usage
du - estimate file space usage

What does this mean?

Take an example of a 1 KB file on a filesystem with a block size of 1 MB.

du will display that the file had used only 1KB.
df would display that 1 MB had been used. This is because the block is not free anymore.

This can lead to discrepancies in what is reported by both commands. The bigger your block size the more likely it is that there will be big discrepancies.

No comments:

Post a Comment