FreeBSD Quota Tutorial

This tutorial shows you how to enable hard disk quota on a FreeBSD system.

Compile a New FreeBSD Kernel

First, you have to compile/install a kernel that supports quota (not enabled by default) (more information about compiling a new kernel can be found here: https://docs.freebsd.org/en_US.ISO8859-1/books/handbook/kernelconfig-building.html).

cd /usr/src/sys/i386/conf
cp GENERIC MYKERNEL

Edit the fileMYKERNEL and add the line

options QUOTA

Then run the following commands

/usr/sbin/config MYKERNEL
cd ../compile/MYKERNEL

(For FreeBSD version prior to 5.0, use instead:

cd ../../compile/MYKERNEL )
make depend
make
make install

Enable Quota

Edit the file /etc/fstab and look for the entry, in which the directory /home is mentioned, e.g.

/dev/ad0s1d /home ufs rw 2 2

Add the words userquota and groupquota as follows:

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

To enable quota at boot time you have to add the following lines to /etc/rc.conf:

quota_enable="YES"
check_quotas="YES"

Reboot the system:

shutdown -r now

After the reboot run the following commands:

quotacheck -a
quotaon -a

Finally, install the setquota -Tool:

pkg_add -r setquota
Share this page:

Suggested articles

3 Comment(s)

Add comment

Comments

By: Anonymous at: 2005-11-01 20:52:30

check_quotas="YES"

quota_enable="YES" --> should be enable_quota="YES"

By: Anonymous at: 2006-01-09 19:03:16

enable_quotas="YES"

with the s

By: Anonymous at: 2006-06-13 01:50:17

Your kernel build is using the old non-recommended way the better way would be to

cd /usr/src/sys/i386/conf
cp GENERIC MYKERNEL
echo "options QUOTA" >>MYKERNEL
cd /usr/src
make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL

And you don’t really need the setquota package
You can use the quota and edquota commands like so
quota
edquota -u USER