Thursday, 23 May 2019

linux - Difference between df -k and du -sh


df -k
/dev/sda6 25396228 21249088 2836240 89% /export
21G used

versus


du -sh /export 
3.4G /export

The 3.4G is correct because we have removed all non essential file but free space reported by df is not consistent with the actual free space that should be there.


Why is this so?



Answer



The files you removed are probably still opened by a process. Check:


lsof -a +L1 /export

I think this is because:



  • df checks blocks available (superblocks)

  • du totals up the space of each file.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...