Disk Quota Management

Disk Quota Management



     Disk quotas are commonly used by ISPs, by Web hosting companies, on FTP sites, and on corporate file servers to ensure continued availability of their systems.

         Quotas are used to limit a user’s or a group of user’s ability to consume disk space. This prevents a small group of users from monopolizing disk capacity and potentially interfering with other users or the entire system.

  • Soft limit

    This is the maximum amount of space a user can have on that partition. If you have set a grace period, this will act as an alarm. The user will then be notified she is in quota violation. If you have set a grace period, you will also need to set a hard limit. A grace period is the number of days a user is allowed to be above the given quota. After the grace period is over, the user must get under the soft limit to continue. By default grace period have seven days limits.
 

  • Hard limit

    Hard limits are necessary only when you are using grace periods. If grace periods are enabled, this will be the absolute limit a user can use. Any attempt to consume resources beyond this limit will be denied. If you are not using grace periods, the soft limit is the maximum amount of available space for each user.
 
  • Grace Periods

    Linux has provided the default of seven days for both inode and block usage. That is, a user may exceed the soft limit on either resource for up to seven days. After that, further requests by that user to use files will be denied.
    To do quota we will use edquota, repquota and quotacheck tools to create modify and report quota management.

Quota can be applied to users and groups, block size and inode number.

We have to install/verify quota packages is installed.


~]# rpm –qa |grep quota      - to verify quota rpm is installed or not
 


Now open /etc/fstab to open quota
/dev/sdb1    /qcheck   ext3    defaults,usrquota,grpquota 1 2



Either reboot or remount the file system to enable quota
~]# mount –o remount,usrquota,grpquota,rw /qcheck




In this case /qcheck is the mount point.

To enable or create a quota file we have to run
~]# quotacheck –cugm /qcheck

  quotacheck command options
                     -v scans and prints verbose
                     -c performs a new scan
                      -g scan quota for groups
                      -m remount the scanned file system
                      -u scan quota for users
                      -a Check all quota-enabled, locally-mounted FS

Switch on the quota using below command
~]# quotaon –avug



Now quota is on. Add quota soft and hard limits to any user
 



Now verify writing some dump data (dd command).

Login as a ravi user then
~]$ dd if=/dev/zero of=/qcheck/test bs=1024 count=10
~]$ dd if=/dev/zero of=/qcheck/test bs=1024 count=21
 


In above screenshot it is showing that warning and exceeded limits for user ravi.

To verify the quota settings
~]# quota –u <user name>

 


To increase a grace period for a user
~]# edquota –T <user name>





Enable the quota for a group.
~]# edquota –g <group name>
 


In this case quota is group name

Removing quota
Switchoff the quota
~]# quotaoff –avug



Then clear the entry in /etc/fstab 




Remount the partition using
~]# mount –o remount,rw <mountpoint>




It will clear the quota

Write your valuable comments below................



 

No comments:

Post a Comment