On 2006-12-29, at 0546, Peter Lauri wrote:
I am migrating from one server to another. I have Qmail as running
mail
server. How can I the easiest way move emails from one server to
another.
This is my idea, but need confirmation:
1. I recreate the email boxes on my new server
2. Copy emails from mailnames/domain.com/name/Maildir/cur on the
old server
to the new server
3. Voila, it is complete???
close.
(1) make sure the queue is empty, or at least doesn't contain any un-
delivered local messages.
(2) shut down everything relating to qmail on both servers, so that
neither qmail nor the users are doing anything with the messages.
(3) copy not only the Maildir/cur, but also Maildir/new, files.
(4) fix any ownership and/or permissions issues on the files you just
copied. if the numeric uid/gid for all users (the qmail users, the
vpopmail/vchkpw user if you're using vpopamil, the system users which
own mailboxes if you have system users, etc.) are the same between
the old and new servers, this won't be much of an issue.
(5) start it all back up.
i wrote up an entry on a friend's wiki about this several months ago-
it actually talks about what needs to be backed up on a qmail server,
but the list of what needs to be copied is the same as what you would
have to back up and then restore, so it may be helpful here as well.
http://www.qmailinfo.org/index.php/BackingUpQmail
Right now I am doing a pretty slow thing:
1. Recreate email boxes on new server
2. Using Outlook Express and copying from old IMAP to new IMAP
However, this is DARN slow as this process downloads the emails
from the
server to my local computer and then copy them.
it's slower, but in theory it's safer because the whole issue of file
ownership and permissions does not exist, and it doesn't require you
to shut down any services at all.
my only problem with this method is that you're using outlook express
to do it. (just mentioning it, not going into the whole religious
debate here.)
I'd prefer to just setup an
FTP connection between the two servers and upload the files
(especially when
one of my clients has 3.5 GB of email in his inbox).
again, if all of the system uid/gid values are the same, you CAN do
it this way. for vpopmail, you need to first "vadddomain" each DOMAIN
(but not each individual mailbox) first, so that the files in the /
var/qmail/alias, control, and users directories are correct, then
copy the entire ~vpopmail/domains directory en masse.
the only other consideration is if you have enough domains to have a
"~vpopmail/domains/0" directory with domains in it on either server,
you may have to manually fix the /var/qmail/users/assign entries for
any domains which were or are in one of these sub-directories. if you
do have to edit the file, don't forget to run "qmail-newu" afterward.)
if the uid/gid values are NOT the same, you'll also need to reset the
ownership and permissions of the files once you have them copied to
the new server. if you're using vpopmail, there's a script on my site
called "vfixpermissions" which will automatically fix the ownership
and permissions of the ~vpopmail directory and all of its contents.
http://qmail.jms1.net/scripts/
the only "non standard" thing the script does is make your "vchkpw"
binary setuid/setgid to the vpopmail user, which makes it possible
for qmail-smtpd to use it as a checkpassword program to verify AUTH
commands without having to change the userid as which qmail-smtpd
runs. it's easy enough to comment out that one line if you don't need
this on your own system.
and if the mailboxes are all system users, you can use a little
script like this to fix the ownerships and permissions (this is NOT
tested, comments and corrections welcome)...
#!/bin/sh
for n in `cut -d: -f1 /etc/passwd`
do
if [ -d "~$n/Maildir" ]
then
u=`id -u $n`
g=`id -g $n`
chown -R $u:$g "~$n/Maildir"
chmod -R go= "~$n/Maildir"
fi
done
----------------------------------------------------------------
| John M. Simpson --- KG4ZOW --- Programmer At Large |
| http://www.jms1.net/ <jms1@jms1.net> |
----------------------------------------------------------------
| http://video.google.com/videoplay?docid=-4312730277175242198 |
----------------------------------------------------------------
PGP.sig
Description: This is a digitally signed message part
|