Friday, September 26, 2008

How to set up a quota

######### Procedure to set up the disk quota ############################
To set up the disk quota system, use the following procedure:
1. Log in with root authority.
2. Determine which file systems require quotas.
3. Use the chfs command to include the userquota and groupquota quota configuration attributes in the /etc/filesystems file.
The following example uses the chfs command to enable user quotas on the /home file system:
# chfs -a "quota = userquota" /home
To enable both user and group quotas on the /home file system, type:
# chfs -a "quota = userquota,groupquota" /home
The corresponding entry in the /etc/filesystems file is displayed as follows:
/home: dev = /dev/hd1 vfs = jfs log = /dev/hd8 mount = true check = true quota = userquota,groupquota options = rw
4. The following example uses the chfs command to establish user and group quotas for the /home file system and names the myquota.user and myquota.group quota files:
# chfs -a "userquota = /home/myquota.user" -a "groupquota = /home/myquota.group" /home
# The following example entry shows quota limits for the gpsilva user:
Quotas for user gpsilva:
/home: blocks in use: 30, limits (soft = 100, hard = 150) inodes in use: 73, limits (soft = 200, hard = 250)
This user has used 30 KB of the maximum 100 KB of disk space. Of the maximum 200 files, gpsilva has created 73. This user has buffers of 50 KB of disk space and 50 files that can be allocated to temporary storage.
5. To duplicate the quotas established for user gpsilva for user tneiva, type:
# edquota -p gpsilva tneiva
6. Enable the quota system with the quotaon command. The quotaon command enables quotas for a specified file system or for all file systems with quotas (as indicated in the /etc/filesystems file) when used with the -a flag.
7. Use the quotacheck command to check the consistency of the quota files against actual disk usage.
# very IMP
To enable this check and to turn on quotas during system startup, add the following lines at the end of the /etc/rc file:
echo " Enabling filesystem quotas "
/usr/sbin/quotacheck -a /usr/sbin/quotaon -a


########## Some examples #################
There are related commands, namely the edquota command, quotacheckcommand, and repquota command.
The following examples show the commands in typical uses:
1. To enable user quotas for the /usr/Tivoli/tsm/server/db file system,
# quotaon -u /usr/Tivoli/tsm/server/db
2. To disable user and group quotas for all file systems in the /etc/filesystems and print a message, enter:
# quotaoff -v -a
3. To display your quotas as user neivac, type:
$ quota
The system displays the following information:
User quotas for user neivac (uid 502):
Filesystem blocks quota limit grace Files quota limit grace
/u 20 55 60 20 60 65
4. To display quotas as the root user for user gpsilva, type:
quota -u gpsilva
The system displays the following information:
User quotas for user gpsilva (uid 2702):
Filesystem blocks quota limit grace files quota limit grace
/u 48 50 60 7 60 60


# To disable the quota use the command
# quotaoff -a ===> it disables the quota for all file systems.
# quotaoff -u username ===> it disables the quota for the users.
# Quotaoff -g groupname ===> it disables the quota for the groups.

No comments: