Subject: Disk Quota's over NFS
To: None <>
From: Duncan McEwan <>
List: tech-net
Date: 11/27/2002 17:08:16
I'm experimenting with disk quotas at the moment and everything seems to work
as expected when a quota is exceeded on a local file system (kernel logs a
message to my terminal saying "write failed, user disk limit reached" and the
application writing the file prints out "Disc quota exceeded".

But when I do the same thing on a workstation with a file system mounted via
NFS I get odd results.

The following command sequence shows a user "visitor6" with a soft quota limit
of 51200 blocks and a hard limit of 102400 blocks.  They currently have 85172
blocks allocated so are over their soft limit.  If they then try to make a copy
of a 70MB file they should exceed their hard limit after about 17MB's are
copied.  But "ls -l"'s done while the cp was running show that it seems to copy
the entire file before truncating it to 17MB.

| barretts% df .
| Filesystem              1K-blocks     Used    Avail Capacity Mounted on
| rialto:/am/rialto/home2  13968878  4578950  8691484    34%   /am/rialto/home2
| barretts% quota
| Disk quotas for user visitor6 (uid 1215):
|  Filesystem   blocks    quota    limit   grace   files   quota   limit  grace
| /am/rialto/home2
|                85172*   51200   102400   5days     271       0       0
| barretts% ls -l foo
| -rw-r--r--  1 visitor6  others  72546304 Nov 25 16:27 foo
| barretts% cp foo bar &
| [1] 5130
| barretts% ls -l bar
| -rw-------  1 visitor6  others  11796480 Nov 27 16:00 bar
| barretts% ls -l bar
| -rw-------  1 visitor6  others  22675456 Nov 27 16:00 bar
| barretts% ls -l bar
| -rw-------  1 visitor6  others  68747264 Nov 27 16:00 bar
| ...
| barretts% ls -l bar
| -rw-------  1 visitor6  others  17629184 Nov 27 16:00 bar
| [1]  + Done                          cp foo bar
| barretts%

So, one question is why does the copy not terminate as soon as the hard
limit has been exceeded.  I can imagine NFS buffering/caching issues being
responsible for this.

More importantly, why does the cp command think that it finished successfully
and so doesn't provide any feedback to the user that the file hasn't been
copied properly?

Can quotas over NFS filesystems be made to work "right" or are they just not
that useful?  (In case anyone is wondering, both client and server kernels are
built with "options QUOTA").