Quota
With Quota you can specify the maximum available disk space and inodes per a user. It is useful only o big servers with thousands of users and you don't want them to store their Windows on the server :))
Installation: I use Debian and Quota is a part of the base system. You have to simply type 'dpkg -i quota*.deb' and dpkg will install it for you even in the rc files so you don't have to do anything to get it work. I don't know how it goes with the source distributions but if you send me one I'll be able to give you more information on that. One thing is sure, installing from source you have to make some adjustments in the rc files manually.
Creating Quota:
After install you have to get it run which doesn't take much time.
Compile Kernel:
Compile you kernel with quota support enabled in file-systems folder. You don't have to if you already have.
Add partition:
In '/etc/fstab' you have to specify on which partition you want to enable quota. If you have one, it won't be so difficult :)). Else put it on the partition(s) which is used by the users. My fstab looks like this:
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/hda2 / ext2 defaults,usrquota,grpquota 0 1
/dev/hda3 none swap sw 0 0
proc /proc proc defaults 0 0
'Usrquota' means that we can set quota user per user and 'grpquota' means that we can set quotas to groups but not for each user in one group. So if you have a system with 800 users you have to set quota user per user :((. So if you set the same values each user you have to copy that on the other ones in the following way:
edquota usernev1 #Mivel egy usernél mindenképp be kell állitanunk a limiteket. Ez lehet bármelyik user.
edquota first_user_name
edquota -p first_user_name 2dn_usr
After setting '/etc/fstab' you have to run 'quotacheck':
quotacheck -avug
On bigger partitions this may take a while. After checking the enables partition(s) creates 'quota.user' and 'quota.group' with which you don't have to deal with.
Quota Setup:
This is the way how you can set quota on different users or groups:
edquota user_name
edquota -g group_name
After a successful quotacheck run the following file will appear in the editor:
Quotas for user peti:
/dev/hda2: blocks in use: 4075, limits (soft = 5000, hard = 6000)
inodes in use: 289, limits (soft = 300, hard = 400)
As you can see it is a user settings. Group settings differs in the first line where you can see the group and groupname.
A little explanation line by line:
Quotas for user peti #just the owner info, don't have to modify
/dev/hda2: blocks in use: 4075, limits (soft = 5000, hard = 6000) #To change quota you have to edit the values in the brackets. 'Soft' specifies a limit that you can overrun for a specified period of time (set it in 'grace') and 'hard' specifies the maximum available disk space for the user. 'Block in use' field specifies the amount of disk space in 1024 bytes blocks used on a partition.
inodes in use: 289, limits (soft = 300, hard = 400) #the same as above just for the inodes
Setting 'hard|soft' values to zero switches off the function.
Grace Settings:
With 'grace' you can set the time limit for data above the 'soft' area set in the file above. The default is 1 week.
edquota -t #gives you the following file
Time units may be: days, hours, minutes, or seconds
Grace period before enforcing soft limits for users:
/dev/hda2: block grace period: 2 days, file grace period: 2 days
As you can see you can both specify the time limit for block and inode overrun.
Start Quota:
Everything is ready ??? Now all you have to do is start quota (lazy ones also can use reboot :) ).
/usr/sbin/quotaon -avug
And now all you users' lives are in you hands :))
That's all for today about quota. More info available in '/usr/doc/quota'.
Need more info directly from the author? Have any comments on the page ? Write for me or for us !