[NBLUG/talk] About Quota

ME dugan at passwall.com
Wed Apr 30 07:49:00 PDT 2003


> Hello.
>
> I have a problem with quota.
> I work in a computer center of university and I like
> to set quota for users'mail spaces.
>
> I created a partition "/var/spool/mail" and changed
> the /etc/fstab and created the
> /var/spool/mail/aquota.user and aquota.group and run
> "checkquota -cug /dev/hda3"
>
> and then I changed the values of quota for a user like
> below :
>
>            Block soft limit :16     hard limit :19
>
> and then I send some mails to the user .
> but when I use "ls" I see that user's mail size is
> like below :
>         11k  /var/spool/mail/test
> and when I run "repquota -a"
> It show below line for user :
>        used     soft     hard
>          12       16      19
> But why when I send a small mail to this user , the
> mail returned to me by a message about "can't create
> file and exceed quota" ?
> while the user's mail size is 11k and it has space to
> reach 16k , so why it returned ?
>
> Regard.
>
> Please guide me .

I am not sure I can answer your question, but I can provide you with some
  suggestions on places to further dig:
  Have you enabled quotas on max number of files per user, and if so, are
  you using imap for mail storage with Maildir, or mbox format? Maildir uses
  separate files for each message. If you limit the number of files a user
  may create and have and are using Maildir then this kind of problem could
  happen.
  Next, it is possible that the mail server you have running on the box
  respects the soft limit for quotas. Try increasing the soft quota to be
  the same as your hard quota.
  Next, it is possible that your mail server makes a copy of the message
  under the name of the user and then tries to append the file copied to the
  user's maildir/mbox. You can test this by increasing the quota size to say
  1000kb and then send an e-mail that has an attachment that is 600kb in
  size. If the mail is bounced when a sift and hard quota od 1MB was set,
  then your mail server is likely making a copy of the message under the
  username before copying it to the user's maildir.
  Another suggestion? Perhaps the node size (minimum) is being used when
  even a small file is being created. If the minimum node size if say 4k on
  your filesystem, perhaps the enforced quotas see that you are trying to
  add up to 4k of data to ther user's account and that is reported to push
  the user over the soft limit.
  And one more thing, make sure the "block size" that is being used is
  actually a 1k block. A 512byte block will effectively cut in half the
  values you assign.

> We have many users and I want to set
> a 7M space for them .
> How should I do this?

Create a "templated" user that has the default settings you want, then
  write a script to iterate through a list of users and set these users to
  use the same settings.

  If you use bash, for example:
  Say I created a template user "mailuser" and set them up like this for 7MB
  of space:

  Disk quotas for user mailuser (uid 65000):
  Filesystem       blocks    soft       hard     inodes     soft    hard
  /dev/????           304    7000       8000         21        0       0

  Then, let's assume you want to enable quotas for every user who has a home
  dir that matches their username:

  (from bash)
  # cd /home
  # for i in * ; do (edquota -p mailuser -u $i ) ; done
  Of course the above loop will fail if you have user folders in home that
  are not the same as the users' usernames. Another one would be to use the
  /var/spool/mail locations instead of cd-ing into home.


  -ME





More information about the talk mailing list