Solved

Disk Quota In Red Hat 9

Posted on 2004-05-01
17
2,039 Views
Last Modified: 2013-12-15
Hi Experts,

I want to control the use disk useage for webbase email accounts

My disk /etc/fstab is appended.
LABEL=/                /                        ext3    defaults        1 1
LABEL=/boot         /boot                   ext3    defaults        1 2
none                    /dev/pts               devpts  gid=5,mode=620  0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/shm             tmpfs   defaults        0 0
/dev/hda3             swap                   swap    defaults        0 0
/dev/cdrom           /mnt/cdrom         udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0                /mnt/floppy         auto    noauto,owner,kudzu 0 0

Users have their files mainly /home/~ and /var/mail/

Is it possible and advisable to implement the diskquota at the / and and allow a user
to have a limit of  say 10M.

Can I mount the following mount points and activate the diskquota.
LABEL=/home       /home                   ext3    defaults,usrquota,grpquota 1 1
LABEL=/mail       /var/mail/                ext3    defaults,usrquota,grpquota 1 1

Any idea or solution to the problem appreicated.

@ma

0
Comment
Question by:asidu
  • 9
  • 8
17 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 10967941
Using file systems quotas on /var/mail is pretty much a bad idea. At the point that your MTA (sendmail, postfix, etc) finds out that the user is over quota as a result of a write error the MTA has already accepted the message. This can result in lost email. If you reall need email quota's you need to be using a quota aware mail system like the Cyrus IMAP implementation.
0
 
LVL 12

Author Comment

by:asidu
ID: 10968081
I agree with your suggestion.
Can  this Cyrus IMAP run on Red HAt 9 ?
Assuming that loss of  email is accepatble could my intial idea be implemented ?

@ma
0
 
LVL 40

Expert Comment

by:jlevie
ID: 10968146
Yes, Cyrus works fine on RedHat 9.

I only mentioned the worst problem with trying to use file system quotas on a conventional mail system. Unless each of your mail users has and regularly uses a shell account to log onto the mail server there's no mechanism to tell the user that they are near or over quota. And becasue of the way mail is stored in a conventional mail system they won't be able to delete messages if they are over quota.
0
 
LVL 12

Author Comment

by:asidu
ID: 10970506

If I decided to install the Cyrus..where can I get the
the rpm for the Cyrus for  redhat 9.

Are there any ohter issues which I have to worry about when implementing
the Cyrus imapd ?

Do I have to stop the current Imap deamon which is working fine now with my webmail.

0
 
LVL 40

Accepted Solution

by:
jlevie earned 125 total points
ID: 10972293
I prefer to build Cyrus from source and you can see my procedure at http://www.entrophy-free.net/ Simon Mater has a set of RPM's for Cyrus at http://www.invoca.ch/pub/packages/cyrus-imapd/ that a number of folks have had good success with.

Switching to Cyrus is not terribly difficult, but I would not say that it is a trivial excercise. The biggest problem usually is in transfering existing mail from the mbox form into Cyrus. And no, you can't use the existing IMAP daemon so minor changes might be required in your Webmail configuration.

In addition to allowing quotas on mail there are several other advantages to Cyrus. Those include the ability to "black box" the email accounts such that those users don't need to be Linux accounts. this is a big advantage from a security viewpoint. Cyrus also provides a server based filtering system (Sieve) and the ability to have shared mailboxes. You should really read up on Cyrus (http://asg.web.cmu.edu/cyrus/) and consider how it would be best used in your environment before considering a change.
0
 
LVL 12

Author Comment

by:asidu
ID: 10974904
Excellent pointer. The two sites a good source of info.
I am not too sure if I have got the gcc on my machine to rebuild.

I will give a shot at  the second option and do some tests.
Which package  cyrus-imapd-2.1.src.rpm or cyrus-imapd-2.2.src.rpm could run on Redhat9 ?
Is there a need to rebuild the RPM ?

Thanks
0
 
LVL 40

Expert Comment

by:jlevie
ID: 10977324
2.1 is old and essentially in maintenance mode for exccedingly grevious bugs only. Go with 2.2 as it is the current release.
0
 
LVL 12

Author Comment

by:asidu
ID: 11032216
jleve,

I have down loaded the cyrus-imapd-2.2.3 in to my home directroy. I also down loaded the db-4.0.14 in my home direcotry and untar the file.
When I follow the procedure from your site I get the follwoing error. What am I doing wrong.

I tried to change some values in configure.in file but with out any success.

[root@Mastana cyrus-imapd-2.2.3]# ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for makedepend... makedepend
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for ranlib... ranlib
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for AIX... no
checking for strerror in -lcposix... no
checking for gawk... gawk
checking for an ANSI C-conforming const... yes
checking for long file names... yes
checking for __attribute__... yes
checking if compiler supports -fPIC... yes
checking for runpath switch... -Wl,-rpath,
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for unistd.h... (cached) yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking for memmove... yes
checking for strcasecmp... yes
checking for ftruncate... yes
checking for strerror... yes
checking for strlcat... no
checking for strlcpy... no
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for connect... yes
checking for res_search... no
checking for res_search in -lresolv... yes
checking for dn_expand... yes
checking for dns_lookup... no
checking for getaddrinfo... yes
checking for gai_strerror... yes
checking for getnameinfo... yes
checking whether you have ss_family in struct sockaddr_storage... yes
checking whether you have sa_len in struct sockaddr... no
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct tm.tm_zone... yes
checking for vprintf... yes
checking for _doprnt... no
checking authorization method... unix
checking db.h usability... no
checking db.h presence... no
checking for db.h... no
configure: error: Berkeley DB 3.x or later was not found.  You may need to
    supply the --with-bdb-libdir or --with-bdb-incdir configure options.

Any pointers would be appreciated.
@ma
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 40

Expert Comment

by:jlevie
ID: 11032593
That sounds like you don't have the db4-devel package installed from the RedHat distribution. For a number of reasons its better to use RedHat's copy of Berkely DB on something as recent as RedHat 9. If you install the missging package configure will work.

FYI: It's pretty important that your RH 9 box be up to date w/respect to the security & bug fix errata published by RedHat. Since RH 9 went "enod of life" last month you can't use up2date any more. But, Duke University has a Yum repository of all the errata published for RedHat versions and if you install yum http://linux.duke.edu/projects/yum/() you can use it to update your system.
0
 
LVL 12

Author Comment

by:asidu
ID: 11080570
jlevie,

I have installed the Berkerly DB 4 on my system and I still get the error

configure: error: Berkeley DB 3.x or later was not found.  You may need to
    supply the --with-bdb-libdir or --with-bdb-incdir configure options.

I see two new directories in my system viz
/usr/share/doc/db-4.0.14
/usr/local/BerkeleyDB.4.0/

i tired to pass the above in to the ./configure command
#CPPFLAGS=-I/usr/kerberos/include ./configure --prefix=/usr --with-auth=unix --without-ucdsnmp --with-bdb-incdir=/usr/local/BerkeleyDB.4.0 --with-bdb-libdir=/usr/local/BerkeleyDB.4.0
...sadly with out any success.

What else could be  messed up ?
Help appreciated.
Thank you


0
 
LVL 40

Expert Comment

by:jlevie
ID: 11081776
You don't want to use your locally built copy of BDB. Remove it by executing:

rm -r /usr/share/doc/db-4.0.14 /usr/local/BerkeleyDB.4.0/

Make sure that db4devel is installed by checking 'rpm -q db4-devel' and install it from your distro CD's if it isn't. Then use:

rm config.cache
CPPFLAGS=-I/usr/kerberos/include ./configure --prefix=/usr --with-auth=unix --without-ucdsnmp
0
 
LVL 12

Author Comment

by:asidu
ID: 11127633
jlevie,

I  managed to compile cyrus on my machine after installing the right version of db4-devel rpm.

Is the access to your  procedure at http://www.entrophy-free.net/  removed ?
Pls adivse.

 I am in the process of configuring  the impad now. Thank you for your guidance and time.

@ma
0
 
LVL 40

Expert Comment

by:jlevie
ID: 11130510
It's back up. It was down for about 24 hours while I rebuilt the firewall/web server. Updates for Cyrus 2.2.4 and the latest version of MailScanner will be up this evening sometime.
0
 
LVL 12

Author Comment

by:asidu
ID: 11136916
Good to see your site up again.
I followed throuhg the steps till step 4, testing IMAP
I am still running into problems  at.
I have started cyrus impad with
#service cyrus start

and whenI
 
[atma@Mastana atma]$ telnet localhost imap
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* BYE Fatal error: can't write proc file
Connection closed by foreign host.

How can I overcome the database errors in the log file ?

Error messages in the /var/log/cyruslog
May 23 18:32:31 Mastana master[21939]: setrlimit: Unable to set file descriptors limit to -1: Operation not permitted
May 23 18:32:31 Mastana master[21939]: retrying with 1024 (current max)
May 23 18:32:31 Mastana master[21939]: process started
May 23 18:32:31 Mastana master[21941]: about to exec /usr/cyrus/bin/ctl_cyrusdb
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: DBERROR db4: : No such file or directory
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: DBERROR db4: /var/imap/config/db/__db.001: No such file or directory
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: DBERROR db4: : No such file or directory
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: DBERROR db4: /var/imap/config/db/__db.001: No such file or directory
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: DBERROR: dbenv->open '/var/imap/config/db' failed: No such file or directory
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: DBERROR: init() on berkeley
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: DBERROR: writing /var/imap/config/db/skipstamp: No such file or directory
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: DBERROR: init() on skiplist
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: recovering cyrus databases
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: skiplist: recovered /var/imap/config/mailboxes.db (0 records, 144 bytes) in 0 seconds
May 23 18:32:31 Mastana ctl_cyrusdb[21941]: done recovering cyrus databases
May 23 18:32:31 Mastana master[21939]: ready for work
May 23 18:32:31 Mastana master[21945]: about to exec /usr/cyrus/bin/ctl_cyrusdb
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: DBERROR db4: /var/imap/config/db/__db.001: No such file or directory
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: DBERROR: dbenv->open '/var/imap/config/db' failed: No such file or directory
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: DBERROR: init() on berkeley
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: DBERROR: reading /var/imap/config/db/skipstamp, assuming the worst: No
such file or directory
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: checkpointing cyrus databases
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: archiving database file: /var/imap/config/annotations.db
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: archiving database file: /var/imap/config/mailboxes.db
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: DBERROR db4: txn_checkpoint interface requires an environment configured for the transaction subsystem
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: DBERROR: couldn't checkpoint: Invalid argument
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: DBERROR: sync /var/imap/config/db: cyrusdb error
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: DBERROR db4: DB_ENV->log_archive interface requires an environment configured for the logging subsystem
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: DBERROR: error listing log files: Invalid argument
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: DBERROR: archive /var/imap/config/db: cyrusdb error
May 23 18:32:31 Mastana ctl_cyrusdb[21945]: done checkpointing cyrus databases
May 23 18:32:32 Mastana master[21939]: process 21945 exited, status 1
0
 
LVL 40

Expert Comment

by:jlevie
ID: 11138183
In the telnet attempt "* BYE Fatal error: can't write proc file" sounds like a basic system problem where the proc file system update of the telnet process or the IMAP process ID failed.

The DB errors in the log are harmless for the initial startup. There simply weren't any databases or data to process. Those errors should disappear after there's been mail activity.

Is this a standard RH 9 system with all of the errata applied? Since I never attempt to use a new release for anything in the first couple of months after release (to allow time for the intial bugfixes to be released) and since I always keep my Redhat systems fully up to date I can't say if the process will work correctly on an "out of the box" install.

And, my procedure assumes that the standard RedHat kernel, libs, etc are present. If you've done an "out of band" updates with non-Redhat packages the procedure (and Cyrus) may not work.
0
 
LVL 12

Author Comment

by:asidu
ID: 11160644
jlevie,
I managed to solve the proc error. Created the required directory. That sorted the problem.
Now the impad is running at last. I created some users and manage to send mail
locally.
Now, how do I create or set quota for users and test if its working fine.
I looked  around for help on that issue with out success.
Some pointers or examples  would be a great help to me.

Thanks.
@ma
0
 
LVL 40

Expert Comment

by:jlevie
ID: 11161412
Setting mail quotas is done via cyradm. The commands of interest are:

setquota, sq
listquota, lq
listquotaroot, lqr, lqm
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now