Quotas – installation and configuration
James wrote in with this how-to.
Add QUOTA to your kernel
Your kernel needs the following in its kernel configuration file:
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).
/dev/ad0s1f /home ufs rw,userquota,groupquota 2 2
Start out by typing:
This will create all the needed database files for the next command to work
The following command will enable quotas for all quota-flagged partitions listed in /etc/fstab:
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):
quotaoff has the same syntax as quotaon, but as the name implies,
it’s used to turn off quota.
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.
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:
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:
Or, if you’re root, you can check quotas of other users by typing: