Home OpenPanel Management • Quota management on your NAS with OpenPanel

Quota management on your NAS with OpenPanel

 - 

One nice feature to have on your NAS is quota management. Since you can put alot of users on your NAS, you won’t want them to be able to fill up your disks with all their data. With quota’s it’s easy to set “restricitions” on filesystem usage.

To fully use the quota system on your NAS you need to have a kernel which has quota support enabled (see my previous kernel customization post). You also need to have a filesystem which has it enabled, but can also be enabled on a running system with a simple remount.

In this post I’ll explain how to set up quota’s for the /home partition (as in my previous layout), but you can also use this for other partitions if necessary.

First install the quota software and it’s tools:
apt-get install quota quotatools

Then edit /etc/fstab to enable quota on the filesystem(s):
nano /etc/fstab
Edit the line with the /home partition:
/dev/sda3 /home ext4 defaults,usrquota 1 1
Modify it to the following for userquotas:
/dev/sda3 /home ext4 defaults,usrquota 1 1
Or modify it to the following for user and group quotas:
/dev/sda3 /home ext4 defaults,usrquota,grpquota 1 1
When done, save your changes.

Now create the quota files:
touch /home/aquota.user
touch /home/aquota.group

The second line is only necessary if you enabled group quotas.

Now we need to remount the /home partition:
mount -vo remount /home

Now let the quota tool check for enabled quotas and let it build the quota database. This can take a while:
quotacheck -vgum /home

After the above step is finished, enable the quota management tool:
quotaon -av

Now you can log in to your OpenPanel interface and modify users to have quotas on them regarding diskspace.
There is only one lacking point: OpenPanel itself does not see the used quota for the user, only the set quota. This is a feature which will be added with the 1.1 release in a couple of weeks.
However, users can check their quota via the commandline with:
quota -v
Which will create some output like:
$ quota -v
Disk quotas for user backup (uid 34):
Filesystem blocks quota limit grace files quota limit grace
/dev/sda3 0 0 0 0 0 0

Obviously, this user “backup” does not have quota enabled (user based), if it had, you would have seen the quotasettings.

TIP:
On some systems the quotatool is not enabled on a system start, if you see this happen, add the following line to your /etc/rc.local file:
quotaon -a >/dev/null 2>&1

Author:langerak

Leave a Reply

Your email address will not be published. Required fields are marked*

*

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.