Putting Quota on a Samba-shared XFS

Jurjen Bokma

December 2009

We have a Samba server with users' homedirs, and we want them under a quota regime. Docs on quota are readily available, and xfs_quota is fairly well documented. There is even an XFS FAQ that mentions quota. But a Google search for an error indicating XFS_QUOTAON were not implemented gave a Slackware question in Linuxquestions as the best result. Luckily, it also featured the solution this time. Oh well.

Procedure 25.  Getting XFS quota to work on a sandbox

  1.   sudo apt-get install xfsprogs quota

  2. In /etc/fstab, modify the line pertaining to the filesystem like this:

    /dev/sda3       /mnt/D          xfs     defaults,uquota   0       0

  3. sudo mkfs.xfs -f /dev/sda3

  4. [Note]Note

    Maybe the aquota.* don't have to exist

    sudo touch /lwphome/aquota.{user,group}
    sudo chmod 600 /lwphome/aquota.{user,group}

  5. Remounting is not enough. The FS has to be unmounted, then mounted again.

    sudo umount /mnt/D/
    sudo mount /mnt/D/

  6. sudo xfs_quota -x -c 'limit bsoft=10m bhard=20m jurjen' /mnt/D1 2


    At least after this, you can use edquota as usual.


    Don't use a trailing slash here!

  7. sudo touch /mnt/D/bigblah
    sudo chown jurjen:jurjen !$
    dd if=/dev/zero of=/mnt/D/bigblah bs=1024 count=1000000000
    dd: writing `/mnt/D/bigblah': Disk quota exceeded
    20417+0 records in
    20416+0 records out
    20905984 bytes (21 MB) copied, 0.0443132 s, 472 MB/s

  8. sudo xfs_quota -x -c report /mnt/D 2>/dev/null |head
    User quota on /mnt/D (/dev/sda3)
    User ID          Used       Soft       Hard    Warn/Grace
    ---------- --------------------------------------------------
    root                0          0          0     00 [--------]
    chris               0      10240      20480     00 [--------] 1
    jurjen          20416      10240      20480     00  [6 days]


    This user not shown by repquota