Managing Disk Quota in OpenSuse 10.2

Hi all, once again I will post some stuff that makes your OpenSuse 10.2 become a very useful Server. This time I will give you how to manage the utilization of your hard disk usage by your user, in this case for your storage server. Sometime it really pain in the ass if one of our user put a lot of data in our very limited storage – like I did 😛 – so as an admin we should give some effort to limit their storage capacity.

First thing we should do is install quota package that you can do by going to yast -> Software -> Software Management -> in the filter choose search -> fill quota and try install it, it’s already provided in OpenSuse 10.2 installation.

Then after you install it you must edit /etc/fstab by adding usrquota and or qrpquota in the config line of your partition that you want to limit, for example you want to limit the usage of home folder so the /etc/fstab will be like this:

/dev/sda2 / ext3 acl,user_xattr 1 1
/dev/sda6 /data ext3 acl,user_xattr 1 2
/dev/sda5 /home ext3 acl,user_xattr,usrquota,grpquota 1 2
/dev/sda3 /opt ext3 acl,user_xattr 1 2
/dev/sda1 swap swap defaults 0 0

In this case it will your home parition will be limited, it can be by user based or group based, you can choose it.

After this you go to /home – partition that you want to limit – Inside you do:

touch aquota.user


chmod 600 aquota.user

chmod 600

Then you can check if it is working or not by typing:

quotacheck -avgum

After that reboot your machine

Now we can make some configuration to limit the hard disk usage. In this example I will try to make one user that become the template and after it will applied to other users. So first is editing the configuration by typing :

edquota -u username


edquota -g groupname

Then vi will show the configuration like this one :

Disk quotas for user user1 (uid 1024):
Filesystem blocks soft hard inodes soft hard
/dev/sdb1 3529984 5242880 5767168 116603 0 0

There are two things that you can limit in this configuration, one is by how many kilobytes data (blocks) that you can have or by how many file (inodes) that you can have, I prefer to use blocks. The example above is already configured, it is said that the user has already use the space around 3,5 gb while the user has the limit around 5gb and it can go above 5gb until 5,5 gb only in certain time (grace period), the aim for this is to make sure the user to manage the data so it still below 5gb.

One thing that happen if the user is already at hard limit they wont be able to write anything until they free some space. But if you set the hard and soft limit into 0 it means that they don’t have any limitation in their storage capacity. Basically you only need to edit hard and soft limit.

You can also edit the grace time, you can set it into days or hours or minutes or even seconds, if you want to be strict you just give them 0 time :P, anyway you can do it by typing

edquota -t

vi will show you this config file:

Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
Filesystem Block grace period Inode grace period
/dev/sdb1 0seconds 0seconds

After you finish make a quota for user1 you can employ the same setting to the other user, so that you don’t need to write it one by one 😛 you can do it by typing:

edquota -p user1 `awk -F: ‘$3 > 1001 {print $1}’ /etc/passwd`

It is said that we copy the config file from user1 to any user that has user id bigger then 1001, so it will start from uid 1002 and it will be applied to all the user that is listed in the /etc/passwd in your machine
, well if your user is using LDAP you can try match uid in your machine and the one in the LDAP is the same, some little trick 😛


2 thoughts on “Managing Disk Quota in OpenSuse 10.2

  1. very resourceful these informations you have..
    yet i am in need of further help with the anatomy on every command line above..
    it would be very generous of you to add some more info about it..

    thx b4

  2. which part of the command that you want? for me try :
    quotacheck –help
    edquota –help
    quite self explanatory for me 😀

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s