Busby SEO Test - Limit User’s Disk Space (Setting Quotas)
General Information
This guide details how to set up user accounts with disk allocation. Let’s say you want to limit each user to a specific size disk usage — 100 megs each. You will need to set "user quotas." Here we go!!Requirements
- Root Access or Sudo Right
Configuration
First step is to make sure that quotas are configured into the Kernel. If you are not familiar with the process, learn to compile your kernel. Enable the following line in the kernel config:
| options QUOTA |
| # | echo ‘enable_quotas="YES"’ >> /etc/rc.conf |
Note: For finer control over your quota startup, there is an additional configuration variable available. Normally on bootup, the quota integrity of each file system is checked by the quotacheck program. The quotacheck facility ensures that the data in the quota database properly reflects the data on the file system. This is a very time consuming process that will significantly affect the time your system takes to boot. If you would like to skip this step, a variable is made available for the purpose:
| # | echo ‘check_quotas="NO"’ >> /etc/rc.conf |
| # | echo ‘check_quotas="YES"’ >> /etc/rc.conf |
| /dev/da1s2g /home ufs rw,userquota 1 2 |
| /dev/da1s2g /home ufs rw,userquota,groupquota 1 2 |
Now ensure quotas are enabled
| # | quota -v |
You are now ready to start assigning quota limits with the edquota command. There are two types of limits: hard and soft limits.
A hard limit may not be exceeded. Once a user reaches their hard limit they may not make any further allocations on the file system in question. For example, if the user has a hard limit of 500 blocks on a file system and is currently using 490 blocks, the user can only allocate an additional 10 blocks. Attempting to allocate an additional 11 blocks will fail.
Soft limits on the other hand can be exceeded for a limited amount of time. This period of time is known as the grace period, which is one week by default. If a user stays over his or her soft limit longer than their grace period, the soft limit will turn into a hard limit and no further allocations will be allowed. When the user drops back below the soft limit, the grace period will be reset.
The following is an example of what you might see when you run the edquota command. When the edquota command is invoked, you are placed into the editor specified by the EDITOR environment variable, or in the vi editor if the EDITOR variable is not set, to allow you to edit the quota limits.
| # | edquota -u test |
| Quotas for user test: /usr: blocks in use: 65, limits (soft = 50, hard = 75) inodes in use: 7, limits (soft = 50, hard = 60) /usr/var: blocks in use: 0, limits (soft = 50, hard = 75) inodes in use: 0, limits (soft = 50, hard = 60) |
