Friday, April 08, 2011

How To Set Up Journaled Quota On Scientific Linux 6

As you already know, Scientific Linux 6 is a clon of RHEL 6, so this instructions should work for CentOS 6 too.

First do:
yum install quota

Also you have to edit the edit the /etc/fstab and add:
usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0

If you do not need to set quotas for groups then omit the grpjquota=aquota.group as I did, thenin my fstab I have this:

/dev/mapper/vg_aguila-lv_root   /   ext4   defaults,usrjquota=aquota.user,jqfmt=vfsv0   1  1
UUID=8768d821-e441-40fd-ac08-6ef7b6234d0f  /boot  ext4  defaults  1  2
/dev/mapper/vg_aguila-lv_swap  swap  swap  defaults  0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0


After that you need to use the following commands:
touch /aquota.user /aquota.group
chmod 600 /aquota.*
mount -o remount /

quotacheck -avugm
quotaon -avug

if you need to turn the quotas off then do:
 quotaoff /
or the equivalent
quotaon -f /

The quota system is ready to go, now we have to set the quotas for every user:
 edquota -u username

And we get:

Disk quotas for user username (uid 501):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/mapper/vg_aguila-lv_root         36        0          0         10        0        0


The system automatically uses the default editor.
If we want to set 5MB of quota for username then we edit the file to:

Disk quotas for user username (uid 501):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/mapper/vg_aguila-lv_root         36       5000          0         10        0        0




------
Related links:
Quotas on Debian Lenny
RHEL 6 Quotas
faqs.org