Tuesday, August 22, 2006

Quota

1: Check kernel options.

File systems -->
[*] Quota support
< > Old quota format support
<*> Quota format v2 support


Usually I use Quota format v2, if compiled as a module, it is called "quota_v2".

2: Check whether the "quota" package is installed.
# emerge -av quota

3: Modify /etc/fstab file.
To enable user quota support for that partition, add "usrquota" to the options such as below:
/dev/hda6     /home           reiserfs            noatime,usrquota,grpquota   0 0

To enable group quota, add "grpquota" as well.

4: Remount the partition that you have modified or added in quota support:
# mount -o remount /home

If it does not work, reboot.

5: Quota Check:
# /sbin/quotacheck -cguvamf -F vfsv0

6: Rerun Quota Check for old version (optional)
# /sbin/quotacheck -cguvamf -F vfsold

7: Turn on Quotas:
# /sbin/quotaon -a

To see the report of quotas, issue this command:
# repquota -as

To set a user quota, issue the following command:
# setquota -u NAME BLOCK-SOFTLIMIT BLOCK-HARDLIMIT
INODE-SORFLIMIT INODE-HARDLIMIT -a

Where:
NAME is the user
BLOCK-SOFTLIMIT in kilobytes
BLOCK-HARDLIMIT in kilobytes
INODE-SORFLIMIT set it to 0 normally
INODE-HARDLIMIT set it to 0 also

Or use the "edquota" command:
#  edquota -u USERNAME

Hard limit works only when grace period is set. It specifies the absolute limit on the disk usage, which a quota user can't go beyond his hard limit. Users are permitted to exceed their soft limits for a grace period that may be specified per filesystem. Once the grace period has expired, the soft limit is enforced as a hard limit. To set the grace period:
# edquota -ut


Check quota as a user:
$ quota -s


Note: "/etc/init.d/quota start" doesn't work, I don't know why. I have to add "/sbin/quotaon -a" to /etc/conf.d/local.start to activate quota on boot.

0 Comments:

Post a Comment

<< Home