27/10/2008

openSuSE and quota

If you ever have to setup a file server, e.g. published via SAMBA, you normally will set local quota in order to keep the hard drive usage under control. The standard commands to deal with quota are

/sbin/quotaon
/sbin/qutoaoff
/sbin/checkquota
/sbin/edquota
/sbin/repquota

You will have to enable quota in /etc/fstab for the mountpoint you want to use it:
open fstab with vi as superuser and add "usrquota,grpquota" to the options. The changed line might look like this:
/dev/sdb1 /home ext3 suid,dev,acl,usrquota,grpquota,user_xattr,exec 0 2

Remember, only native linux file systems will have the possibility to set quota.
Now you need to create the files where the quota information is stored:
being superuser, command:
touch /partition/aquota.user
touch /partition/aquota.group (if needed)
chmod 0600 /partition/aquota.*
The files aquota.* should be owned and read-writable for root only.
Remount the partition you just prepared quota for.
mount -o remount /partition
To edit quota for a user, use /sbin/edquota as superuser (it is essentially a vi).
To switch on quota, use /sbin/quotaon -avug, to switch off quota /sbin/quotaoff -avug
If you want to get a usage statistic use the command
/sbin/repquota -avug.

Finally, if everything works, you might want to have quota enabled by default at system startup. For openSuSE (found for 10.2, 10.3 and 11) this is easily achieved by commanding
cd /etc/init.d
insserv boot.quota
as superuser and rebooting the machine.

Warning: Never never never (I really mean it) install quota on the mountpoint / otherwise you might get into trouble if root cannot login any more, because the file space available for root has reached the limit...

No comments: