linux mirroring

Currently we are running Sendmail/Redhat 6.0 as our primary email server. Is it possible to have our primary email server backup/mirror to a secondary email server on a daily or hourly bases so that in the event of a failure of our primary email server  the secondary can be brought online by a change of its ip.
detail/steps would be much appreciated
If I have two linux boxes and need to copy email users from one to the other, what files need to be copied.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You could use rdist to replicate the mail spool to another machine, but if the mail server is very busy the spool area will get pretty out of date in the intervals between "syncs". If you are really worried about loosing email service and can spend the bucks, having all of the mail stuff on a separate disk (SCSI is best), or better yet a small standalone RAID system that can be moved from the failed server to it's backup might make more sense. You'd want to be careful in configuring the system so that everything other than program binaries needed for email services are located on the "movable drive". What would need to be there in addition to the user mailboxes depends on what email services you provide (POP, IMAP, etc) and which implementation is being used.
There are plenty of >$10,000 solutions from vinca and others.  If you're talking about rolling your own standby server system, this is not at all simple, it depends very much on many details of your individual system, and you would not be able to maintain it if you just followed a cookbook without understanding what is going on.  The simplest way would be to check out who offers a prebuilt clustering package - buy it,  install it, spend time learning how it works.  RedHat may offer one, too.  

That said, if you really want to do this yourself (and I don't recommend it!), surf on over to, where the developers of high-availability linux have put up their work.  

I think the simplest and cheapest way to do this yourself is to have two servers that update each others spool files with rsync, preferably linked to each other with a separate set of network cards connected with a crossover Ethernet cable on a separate mini-network.  You will need to take particular care that both servers agree on the time, and that their CMOS clocks also agree on the time, since rsync depends on that.  There's a utility called netdate (search on that can handle that.  

You have one primary server that sends and receives mail: when it goes down, the other takes over its IP address and starts handling the load.  Resynchronizing once you have the primary server back up is a bit of a problem and you probably don't want to do that automatically.  

One big question is, how does the backup server decide that the primary is down?  You could use a ping script - but I've seen servers that were responding to ping but were otherwise hung and not completing processes.  You probably can't design an absolutely foolproof system yourself.  An interesting step-by-step overall guide is at
n_athenAuthor Commented:
Edited text of question.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

I think this might be what you're are
really after.  It doesn't solve the problem of, if mail is on the server
and the server goes then it's not mirrored to the other server, however
mail will still be processed.
There is another technical issue with
a complete mirror.. mail might be sent twice if it's stuck in the output queue.
on the down server when it is finally

I personally believe this way I'll explain here is the easiest... it's also the most widely used.

Basically its all handled by the DNS
server configuation.  I'm going to assume you have configured DNS before..
if not, ask a friend or go to and look up the docs on configuring it.

Set up 2 or more mail servers as normal.
Give them seperate IP addresses.

In your zone configuration file DNS add an MX record for each mail exchanger (server).

e.g. with this type of format...

a.b.c.d IN MX 20
a.b.c.e IN MX 30

(I think thats the right format it's all
from my memory).

basically where you see the numbers 20
and 30 they are the order of preference
given to the server.  So all mail should
generally be sent to the primary exchanger first... if that is unsuccessful then it will try smtp2
You could make both the 20 and 30 the same number so that no preference is given to either server.. in effect this is like very cheap load balancing... it's not really but the results are similar.


a.b.c.d IN MX 20
a.b.c.e IN MX 20

you can even add a 3rd if you wish...

a.b.c.f IN MX 20

If you plan to use these servers for
outgoing mail as well. you might want
to configure them to ensure the mail
appears from the same host etc...

For sendmail have a look here.

Unlike swapping in a new mail server you
will find that this system is automatic.
Now if you combine this with a monitoring program like "son of pong" or netmonitor? then you can be notified if one of you mail servers karks it.

Thats about it.

What does your email system look like?

Pure sendmail with user mailboxes in mbox format in /var/spool/mail? Are you running a POP or IMAP server? Does the system provide LDAP directory services? Are you using only local password files or do you use NIS with the master being some other system? Are there any virtual email accounts? What about aliases or mailing lists? Do you allow .forwards and, if so, where are the user home dirs? As you can see there are a number of considerations. They are all solvable for the existing system, but you might want to consider something of a re-design to make the whole process simpler.

Now if you'd like a write up of what my production email system looks like (and it has essentially the characterics you are looking for), how it was designed and why, I can pull all the notes, etc together into one document this weekend.
Woops I did get the MX records wrong.
Sorry my brain was not quite fully
functioning this morning.

here's what it should look like

MX Records:
client.domain. IN MX 10 mailserver.client.domain.
client.domain. IN MX 20 mailserver.client.domain.



Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
first i want to tell you i'm a network dummy so be patient if what a say is a stupidity , but i'm a not so dummy unix user . for mirroring your email take a look at fetchmail
i use it for one user (me) and he do the job perfectly , i don't know if he can work on your case .
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.