Disk Usage – Why Do `du` and Quota Results Not Match?

disk-usagequota

I have exceeded my disk quota on a system which I do not have root access. I tried removing old files but am still over. I tried runing du to find where I am using up all my space but it reports I am using very little.

Results from quota

   /home/1234$ quota -s
   Disk quotas for user 1234 (uid 1234): 
        Filesystem   space   quota   limit   grace   files   quota   limit   grace
       cslab:/home   4519M*  4096M   5120M   09:47    6155       0       0 

From du

   /home/1234$ du -mad 1
   ...
   936     total

I don't understand why quota says I am using 4.5GB while du only counts .9GB.
I also checked for files I own in /tmp and there was 50MB worth of files there. Where could the other 3.5GB of files be? Is it possible the quota system is wrong and needs reset?

Best Answer

I believe there may be some files still held open by some processes. You can try to list them using,

lsof | grep username | grep deleted

A more better version would be to use,

lsof +L1 | grep username

However, sometimes there might be discrepancy in the output between du and quota which is explained in this link. Excerpt from the link,

In Unix, the du and quota commands may report different values. The reason for this discrepancy is that the process which goes through the file system, checks quotas, and updates the usage tables only runs at specific times. Therefore, there will be periods between quota checks that the quota -v command will report incorrect disk usage. Use the du command for the most accurate information about the size of your files.

Related Question