Difference between revisions of "Basic disk quota configuration"

From Notes_Wiki
(Created page with "=Basic disk quota configuration= To enable user quota on some filesystem follow these steps: # Add option '<tt>usrquota</tt>' in '<tt>/etc/fstab</tt>' of the partition on whi...")
 
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Basic disk quota configuration=
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Filesystem configuration]] > [[Configuring disk quota]] > [[Basic disk quota configuration]]


To enable user quota on some filesystem follow these steps:
To enable user quota on some filesystem follow these steps:
Line 35: Line 35:


''Do not run quotacheck on filesystem when quotas are enabled (on).''
''Do not run quotacheck on filesystem when quotas are enabled (on).''
Refer:
* https://tldp.org/HOWTO/Quota.html
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Filesystem configuration]] > [[Configuring disk quota]] > [[Basic disk quota configuration]]

Latest revision as of 13:29, 14 July 2022

Home > CentOS > CentOS 6.x > Filesystem configuration > Configuring disk quota > Basic disk quota configuration

To enable user quota on some filesystem follow these steps:

  1. Add option 'usrquota' in '/etc/fstab' of the partition on which you want to enable quota
  2. Then unmount the partition, if it is already mounted. Mount the partition and verify that option 'usrquota' got enabled.
    If you have edited /etc/fstab file for a mounted partition then you can use
    mount -o remount <partition>
    to remount the partition with 'usrquota' option. This is in case filesystem is in use and cannot be unmounted.
  3. Use command 'quotacheck -vcf -F vfsv0 /home' to create new quota file where '/home' is the mount point for the partition. This command will take time based on the size of the partition.
    Do not turn quotas on before doing this. It is also recommended that the filesystem should not be in use otherwise the values would be wrong. 'quotacheck' tries to make the filesystem read-only while it calculates quota, if that is not acceptable use '-m' option of quotacheck command, after understanding its implications.
  4. Then enable filesystem quota with
    quotaon -av
    so that quota is switched on for all 'filesystems' listed in '/etc/fstab' with 'usrquota' option. This step is very important, just re-mounting the partition and creating quota file is not enough for calculating/enforcing quota.
  5. Use 'edquota -u <username>' to set quota. Current usage in blocks will be shown. Values are in kb. So you can set 100000 110000 as values for soft and hard blocks to set quota to 100MB-110MB.


Seeing quota

To see set quotas for all users we can use command

repquota -a

To see individual user quota we can use

edquota -u <username>

and see the value or we can also first `su - <username>' and then use 'quota' command.


Recalculating quota

If you feel quota is off the proper values and you want to force recalculation then

  1. First use 'quotaoff -av' to turn of quota for all filesystems with 'usrquota' option enabled.
  2. Then use 'quotacheck -vbf -F vfsv0 <mount_point>' if mounting filesystem and read-only is acceptable. If filesystem is in use then 'quotacheck -vbfm -F vfsv0 /home' command is better option.
    Here b is for backup and we omitted 'c' so that we do not loose current quota limits set manually using edquota.
  3. Then re-enable quota using 'quotaon -av' command.

Do not run quotacheck on filesystem when quotas are enabled (on).

Refer:


Home > CentOS > CentOS 6.x > Filesystem configuration > Configuring disk quota > Basic disk quota configuration