Quotas – installation and configuration

Quotas – installation and configuration

James wrote in with this how-to.
  Thank you.

Add QUOTA to your kernel

Your kernel needs the following in its kernel configuration file:

options QUOTA

For instructions on how to create a new kernel, refer to the Configuring the FreeBSD Kernel
section in the FreeBSD handbook.  Pay
special attention to the section on Building and Installing
a Custom Kernel
.

Specify the partitions

Decide what partitions you want to enable quota checking on and modify /etc/fstab
accordingly.  For each partition for which you want quotas enabled, modify that line
in the file.  userquota is for individual user quotas whereas.  groupquota
is for entire group quotas (i.e. the restrictions apply to groups as a whole).

For
example:

/dev/ad0s1f /home ufs rw,userquota,groupquota 2 2    

quotacheck

Start out by typing:

quotacheck -a 

This will create all the needed database files for the next command to work

quotaon/quotaoff

The following command will enable quotas for all quota-flagged partitions listed in /etc/fstab:

quotaon -a

You can also issue this command to enable quotas only for the partition /mount_point
(replace /mount_point with the partition applicable to your needs):

quotaon /mount_point

quotaoff has the same syntax as quotaon, but as the name implies,
it’s used to turn off quota.

user quotas

To edit user quotas, issue the following command:

edquota -u username

This excerpt from the edquota man page should help with editing quotas:

Users are permitted to exceed their soft limits for a grace period that may be
specified per filesystem. Once the grace period has expired, the soft limit is enforced as
a hard limit. The default grace period for a filesystem is specified in
/usr/include/ufs/ufs/quota.h. The -t flag can be used to change the grace period.

After you’re done editing the quota file, save your changes and exit the editor.

Repeat this step for each user that you want to have a quota.  If you have a bunch
of users that will use the same quota settings, type something like the following:

edquota -u -p user1 user2 user3 user4 

This will copy the quota settings from user1 to user2, user3, and user4. Specify as
many users as you need to copy the quotas.

group quotas

You can edit the quotas for a group by typing:

edquota -g groupname

Starting quotas at boot time

To ensure quotas are enforced after a reboot, add the following line to /etc/rc.conf:

quota_enable="YES"
check_quotas="YES"
    

Checking the usage

There will come a time that you will want to check your quota usage. Simply type the
following command to check your quota:

quota

Or, if you’re root, you can check quotas of other users by typing:

quota username

11 thoughts on “Quotas – installation and configuration”

    1. Agreed. I used this howto to (sucessfully) set up quotas on my system. I see nothing wrong with it, and it has been working quite well on my FreeBSD 4.3-RELEASE box for the past few months. In fact, I was having difficulty figuring out how to set up quotas via the handbook and this was the first place I checked. If you have any additional comments you would like to give to me about what I should do instead, please do so. Otherwise, I’d say read the tutorial a bit more thoroughly next time :).

      devon at sitetronics.com

    2. I found this HowTo to be incomplete. The referenced section of the FreeBSD Handbook did not specify anything about quota configuration. Nor did the HowTo provide an example format of the configuration. The section of the FreeBSD Handbook did provide this information.

      Furthermore, comments about the HowTo being plagurised from the FreeBSD Handbook are justified. I found this HowTo to be an incomplete and redundant subset of a more useful source. I shall not be accessing FreeBSDDiary.Org again.

    3. Funny.

      Besides the fact that this HOWTO worked…
      (thanks for this one)

      what logic is there in thinking one HOWTO sucks and
      therefor never visit FreeBSDDiary,org again ?!?!

      Oh well…

    4. well, it works. (on freebsd 4.9)

      so working stuff == sucks?
      not working stuff == rox?

      interesting logic you have there, my friend.
      next time, stop being childish and flame something useful without even trying it out.

  1. all you have to do is
    %checkquota -avug

    this command re-establishes the aquota.user file…
    in the root of file system…

    ehheehheeh

    ttfn…

    rekcah

    eol. .

  2. I was enabling quotas via the handbook and trying to figure out how to start quota’s on boot rather than having to enter qutoaon.

    This article seems to say that

    >To ensure quotas are enforced after a reboot, add the following line to /etc/rc.conf:
    >quota_enable="YES"
    >check_quotas="YES"

    Where as the handbook says to use

    enable_quotas="YES"
    check_quotas="YES"

    The hand book also mentions that check_quotas can be quite time consuming and that you may want to skip this step.

    Question 1) is it quota_enable or enable_quota ?
    Question 2) what is the best way to start ‘quotaon’ when the machine boots to make sure that quotas are implemented?

Leave a Comment

Scroll to Top