Samba and Quota (Linux)

David Lee T.D.Lee at durham.ac.uk
Thu Oct 14 09:08:48 GMT 1999


On Thu, 14 Oct 1999, Celso Kopp Webber wrote:

> let me be more clear about samba reporting quotas over NFS.
> Server "A" NFS mounts a 4.5 GB filesystem on server "B".
> If I issue "quota -u user" on server "A", it correctly reports disk usage for
> that user. This means quota and rpc.rquotad are working.
> User "bob" sitting in front of an NT WKS 4+SP5 maps his home dir on the
> [homes] share on server "A". Since his home dir is in fact NFS mounted from
> server "B", Samba reports its size as 4.5 GB, and NOT the user's limit. If
> user "fred" does the same, and his home dir is in fact on a native filesystem
> on server "A", Samba reports the share size as the user's limit.

Disclaimer:  what follows is in no sense "authoritative".  But I do have a
little experience with the quota code, having fixed it a few months ago to
handle Veritas quotas.  And I also point out that the quota code is marked
"experimental".

Samba's quota code (included by using the "--with-quotas" option to
"configure") reads the quota at a "low level", by calling directly into
the system subroutine (e.g. quotactl(), ioctl()) provided by the OS
vendor.  This system subroutine only handles local quotas, within that
machine, on one specifically requested filesystem.  By contrast, the
user-level UNIX "quota" command is much higher level:  it scans all
mounted filesystems, both local and remote (except those mounted
"noquota") and interrogates them all, using appropriate means (presumably
calling ioctl() for each local filesystem, and using the "rquota" RPC
mechanism for each remote filesystem). 

So the behaviour we see is a "feature" of the implementation of the
experimental quota code within samba.  If enabled, the basic algorithm is
something like:

    if (filesystem is local)
         try to get quotas()
         if (successfully got quotas)
             return (quota values)
         endif
    endif
    /* default case and fall through from above: */
    return ("df"-style values)

Summary:

1. samba code is experimental:  require "--with-quotas" on "configure";
2. only ported for some OS and filesystem types (they are all different!);
3. only works on filesystems local to the samba server.

(Re-read disclaimer!).  I hope the above is reasonably accurate.

[NB: our system has potentially 14,000 users spread across four samba
servers; our PC profiles ensure that the user logging on is mapped to the
correct samba server, primarily for efficiency, but also so that quotas
can be used.]


-- 

:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:  http://www.dur.ac.uk/~dcl0tdl            South Road            :
:                                           Durham                :
:  Phone: +44 191 374 2882                  U.K.                  :



More information about the samba-technical mailing list