9

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?

Trevor Hickey
  • 967
  • 3
  • 9
  • 17

2 Answers2

4

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.

Ramesh
  • 39,297
  • I have tried this but there are no open deleted files. – Brandon Clements Sep 22 '14 at 18:25
  • @BrandonClements, Is this link useful? – Ramesh Sep 22 '14 at 18:30
  • The link was useful, I did not consider that quota was only updated periodically. I will have to wait and see if this indeed my problem, but i think it is. Could you please move the link and a brief description into your answer. – Brandon Clements Sep 22 '14 at 18:41
  • @BrandonClements, updated. Let me know if you need more information! – Ramesh Sep 22 '14 at 18:44
  • It looks like it fixed itself overnight. For others who read this answer I would note that deleting small files appeared to have an immediate effect on my quota so I was not sure this was the case. It does appear to be so. – Brandon Clements Sep 23 '14 at 12:49
2

quota works by querying the filesystem for the blocks actually occupied by your files.

du works by scanning directories recursively for your files.

The two methods could yield different results. For example, when you "delete" a file, then it is no longer visible when listing the directory. However, the blocks on the disk are not actually freed until the last filehandle on it is closed. In that case, the file is invisible to du, but still counts against your quota.

200_success
  • 5,535