How To Set Up Journaled Quota On Debian Lenny

Want to support HowtoForge? Become 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 cvgeeks (registered user) on Mon, 2011-06-13 23:58.

First thank you for this tutorial I'm sure once I figure out my problem all will be well again.

Second I waited to post this as I scowered the howtoforge site for help to no avail as well as other resources again to no avail. I have the same error even after following this tutorial.

quotacheck: WARNING - Quotafile //aquota.user was probably truncated. Cannot save quota settings...
quotacheck: WARNING - Quotafile //aquota.group was probably truncated. Cannot save quota settings...

I am now at the point where I rebooted my server to remount it as per one suggestion and the server stops during boot with lots of errors like: cannot do this or that because of a read only file system.

When I try to do anything with quota after this reboot I get read only errors. like if I try to edit fstab for instance. So what i did was to reinstall the server now it's my third time and I keep running into the same problem. I have followed this tutorial using the cut and paste method so I know it's all good but somthing is not right :(

I followed this tutorial: http://www.howtoforge.com/perfect-server-debian-lenny-ispconfig3-p3 up until I got to the edit the fstab and install quota then I followed this tutorial: http://www.howtoforge.com/how-to-set-up-journaled-quota-on-debian-lenny

Can anyone help?

Submitted by Ken (not registered) on Fri, 2011-09-02 04:49.

Try this:
Enable quotas as described in /etc/fstab
mount /yourfilesystem -o remount
cd /yourfilesystem
quotaoff -augp
quotacheck -augmn
rm aquota.*
quotacheck -augmn
touch aquota.user aquota.group
chmod 600 aquota.*
quotacheck -ugamn
quotaon -avug

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.

Submitted by voltron81 (registered user) on Thu, 2010-05-27 17:02.

Hi to everybody.

I'm trying to setup quota service on my debian based local mailserver.

I've installed the package quota and I've followed this how-to to setup it.

After that unfortunately I still have some errors:

server:/# quotacheck -avugm
quotacheck: WARNING -  Quotafile //aquota.user was probably truncated. Cannot save quota settings...
quotacheck: WARNING -  Quotafile //aquota.group was probably truncated. Cannot save quota settings...
quotacheck: Scanning /dev/hdc2 [/] quotacheck: error (2133571361) while starting inode scan
 

Am I wrong in something?

Thanks

Michele

Submitted by lsw (not registered) on Sat, 2010-12-25 22:14.
This looks like you didn't follow the instructions correct...

You don't need the / before the filename in /etc/fstab