Enabling Quotas in Debian 3.0

These instructions are for Debian 3.0. I have no idea if they'll work with later versions of Debian. This is Debian's stable distribution as of 2005-01-25. Note that I only cared about user quotas, not group quotas.

  1. Make sure that your kernel has quota support compiled in. This is a configure option with the 2.4.x kernel that I'm using. I forget if it's on by default or not.

  2. Install the quota and quotatool packages. The latter isn't strictly necessary, but it's a much nicer way of changing quotas from the command line than using edquota in my opinion. You probably want to say yes to the notification question when configuring the quota package.

  3. Add usrquota to the options line in /etc/fstab for the file systems that you want to turn on quotas for. This took me a bit to find, but it does appear to be necessary. It looks like the quota tools use it to figure out what file systems to check quotas for. (To add an option, just add a comma and "usrquota" after any options that are already there, possibly just "default".)

  4. Remount the file system so that usrquota shows up in the current file system options. I'm not sure if this is necessary, but I did it and it can't hurt. mount -o remount <fs> will do this (where <fs> is the path to the relevant file system).

  5. Make sure that nothing is writing to /home and the file system is completely dormant, and then build the initial quota database. Note that at least with Debian 3.0, I was unable to get the 2.0 quota database format to work with quotaon; I'm not sure why, but the 1.0 version worked fine. You can create the quota database with the command:

        quotacheck -cuv -F vfsold <fs>

    The "vfsold" part says to use the 1.0 database, -c says create, -u says user quotas (as opposed to group quotas), and -v says to say what it's doing.

  6. Enable quotas with /etc/init.d/quota start.

  7. Set quotas for each user you want to have a quota. You need to do this separately for every user; you can't set a quota for everyone at the same time. Use quotatool for this. -u specifies the user, -b says you're setting the limit on file size (you can also use -i for inode quotas), and -l sets the hard quota (-q sets the soft quota). See the man page for quotatool for more details. You'll probably also want to set the warning period for soft quotas. An example:

        quotatool -u example -b -l 768MB /home
        quotatool -u example -b -q 512MB /home
        quotatool -u -b -t "1 weeks" /home
    

    sets a 768MB hard quota and 512MB soft quota in /home for the user example and sets the warning period for 1 week for all users.

  8. View your new quotas, as well as usage information, with repquota. This is the best way to check on how everything looks.

Note that you may also want to run quotacheck periodically just to make sure that the database is correct (although it shouldn't strictly be necessary).

You can do much the same thing with -g options instead to turn on group quotas.

Last spun 2013-07-01 from thread modified 2013-01-04