
jms1 at jms1
Mar 6, 2008, 11:47 AM
Post #3 of 3
(805 views)
Permalink
|
On 2008-03-05, at 2318, Michael Hutchinson wrote: > > I have to create a new mail server which will take over the job of the > current mail server. It was intended to have some new hardware for > this, > but it now looks like it is not going to happen. Basically, I am going > to have to build on the existing hardware. > > The bit I am most worried about (aside from the obvious downtime) is > moving the qmail queue from the old setup to the new one. Does anyone > have a document relating to the procedure for this? I am aware I can't > just copy the queue files from one setup to another and expect it to > work. usually when i've done upgrades, i try to make sure the queue is empty (i.e. "qmail-qstat" shows two zeros.) this way i don't have to worry about preserving the queue. however, if you have to upgrade in-place, and you absolutely cannot empty the queue first, you will need to make sure that the new qmail is compiled with the same "conf-split" value as the old one, and that the numeric UID and GID values for the qmail users and groups do not change. you also have to be very careful to never "copy" the queue, only "mv" it... and never "mv" it from one filesystem to another. my normal procedure looks like this: - shut down everything on the machine which relates to qmail. if possible, drop to single-user mode and unplug the network cables entirely. - rename "/var/qmail" to "/var/oldqmail" or something like that- basically move it out of the way , but don't delete it, and don't move it from one filesystem to another (hopefully you don't have "/var/ qmail" as a separate filesystem- it's okay if "/var" is a filesystem though.) - make a new, empty /var/qmail directory, and compile the new qmail using whatever patches and options you need. again, make sure "conf- split" doesn't change, and don't delete or re-create the qmail users. - copy or "mv" the control/*, alias/*, and users/* files from the old qmail to the new one. - remove "/var/qmail/queue" (the empty queue in the new version.) - rename "/var/oldqmail/queue" to "/var/qmail/queue". this will "move" the entire queue, en masse, from the old instance of qmail to the new one. - start up qmail-send and cross your fingers. i have done this before, probably seven or eight times over the past ten years, and haven't lost a queue yet. the reason for all this is that the "message number" is actually the inode number of the "mess" file. when a new message is added to the queue, the message data is written to a dummy file, then the file is renamed to the inode number of that dummy file. using the inode number is a way to guarantee that the filename will be unique within the queue (presuming the queue is all stored within a single filesystem, which it must be, according to the directions.) if the queue is copied, the "mess" files' inode numbers won't match the filenames, and there's a risk of a new message happening to get the same inode number as the filename of an existing message- which would be a BAD THING. there are a few "queue fixer" scripts out there (including my own "qfixq" script) which can take a "copied" queue and rename the files so that the filenames match the inode numbers properly. (you can change the name of a file, but you can't explicitly change the inode number of a file.) these scripts do work, so copying a queue improperly isn't the end of the world... but doing this will cause the "message numbers" to change, which means you won't be able to follow a message through the log files to trace where it went (when a difficult client, boss, or other user demands that you do so.) -------------------------------------------------------- | John M. Simpson -- KG4ZOW -- Programmer At Large | | http://www.jms1.net/ <jms1[at]jms1.net> | -------------------------------------------------------- | Hope for America -- http://www.ronpaul2008.com/ | --------------------------------------------------------
|