Setting and Modifying Quotas
For system administrators, one of the perennial challenges is managing disk space and making sure that no single user takes more than his or her fair share.
It Shows how to use the quota utilities to set, monitor, and enforce file system usage quotas for individual users and for groups of users.
The programs you use to set and enforce disk usage quotas include the following:
■■edquota— Sets, edits, and removes user and group file system quotas
■■ quota— Displays defined quotas and current file system usage
■■ quotacheck— Creates, checks, and repairs file system quota files
■■ quotaoff— Disables file system quotas
■■ quotaon— Enables file system quotas
■■ repquota— Summarizes and reports on quota utilization
■■ warnquota— Checks file system usage and sends email to users who exceed their assigned quotas
Quotas are set on a per-file-system basis, rather than per disk.
The procedure for initializing quotas on file systems is straightforward. the steps to follow are:
1. Edit /etc/fstab to enable quotas on the desired file systems.
2. Create the quota accounting files on the root directory of each file system for which quotas are enforced.
3. Turn on quotas.
4. Set the desired file system quotas.
5. Review quota utilization regularly and frequently.
In the following sections, you look at each of these steps and the commands to accomplish them.
To enable file system quotas, the first step is to drop the system to single user mode. To do so, press Ctrl+Alt+F1 to flip over to the first virtual console and then log in as root. After you have logged in, execute the following command to bring the system down to single-user mode:
# /sbin/telinit 1
The reason you should put the system into single-user mode is to prevent users from logging in and altering files.
If users alter files while you are setting up quotas, they might lose data.
Next, edit /etc/fstab and add the mount options usrquota or grpquota to the file systems on which enable quotas for users or groups, respectively.
/dev/hdb1 /data ext3 defaults,usrquota 1 2
To activate the changes you made to /etc/fstab, execute the mount command using the remount option to update the kernel’s mount table (/etc/mtab) with the quota option. For example, to activate quotas on the /data file system shown in the example, execute the following command:
# mount /home -o remount, rw
Not all quota implementations are created equal. Quota usage as described in this section assumes that you are using an ext3 file system.
Creating the Quota Files
Now that the system is prepared, the next phase of the procedure for setting up quotas is to create the accounting files quota uses to monitor file system usage.The quota accounting files are stored in the root directory of each file system.
To create these accounting files, execute the quotacheck command, as shown in the following example:
# quotacheck -uv /data
Quotacheck scans the specified file system to determine its current usage and then writes this information into the quota accounting files.
Turning on Quotas
After creating the quota accounting files, use the quotaon command to turn on quotas. quotaon’s invocation is simple
quotaon [-guv] -a | filesys
# quotaon -v /data
/dev/hdb1 [/data]: user quotas turned on
Setting and Modifying Quotas
To set quotas, use the quota editor, edquota, which has the following syntax:
edquota [-ug] -t
edquota [-ug] account
table: quotacheck Options
Posted By-: Vissicomp Technology Pvt. Ltd.
Website -: http://www.vissicomp.com