[Dovecot] migrate 15K users to new domain name

Odhiambo Washington odhiambo at gmail.com
Thu Apr 19 17:03:01 EEST 2012


On Thu, Apr 19, 2012 at 16:28, Jan-Frode Myklebust <janfrode at tanso.net>wrote:

> On Thu, Apr 19, 2012 at 02:01:44PM +0300, Odhiambo Washington wrote:
> >
> > What do you mean by a "new domain" in this context?
>
> The user's email addresses are changing from username at old.domain to
> username at new-domain.
>

That can be handled by address rewrites within the MTA.


>
> > Is the server changing?
>
> No.
>
> > Is the storage changing?
>
> The user's home directory is based on the user's email address, so this is
> changing.
>

In my setup, I have virtual users. So the home directory is in the
/var/spool/virtual/$domain/$user/mdbox

How is yours setup? If the domain name changed, from domain1 to domain2, I
believe it would be easy to change as follows:

cd /var/spool/virtual/
mv $domain1 $domain2

Well, it the size of $domain1 is in TBs, I'd probably do it another way as
doing mv is a bit dangerous with very large datasets:

cd /var/spool/virtual
mkdir domain2
cd domain1
for d in `ls -1`; do mv $d domain2/$d; done [ or something closer]


> > In my thinking, a domain change is as simple as using a rewrite rule in
> > your MTA.
>
> Also the user's login-names needs to change from old to new domain, and
> all their data needs to move from old to new domain.
>

>

And the login names are stored in a flatfile or db?? Either way, you can do
a rename.
Dump the database and just use vi to rename old-domain to new-domain, then
drop the db and import the dump.

mysqldump dbname dbname.sql

vi dbname.sql
:g/old-domain/s//new-domain/g
mysqladmin drop dbname
mysqladmin create dbname
mysql dbname < dbname.sql

You can also edit the flatfile to s/old-domain/new-domain/g
cat flatfile | xargs sed -i.BAK 's/old-domain/new-domain/g'


Maybe I still don't understand you:-)


-- 
Best regards,
Odhiambo WASHINGTON,
Nairobi,KE
+254733744121/+254722743223
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
I can't hear you -- I'm using the scrambler.
Please consider the environment before printing this email.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 652 bytes
Desc: not available
URL: <http://dovecot.org/pipermail/dovecot/attachments/20120419/950643f6/attachment-0004.png>


More information about the dovecot mailing list