Linux Fix Quotas

Fix Linux Quotas and Fix Cpanel/WHM quota

How do you fix Linux Quota? 
- "group block limit reached" error.
[userA@groupA1]$ cat TESTFILE > TESTFILE1
sda8: write failed, group block limit reached.
cat: write error: Disk quota exceeded
# cat /etc/fstab
/dev/sda3                 /                       ext3    defaults        1 1
/dev/sda8             /home                   ext3    defaults,usrquota,grpquota     1 2
/dev/sda7              /tmp                    ext3    defaults        1 2
/dev/sda6              /var                    ext3    defaults        1 2
/dev/sda5              /opt                    ext3    defaults        1 2
/dev/sda1             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sda2         swap                    swap    defaults        0 0

Note: 
Here is the command to edit quota for group (This has to run as root).
# edquota -g groupA1
[userA@groupA1]$ quota -gl
Disk quotas for group groupA1 (gid 60000):
Filesystem  blocks   quota    limit    grace   files   quota   limit   grace
/dev/sda8  185168* 150000  200000   6days  8393       0       0

-----

Quota Issues in Linux

Common reasons for quota problems

  • There are files owned by the same user elsewhere on the server.
  • The backup directory is being counted towards the users disk quota.
  • Extra log files are being counted towards the users quota.
  • Cpanel was just updated and the quotas are now unlimited.
Quick Fix - an easy way to fix quota issues

Step 1. Log into your server through SSH as the root user.

Step 2. Run the following command

/scripts/fixquotas

Advanced Fix - other reasons quotas are not working

Step 1. Find the user account where the quotas are incorrect and login to your server in SSH as root.

Step 2. Go to the users folder and check their disk space being used.

cd /home/username
du -h or try du -hs

Step 3. Check /etc/passwd and /etc/shadow to make sure there is no weirdness where the username shows up multiple times.

Step 4. Try finding other files owned by the user.

find -user username | more

This will list all files owned by this user that could be affecting the quota reported by Cpanel.

Step 5. Uncompressed backups can cause quota problems, ensure your backups are compressed in the WHM backup options.

Step 6. After your determine the source of the files and remove them then run /scripts/fixquotas
 

Quota Problem, /scripts/fixquotas no help. [fix]

Well I figured I would post this here as it seems to be a previously un answered problem, and this may help someone at some time.

Recently we faced the common cpanel quotas problem, 0mb used and unlimited quota. No problem, run /scripts/fixquotas right? No. Doing this did nothing to aid our problem. After a bit of snooping around and trial and error here is how we managed to fix it.

Note: 

Follow my instructions at your OWN risk. If you do this and somehow mess things up I am not to be held responsible. This shouldn't really harm anything even if it isn't the solution but still.. be warned.

First run "quotacheck -avugm", you should receive "quotacheck: Can't find filesystem to check or filesystem not mounted with quota option." If not you don't have the same problem.

Next step is to open fstab, type pico /etc/fstab.

The first line will probably look something like this:
"/dev/VolGroup00/LogVol00 / ext3 defaults 1 1"

What we want to do is change "defaults" to "usrquota".

Now save (ctrl + X, Y, Enter) and run "mount -o remount /".

Now run "quotacheck -avugm" once more. This time it should run through quotacheck normally.

After it is done running (and it may very well take quite a long time) you should get:
"Old group file not found. Usage will not be substracted.
done
quotacheck: Checked xxxx directories and xxxx files"

This is a good thing. Now run run "quotaon /"

Now your space used should be correct, but quotas may still be unlimited.

This isn't a problem, just run good old /scripts/fixquotas and let it run through. It will probably run quotacheck again but it won't hurt anything. And when it's done your quotas should be working as normal.

/scripts/initquota

Linux Tips

See Also
Auditing Change Settings Iptables

Have a Linux Problem
Linux Forum - Do you have a Linux Question?

Linux Books
Linux Certification, System Administration, Programming, Networking Books

Linux Home: Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.