The FreeBSD Diary |
(TM) | Providing practical examples since 1998If you buy from Amazon USA, please support us by using this link. |
Quotas - installation and configuration --- by James
23 July 2000
|
James wrote in with this how-to. Thank you. |
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). 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:
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:
Or, if you're root, you can check quotas of other users by typing: quota username |