Home Page

Contact Me

MAC OS X

Linux

Linux Servers Fedora Core 4

Linux Servers - CentOS

Linux Servers Fedora Core 5

Linux Servers Fedora Core 7

Linux Servers Fedora 8

OpenWRT

NSLU2

LinuxCluster

Hardware Hacking Projects

Speaker Building Projects

Electronics Projects

Other Sites





Status/History

  • 20060412 DONE

Introduction

I needed to migrate my mail server to a new machine. I created a new server and now it was time to move the user data. The method I'm going to use will disrupt mail services. Here we go.

Preparing the Current Server

Before any data can be moved we have to stop the mail services. So type the following.
> /etc/init.d/postfix stop
> /etc/init.d/cyrus-imapd stop

The New Server

On the new server we need to make sure the same services are stopped. So type
> /etc/init.d/postfix stop
> /etc/init.d/cyrus-imapd stop

Moving the Data

Now for the fun part. Go ahead and log in to the new mail server. Choose a temp directory for the mail store to be copied to. Lets use our friend scp to get the data.
> scp -rp root@host.domain.com:/var/lib/imap ./imap.lib
> scp -rp root@host.domain.com:/var/spool/imap ./imap.spool
> chown -R cyrus:mail imap.lib
> chown -R cyrus:mail imap.spool
> mv /var/spool/imap /var/spool/imap.old
> mv /var/lib/imap /var/lib/imap.old
> mv imap.lib /var/lib/imap
> mv imap.spool /var/spool/imap

Testing and Cleanup

The first thing we want to do is start up the services on the new server.
> /etc/init.d/cyrus-imap start
> /etc/init.d/postfix start

Login and check your mail using a mail client. If everything looks good then we need to remove the old imap directories.
> rm -Rf /var/lib/imap.old
> rm -Rf /var/spool/imap.old

Conclusion

I would consider this to be a brute force method. Mail service does get disrupted. In my case it was not a big deal.

Comments

Add Comment 
Sign as Author 
Enter code 273

Ali G ?23 June 2008, 11:19

Nice job. Baltimore...southside...respect.

Dannyboy?22 February 2008, 15:16

Thanks for taking the time to put this on the web. Just what I was looking for.


Google
 
Theme by Richard Camp
(C) Copyright 1996-2007 by Richard Camp All rights reserved