What I Know About Quotas


Setting Up Quotas On Linux

  • Make sure rpc.quotad is running
    Set up /etc/exports and run /usr/sbin/exportfs. Then start the daemon with /etc/rc.d/init.d/nfs start

  • In /etc/fstab, add usrquota to the options for the filesystem on which you want to run quotas. For example,

    Old /etc/fstab

    /dev/sdc1 /mnt/disk2 ext2 defaults 1 2

    New /etc/fstab

    /dev/sdc1 /mnt/disk2 ext2 defaults,usrquota 1 2

  • Remount the disk for the new options to be available
    mount -o remount /mnt/disk2

  • Create the file quota.user in the top level of the filesystem
    touch /mnt/disk2/quota.user
    chmod 600 /mnt/disk2/quota.user

  • Edit the quotas for each user
    edquota < user > *

  • Turn quotas on
    quotaon

    That's it.

    * You can also copy another user's quotas by using:
    edquote -p otheruser < user >


    Other Notes

    For filesystems that are NFS-mounted, a call to the server machine is performed to get the information. However, if the NFS-mounted disks are mounted using automounter, this call will not cause them to be mounted and the response to the quota query will be zero. Once the disks have been mounted, a correct answer will be given. The automounter also causes some confusion with the repquota command, since this command only looks to /etc/fstab to determine which filesystems to check. Finally, the quota command will not work on users with NFS mounted home directories, until that user has logged in once. Why this is true, I don't know.

    The command, quotacheck, will scan a filesystem for disk usages and should be run regularly (every night?) on those systems using quotas. It should be run when no users are logged on, as changing files while it is running may cause errors. As with repquota, quotacheck only looks to /etc/fstab to determine which filesystems to check. So quotacheck should be run on the systems where the disk is locally mounted.