Wednesday, October 8, 2014

Configure Quota on CentOS

To configure disk quota on CentOS, follow these steps:

1. install the following packages:
yum install quota* -y
1. Enable user quota and/or group quota on a file system:
vi /etc/fstab 
UUID="93ee7df7-4f3c-4127-be2b-5229b219f644" /home ext4 defaults,usrquota,grpquota 0 0
2. Create the quota database:
quotacheck -cug /home
OR create the databases for all partition that have quota enabled
quotacheck -acug
3. Configure a quota for a user/group(modify the block limits in kb, that means 1024K*500=512MB):
edquota ramesh
Disk quotas for user dennis (uid 500):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/mapper/vg0-home         512000          512000          512000         11        0        0
4. Check if quota is enabled or not:
quotaon -ap
group quota on /home (/dev/mapper/vg0-home) is off
user quota on /home (/dev/mapper/vg0-home) is off
5. To enable the quota on all partitions have quota configured:
quotaon -av
6. To see the report of the quota:
repquota -sa
*** Report for user quotas on device /dev/mapper/vg0-home
Block grace time: 7days; Inode grace time: 7days
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      --       4       0       0              1     0     0    
dennis    --    501M    500M    500M             11     0     0  
 
 
    

No comments:

Post a Comment