lists-qmail at maexotic
Mar 5, 2008, 9:02 PM
On Thu, Mar 06, 2008 at 05:18:35PM +1300, Michael Hutchinson wrote:
> A: setup the old qmail on another box and change some settings on it so
> it forwards all mail to the new qmail server (basically smarthosting) -
> although I am worried in this circumstance that putting the queue on
> another disk will probably break it.
Did this more than once :)
1) reduce the TTL in DNS to a few seconds for the name of the mailserver
if you are using different IP addresses. This will make transition
faster and also switching back in case of a problem.
2) rsync the user mail store (maildirs) over to the new machine. Depending
on the size of the mail store this can take quite some time. This can be
and should be done while the old server is still running. Shortly
before you do the final transition rsync again to keep downtime
3) shutdown qmail on the old system
4) rsync again (that should be rather fast now)
5) change DNS to point to the new system
6) monitor the new system whether it works smoothly
7) on the new system configure the IP address of the old system to have
RELAYCLIENT set (tcprules), so you can use the new system as a
smarthost from the old system
8) on the old machine rename control/virtualdomains and user/assign.cdb
away (e.g. by adding .away)
9) on the old machine make control/smtproutes look like
this tells qmail-remote to send all remote mail via the new machine
using it as a smarthost. the  are needed if you specifyu an IP
address which I would recommend to circumvent DNS problems.
10) restart qmail on the old machine and do a "svc -a /service/qmail-send"
(or "kill -ALRM" the pid of qmail-send)
this should send all the mails in the queue to the new mailserver,
which will put them in its queue.
11) check with qmail-qstat. As soon as it shows
messages in queue: 0
messages in queue but not yet preprocessed: 0
all mails are transferred to the new system.
12) shut down the old system
Done. (Hope I didn't miss something)
The only drawback of this method is that mails in the queue loose their
queue-time. This means if you have a queuelifetime of 8 days and the
mail spent 7 days on the old server it will spend another 8 days on the
new server (if it is undeliverable e.g.)
If you want to be "user friendly" and disburden your support/help desk
you can only shut down the qmail-smtpd and qmail-send portions and replace
the qmail-pop3d (if you are running one) with a dummy that always
authenticates with "correct" and always deliveres the same message saying
that the mailserver has moved and is using a new machine and people should
reconfigure their mail client settings to use the name "hostname" instead
of the ip address. (Can't find the pop3d I used right now, but maybe there is
even some info on it on qmail.org).