How To Set Up Journaled Quota On Debian Lenny

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Submitted by falko (Contact Author) (Forums) on Tue, 2009-06-23 09:54. :: Debian

How To Set Up Journaled Quota On Debian Lenny

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 06/22/2009

This tutorial shows how you can set up journaled quota on a Debian Lenny system. With journaled quota, you don't need to run quotacheck after an unclean shutdown. Journaled quota works on ext3 and ext4 file systems.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

If you set up quota the "normal" way (e.g. as shown in chapter nine on The Perfect Server - Debian Lenny (Debian 5.0) [ISPConfig 2] - Page 3), you might see the following warning:

quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown.

This is how you set up journaled quota:

 

2 Journaled Quota

To install quota, run

aptitude install quota

Edit /etc/fstab. Add usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 to the partition where you want to use quota. Mine looks like this (I want to use quota on the / partition):

vi /etc/fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/sda1       /               ext3    errors=remount-ro,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 0       1
/dev/sda5       none            swap    sw              0       0
/dev/hda        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0

To enable quota, run these commands:

touch /aquota.user /aquota.group
chmod 600 /aquota.*
mount -o remount /

quotacheck -avugm
quotaon -avug

That's it - journaled quota is now enabled.

 

3 Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by James (not registered) on Thu, 2009-08-06 06:55.

Hi, very useful tip. Do you know if this option exists on CentOS or RedHat Linux ?

 Regards

 

Submitted by RaSca (not registered) on Thu, 2009-07-16 09:19.

Thanks Falco, i noted also that if you want to remount the filesystem and you have a previously enabled quota then you had to turn it off before doing everything else:

$ mount -o remount /
mount: / not mounted already, or bad option
$ quotaoff /
$ mount -o remount /

in this way everything works greatly.

Thanks again for your good work!

Submitted by AndrewW (not registered) on Wed, 2009-06-24 03:00.

Thanks Falko.

I found that to remount successfully I had to remove the old quota.user and quota.group files.

Submitted by mountain (not registered) on Thu, 2009-08-20 21:54.

Hi,

I installed and configured quota and 'quota' shows me the correct settings.

~# quota
Disk quotas for user root (uid 0):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/sda1 2716812  8388608 10485760           87935       0       0

My soft limit is 8GB and hard limit is 10 GB. However, I do not see the 'out of disk space' error when the hard limit is exceeded.

When I attempt to create a file of size ~12GB using the 'dd' command, I only see a warning :

 :~# dd if=/dev/zero of=12gb-file bs=1024 count=12582912
: warning, user block quota exceeded.
12582912+0 records in
12582912+0 records out
12884901888 bytes transferred in 280.974633 seconds (45857883 bytes/sec)

The 12GB file gets written - Shouldn't I be getting the disk space error here?

 Thanks for any help on this.

Submitted by tensor (registered user) on Mon, 2009-09-28 20:28.

Try to set quota for ordinary user, not root. Root user has some additional blocks reserved for correct operation (5% by default). See "man mkfs.ext3" for details about this reservation.

Submitted by mountain (not registered) on Thu, 2009-08-20 21:52.

Hi,

I installed and configured quota and 'quota' shows me the correct settings.

~# quota
Disk quotas for user root (uid 0):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/sda1 2716812  8388608 10485760           87935       0       0

My soft limit is 8GB and hard limit is 10 GB. However, I do not see the 'out of disk space' error when the hard limit is exceeded.

When I attempt to create a file of size ~12GB using the 'dd' command, I only see a warning :

 :~# dd if=/dev/zero of=12gb-file bs=1024 count=12582912
: warning, user block quota exceeded.
12582912+0 records in
12582912+0 records out
12884901888 bytes transferred in 280.974633 seconds (45857883 bytes/sec)

The 12GB file gets written - Shouldn't I be getting the disk space error here?

 Thanks for any help on this.

Sponsored Links: Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com

One number. One voicemail. Seize the lead. Sprint Mobile Integration.
www.seamlessenterprise.com

One Number. One Voicemail.
Make it easier for clients to reach you. Turn your desk phone and mobile phone into one with Sprint Mobile Integration.
www.seamlessenterprise.com

One number. One voicemail. Sprint Mobile Integration.
www.seamlessenterprise.com

AT&T Synaptic Compute as a Service. Boost your power on demand.

Trial: IBM Cognos Express Reporting, Analysis & Planning