Monday, August 3, 2009

How to Fix Cpanel/WHM quota

To Fix Common reasons for quota problems

Run the following command as root user.

/scripts/fixquotas

Try finding other files owned by the user.

find -user username > /tmp/username.txt

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

Cpanel/WHM sometimes has problems with the user quota files causing all users accounts to have unlimited disk space available or 0 megs of disk space in use.

*To enable user quota support on a file system, add "usrquota" to the fourth field containing the word "defaults".

If you need both user quota and group quota support on a file system?, then edit /etc/fstab

...
/dev/hda2 /home ext3 defaults,usrquota,grpquota 1 1

touch /partition/aquota.user

chmod 600 /partition/aquota.user

Re-boot or re-mount file partition with quotas.

From the Linux Man Pages:

quotacheck - scan a filesystem for disk usage, create, check and repair quota files.

quotacheck -vgum /partition
or
quotacheck -vguma

-v, --verbose
quotacheck reports its operation as it progresses. Normally it operates silently. If the option is specified twice, also the current directory is printed (note that printing can slow down the scan measurably).

-u, --user
Only user quotas listed in /etc/mtab or on the filesystems specified are to be checked. This is the default action.

-g, --group
Only group quotas listed in /etc/mtab or on the filesystems specified are to be checked.

-m, --no-remount
Don't try to remount filesystem read-only. See comment with option -M.

-a, --all
Check all mounted non-NFS filesystems in /etc/mtab

NOTE
quotacheck should only be run by super-user. Non-privileged users are presumably not allowed to read all the directories on the given filesystem.

FILES

aquota.user or aquota.group : located at filesystem root with quotas (version 2 quota, non-XFS filesystems)

quota.user or quota.group :located at filesystem root with quotas (version 1 quota, non-XFS filesystems)
/etc/mtab names and locations of mounted filesystems


Example Steps for /home partition:

1. First check whether quota is enabled for /home partition.

# vi /etc/fstab

LABEL=/home /home ext3 defaults,usrquota 1 2

2. Remount the /home partition

# mount -o remount /home

3. Create a file called aquota.user for which we need to run quotacheck.

# quotacheck -c /home

4. Enable quota

# quotaon /home

This will enable quota on /home. Now you can edit the quota of a user using.

# edquota

5) Run /scripts/fixquotas this will solve the quota issue of cpanel accounts.

# /scripts/fixquotas

6) After this `repquota -a` should print out the soft/hard limits with grace periods for all users. If quotas are still not reporting anything in WHM and/or CPanel, check

# repquota -a

7) /var/cpanel/cpanel.config for disablequotacache=0

If that is set to 0, try setting it to 1 and see if that fixes it.

# vi /var/cpanel/cpanel.config ; /scripts/fixquotas

8) If a user’s quota shows more space being used than is in their home directory chances are there are stray files on the system owned by their UID. To find these files, run the following as root:

#
find -user username > /tmp/username.txt

Hope this helps.

No comments:

Post a Comment