How are disk quotas computed

I have a problem in fact, again.

In SSH :

Code:
[root@serveur /]# quota -v customer
Disk quotas for user customer (uid XXX):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/hda2       8       0       0               2       0       0
/dev/mapper/volgroup1-home
                  26384  153600  153600            3993       0       0

And in DA :

Code:
domain.com 0.0 / unlimited 0.0  0 no 
Setting Current Usage Maximum Usage 
Bandwidth (meg) 0.0 7000 
Total Disk Usage (meg) 0.0 150 
  Email Disk Usage 0.00 KB  
  Database Disk Usage 0.00 KB

So there is a true problem, stats don't work anymore :'( where can be the problem ?
 
up :(

Edit : Solved !

I don't know what i did, i worked for one hour to do some update of the stats, some rm -rd etc. and now stats seems to be ok ... but it's very strange ^^
 
Last edited:
Hello,

I have some Trobles with QUOTA:

# quotacheck /
quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.
Please stop all programs writing to filesystem or use -m flag to force checking.

In /etc/fstab i have :

# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/VolGroup00/LogVol00 / ext3 rw,usrquota,grpquota 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc rw 0 0
none /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0

/dev/hdc /media/cdrom auto pamconsole,exec,noauto,managed 0 0

The Kernel :
Linux my.host.name 2.6.9-42.EL #1 Sat Aug 12 09:17:58 CDT 2006 i686 i686 i386 GNU/Linux

Please if u have an idear
 
Hello,

I have some Trobles with QUOTA:

# quotacheck /
quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.
Please stop all programs writing to filesystem or use -m flag to force checking.

read posts 6 and 7 of this thread and see if they help.
 
Hello jamin,

I try what says in post 6-7 but still no work, u have some idears?

It is posibles the quota to not run in /dev/mapper/VolGroup00-LogVol00 ?

[root@s1]# quotacheck /
quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.
Please stop all programs writing to filesystem or use -m flag to force checking.

Tnx.
 
Try running the following 3 commands

[root@s1]# /sbin/quotaoff -a
[root@s1]# quotacheck -augm
[root@s1]# /sbin/quotaon -a
 
The following investigation has caused us to wonder the following:
  • How does DirectAdmin tally customer disk usage quotas?
  • Additionally, how does DirectAdmin tally the email disk usage?
  • Should customer IMAP directories be owned by root??

We have a customer on a server, which has a du that looks like this:
Code:
[root@server:~]# du -sm /home/customer /home/mysql/customer_db \
/var/spool/{mail/customer,virtual/customer_domains}
201     /home/customer
34      /home/mysql/customer_db
1       /var/spool/mail/customer
0       /var/spool/virtual/customer_domain_1
8       /var/spool/virtual/customer_domain_2

This would appear that all disk usage tallies up to ~247MB. In the DirectAdmin web interface, the usage for this customer shows:
Code:
Total Disk Usage (meg)	247.6
  Email Disk Usage	93.2 Mb	
  Database Disk Usage	32.1 Mb

Which makes sense on the surface. However, neither /home/customer/domains/customer_domain/stats or /home/customer/domains/customer_domain/logs are customer owned (root owned), so they would need to be removed from our estimate, I would think:
Code:
[root@server:~]# du -sm /home/customer/domains/customer_domain/{stats,logs}
3       /home/customer/domains/customer_domain/stats
17      /home/customer/domains/customer_domain/logs

Further, there are root owned IMAP files which attribute a massive chunk of the du as well:
Code:
[root@server:/home/customer/imap/customer_domain/user/mail]# ll
total 86260
-rw-rw----    1 customer mail          515 Mar 17  2004 Drafts
-rw-------    1 root     root          510 Mar 24  2004 INBOX.Drafts
-rw-------    1 root     root      1352035 Jun 13 09:18 INBOX.Sent
-rw-------    1 root     root     59751314 Jun 23 09:42 INBOX.Trash
-rw-rw----    1 customer mail        27653 Mar 17  2004 Sent
-rw-rw----    1 customer mail     27080691 Mar 17  2004 Trash

Using a find & tally command I wrote, I was able to discover that /home/customer only has ~116MB of actual customer owned files. See handy dandy oneliner:
Code:
t=0; for i in `find /home/customer -uid customer_uid -exec ls -ld {} \;|awk '{print $5}'`; \
do t=$[$t+i]; done; echo $t
(Note that the customer doesn't have very many files, so this works)

Naturally, one could also restrict find to only files, which would remove all the 4k directory counts as well, which would further lower the tally.

As a trouble shooting step, we tried setting the IMAP directories to customer ownership & re ran the tally, but that only skewed the disk usage even higher! :eek:

It is also worth mentioning that the email tally appears to be correct with or without the ownership of the IMAP files set (doesn't change, and appears to roughly match a du of /home/customer/imap, /home/customer/mail, /var/spool/mail/customer & /var/spool/virtual/customer/domains).

So, my questions, again, are:
  • How does DirectAdmin tally customer disk usage quotas?
  • Additionally, how does DirectAdmin tally the email disk usage?
  • Should customer IMAP directories be owned by root??

Every single control panel iv used, all of them, have a disk quota misrepresentation of what the true total is. I havent used one CP that repreents an accurate quota tally. Which amazes me really.
 
Interesting option. However, the email location assumption is flawed. There are actually not 2 possible locations that email can be, but 3:
1) on / or /home (quota'd)
2) on /var (NOT quota'd)
3) on /home & /var (quota'd _AND_ not quota'd)

In other words, I need DirectAdmin to use quota for files that are on quota'd filesystems, and count them up on non-quota'd filesystems.

The problem really comes down to email being stored in 4 different places:
1) /home/customer/mail = admin IMAP
2) /home/customer/imap = user IMAP
3) /var/spool/mail = admin POP
4) /var/spool/virtual/customer_domain = user POP

Is there a reason that /var should not be mounted usrquota,grpquota, so that everything is quota'd?


Did you add in MySQL? I dont think DA counts it.
 
Hello again,

I resolve the quota problem, a part of problem,

Now i see the quota is working fine but dosent update, if i put some muzic to mi site the quota on DA dosent Update, i see the old value, when i tipe:

echo "action=tally&value=all" >> /usr/local/directadmin/data/task.queue

/etc/init.d/directadmin restart

After i tipe that, seem to be ok, if u have any sugestion how to do this automatical, not manually.?
 
Hello and tnx for the answer

still dosent work, this is what i have in /etc/cron.d/directadmin_cron

* * * * * root /usr/local/directadmin/dataskq
2 0-23/6 * * * root echo 'action=vacation&value=all' >> /usr/local/directadmin/data/task.queue;
#5 0 * * * root /sbin/quotaoff -a; /sbin/quotacheck -augm; /sbin/quotaon -a;
5 * * * * root echo 'action=tally&value=all' >> /usr/local/directadmin/data/task.queue
20 4 1 * * root echo 'action=reset&value=all' >> /usr/local/directadmin/data/task.queue
0 4 * * * root echo 'action=check&value=license' >> /usr/local/directadmin/data/task.queue

The cron dosent have a error, sems to be ok :
Nov 30 10:53:32 s1 crond[24655]: (CRON) STARTUP (V5.0)
Nov 30 10:54:01 s1 crond[24664]: (root) CMD (/usr/local/directadmin/dataskq)
Nov 30 10:54:01 s1 crond[24666]: (root) CMD (/usr/local/directadmin/dataskq)
Nov 30 10:55:01 s1 crond[24673]: (root) CMD (/usr/local/directadmin/dataskq)

Any idears? Still dosent update the quota.
 
Last edited:
Back
Top