Samba – How to set up disk quotas on a remote server in a Samba environment

cifsquotasamba

I've been working with an install of Ubuntu 8.04 and Samba.

I'm trying to set up user disk space quotas for our shared drive. That is, each user will have their own folder on our Network Attached Storage (NAS) that has a size limit. I can successfully mount the shared drive, but I can't figure out how to set quotas on it (I think smbcquota might work, but I'm not sure).

It's been suggested to me to give each user a share on the shared drive or to use NFS. Unfortunately, neither option works for my purposes.

Does anyone know how I could give users a quota on my NAS?

Best Answer

For Samba to support quotas, there must be few preconditions met: Samba must be compiled with quota support, the FS being shared must support quotas and have the quotas enabled.

To turn on quotas you need to:

  1. Add usrjquota=aquota.user,jqfmt=vfsv0 to mount options in /etc/fstab and create a aquota.user file in root directory of file system (if it's a /home FS, you can create it using touch /home/aquota.user.
  2. Re-calculate current disk usage with

    quotacheck -vguma
    

To set the quotas you may use either quotactl, quota and similar Linux tools or connect to the share as root (no other user will work, including the ones defined in admin users) and use the windows share properties to change quotas.