How to fix an incorrectly reported disk quota on a cPanel system

If you have a user that is getting over disk quota error message, but they claim to not have that much in use, they may have their disk quota being reporting incorrectly.

The first thing you should do however, is check to see if this is indeed the case.  If you run the following command, you can get a listing of every file on the server that is owned by their username.

find / -user 'username' | du -sh

Once it displays the output, you can go through it to see if they have files located somewhere other then their home directory that is using up their space.  If you have determined that everything is accounted for, but does not add up to the space reported in cPanel, then you can run the following commands to correct their quotas.

/scripts/generate_maildirsize --verbose --allaccounts --force --confirm
find /home/username/mail/ -name maildirsize | xargs rm -f

Once these 3 commands have been run, their cPanel should report the proper quotas again.