FreeBSD Handbook : Disk Quotas : Configuring Your System to Enable Disk Quotas
Previous: Disk Quotas
Next: Setting Quota Limits

10.1. Configuring Your System to Enable Disk Quotas

Before attempting to use disk quotas it is necessary to make sure that quotas are configured in your kernel. This is done by adding the following line to your kernel configuration file:

options		QUOTA
The stock GENERIC kernel does not have this enabled by default, so you will have to configure, build and install a custom kernel in order to use disk quotas. Please refer to the Configuring the FreeBSD Kernel section for more information on kernel configuration.

Next you will need to enable disk quotas in /etc/sysconfig. This is done by changing the line:

quotas=NO
to:
quotas=YES

If you are running FreeBSD 2.2.2 or later, the configuration file will be /etc/rc.conf instead and the variable name changed to

check_quotas=YES

Finally you will need to edit /etc/fstab to enable disk quotas on a per-file system basis. This is where you can either enable user or group quotas or both for all of your file systems.

To enable per-user quotas on a file system, add the userquota option to the options field in the /etc/fstab entry for the file system you want to to enable quotas on. For example:

/dev/sd1s2g    /home    ufs rw,userquota 1 2

Similarly, to enable group quotas, use the groupquota option instead of the userquota keyword. To enable both user and group quotas, change the entry as follows:

/dev/sd1s2g    /home    ufs rw,userquota,groupquota 1 2

By default the quota files are stored in the root directory of the file system with the names quota.user and quota.group for user and group quotas respectively. See man fstab for more information. Even though that man page says that you can specify an alternate location for the quota files, this is not recommended since all of the various quota utilities do not seem to handle this properly.

At this point you should reboot your system with your new kernel. /etc/rc will automatically run the appropriate commands to create the initial quota files for all of the quotas you enabled in /etc/fstab, so there is no need to manually create any zero length quota files.

In the normal course of operations you should not be required to run the quotacheck, quotaon, or quotaoff commands manually. However, you may want to read their man pages just to be familiar with their operation.


FreeBSD Handbook : Disk Quotas : Configuring Your System to Enable Disk Quotas
Previous: Disk Quotas
Next: Setting Quota Limits