Enable User Quotas

From BubbaWiki
Jump to: navigation, search

Enable User Quotas on B3

Author: Marten

NOTE: The kernel and modules used here are not fully tested so use at your own risk!

This small guide will help you get user quotas running on your B3.

This is the steps I took on B3 to get user quotas working. It might be missing some small thing as it took a lot of testing to get it. Feel free to comment on steps missing or clarifications needed.

1. Download files from - http://b3.update.excito.org/test/ .I used wget to download the kernel and module files.

wget filename

2. Install the packages manually:

dpkg -i bubba3-kernel_2.6.35.8-1.armel.deb bubba3-modules_2.6.35.8-1.armel.deb

3. Restart

4. Add quota support to mounted partition (I'm using journaled quota v2). Open fstab and add ,usrjquota=aquota.user,jqfmt=vfsv0 to /home partition

vi /etc/fstab

The line should look like this:

/dev/mapper/bubba-storage /home ext3 defaults,usrjquota=aquota.user,jqfmt=vfsv0 0 2

5. Remount the partition (restart will do it also):

mount -o remount /home

6. Check with "mount" if the partiton was mounted correctly. In my example:

/dev/mapper/bubba-storage on /home type ext3 (rw,usrjquota=aquota.user,jqfmt=vfsv0)

7. Add quota support to kernel modules

modprobe quota_v2
echo 'quota_v2' >> /etc/modules

8. Restart

9. Check "lsmod" and find:

quota_v2 3461 0

If you find it then the module loading was successful.

10. Create aquota files:

touch /home/aquota.user
chmod 644 /home/aquota.user

I'm using 644 instead of 600 because users can see their usage thatway.
11. Install quota (might be installed already but just to be sure)

apt-get install quota quotatool

12. Run quotacheck:

quotacheck -vcum /home

You should get something like this:

quotacheck: Scanning /dev/mapper/bubba-storage [/home] done
quotacheck: Old group file not found. Usage will not be substracted.
quotacheck: Checked 19 directories and 16 files

Wait for the scan to complete:
13. Turn the qouta on

quotaon /home

14. Use repquota (repquota -a for example) to check the current usage.

15. Now your done - quotas are working. Next step is to configure the usage limits.

16. You can use quotatool to set user quota limits. The example will set limit for user marten, using 15Mb for soft and 20Mb for hard limit on /home partition.

quotatool -u marten -bq 15M -l "20 Mb" /home