[Dovecot] Migration from v1 to v2 with hashed directory structure
Hi,
I want to upgrade to version 2 but I would like to solve a long standing problem with 'flat' directory structure ie we have /var/spool/vmail/mydomain.com/user@mydomain.com and I want a new server with version 2 to have hashed directory structure like /var/spool/vmail/mydomain.com/u/s/user I was wondering it f there is some better solution then dir hashing or a way to hash a dir other then first two letters. Also any suggestion how to perform this migration from old to new server with hashing on the fly?
Thanks in advance.
On 28/02/2013 13:59, Pavel Dimow wrote:
Hi,
I want to upgrade to version 2 but I would like to solve a long standing problem with 'flat' directory structure ie we have /var/spool/vmail/mydomain.com/user@mydomain.com and I want a new server with version 2 to have hashed directory structure like /var/spool/vmail/mydomain.com/u/s/user I was wondering it f there is some better solution then dir hashing or a way to hash a dir other then first two letters. Also any suggestion how to perform this migration from old to new server with hashing on the fly?
My thought would be that unless you have millions of users, such a rename process will take only seconds to minutes? Why not just take the server down for a couple of minutes to do the rename process?
If you wanted to be really clever, you could do it live using symlinks to move the dirs, then update the dovecot config?
Ed W
Thank you Ed, I was referring also to other people experiences regarding migration. Do's and Don'ts, and specially directory hashing strategies others are utilizing.
On Fri, Mar 1, 2013 at 12:38 AM, Ed W lists@wildgooses.com wrote:
On 28/02/2013 13:59, Pavel Dimow wrote:
Hi,
I want to upgrade to version 2 but I would like to solve a long standing problem with 'flat' directory structure ie we have /var/spool/vmail/mydomain.com/user@mydomain.com and I want a new server with version 2 to have hashed directory structure like /var/spool/vmail/mydomain.com/u/s/user I was wondering it f there is some better solution then dir hashing or a way to hash a dir other then first two letters. Also any suggestion how to perform this migration from old to new server with hashing on the fly?
My thought would be that unless you have millions of users, such a rename process will take only seconds to minutes? Why not just take the server down for a couple of minutes to do the rename process?
If you wanted to be really clever, you could do it live using symlinks to move the dirs, then update the dovecot config?
Ed W
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, 28 Feb 2013, Ed W wrote:
On 28/02/2013 13:59, Pavel Dimow wrote:
Hi,
I want to upgrade to version 2 but I would like to solve a long standing problem with 'flat' directory structure ie we have /var/spool/vmail/mydomain.com/user@mydomain.com and I want a new server with version 2 to have hashed directory structure like /var/spool/vmail/mydomain.com/u/s/user I was wondering it f there is some better solution then dir hashing or a way to hash a dir other then first two letters. Also any suggestion how to perform this migration from old to new server with hashing on the fly?
My thought would be that unless you have millions of users, such a rename process will take only seconds to minutes? Why not just take the server down for a couple of minutes to do the rename process?
If you wanted to be really clever, you could do it live using symlinks to move the dirs, then update the dovecot config?
Yeah:
for dir in /var/spool/vmail/mydomain.com/*; do to="$(script_to_map_name "$dir")" if ! test -d "$(dirname "$to")"; then # add -m 0555 if needed mkdir -p "$(dirname "$to")" fi # If a new mails arrives or the user access the box # there will be an error for a (very) short time mv "$dir" "$to" ln -s "$to" "$dir" # no more errors done
Then update the config, reload Dovecot, wait a bit, remove the symlinks.
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUBUTB32F3r2wJMiz2NAQK2vgf/V5OCGWdToQJOxCtUlZp+aMslznBpr2Rq XrjANVYblMUzipd8HFR7YzbHkgJizm/t5k5+OHg9xX1D9YrsxB9/9k1pMRomAuCv nIBWmb4JTIvq2MJihstXZj8q/z3i5OXbb7Mp5o/YgkZqx9OBfD4IJvSRT6d7vuld 7xCSc56zF7MlpFfXXN9nBYBFNGXvOEmvgrZNd2BtL6iSWxC7tVZbfkdLfuUS0RKv FKIcuESPZNkKmr86NxEegpOz8fs7ZdSrvs5ibqNdDN4+oOnKC55EwOPgY1OOhWmB ZdzmDAdy8ztXauWmuznkAP+FzhZV5jIBXlNJLnkj2xGsT5x20/FTvg== =nW5U -----END PGP SIGNATURE-----
Tnx will try ;)
On Fri, Mar 1, 2013 at 10:41 AM, Steffen Kaiser skdovecot@smail.inf.fh-brs.de wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thu, 28 Feb 2013, Ed W wrote:
On 28/02/2013 13:59, Pavel Dimow wrote:
Hi,
I want to upgrade to version 2 but I would like to solve a long standing problem with 'flat' directory structure ie we have /var/spool/vmail/mydomain.com/user@mydomain.com and I want a new server with version 2 to have hashed directory structure like /var/spool/vmail/mydomain.com/u/s/user I was wondering it f there is some better solution then dir hashing or a way to hash a dir other then first two letters. Also any suggestion how to perform this migration from old to new server with hashing on the fly?
My thought would be that unless you have millions of users, such a rename process will take only seconds to minutes? Why not just take the server down for a couple of minutes to do the rename process?
If you wanted to be really clever, you could do it live using symlinks to move the dirs, then update the dovecot config?
Yeah:
for dir in /var/spool/vmail/mydomain.com/*; do to="$(script_to_map_name "$dir")" if ! test -d "$(dirname "$to")"; then # add -m 0555 if needed mkdir -p "$(dirname "$to")" fi # If a new mails arrives or the user access the box # there will be an error for a (very) short time mv "$dir" "$to" ln -s "$to" "$dir" # no more errors done
Then update the config, reload Dovecot, wait a bit, remove the symlinks.
- -- Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUBUTB32F3r2wJMiz2NAQK2vgf/V5OCGWdToQJOxCtUlZp+aMslznBpr2Rq XrjANVYblMUzipd8HFR7YzbHkgJizm/t5k5+OHg9xX1D9YrsxB9/9k1pMRomAuCv nIBWmb4JTIvq2MJihstXZj8q/z3i5OXbb7Mp5o/YgkZqx9OBfD4IJvSRT6d7vuld 7xCSc56zF7MlpFfXXN9nBYBFNGXvOEmvgrZNd2BtL6iSWxC7tVZbfkdLfuUS0RKv FKIcuESPZNkKmr86NxEegpOz8fs7ZdSrvs5ibqNdDN4+oOnKC55EwOPgY1OOhWmB ZdzmDAdy8ztXauWmuznkAP+FzhZV5jIBXlNJLnkj2xGsT5x20/FTvg== =nW5U -----END PGP SIGNATURE-----
On Thu, Feb 28, 2013 at 02:59:52PM +0100, Pavel Dimow wrote:
we have /var/spool/vmail/mydomain.com/user@mydomain.com and I want a new server with version 2 to have hashed directory structure like /var/spool/vmail/mydomain.com/u/s/user I was wondering it f there is some better solution then dir hashing or a way to hash a dir other then first two letters.
We use:
mail_home = /srv/mailstore/%256LRHu/%Ld/%Ln
giving us 256 buckets based on Lowercase, Reversed Hash of username. Ref: http://wiki2.dovecot.org/Variables.
Also any suggestion how to perform this migration from old to new server with hashing on the fly?
Symlinks from old to new..
-jf
participants (4)
-
Ed W
-
Jan-Frode Myklebust
-
Pavel Dimow
-
Steffen Kaiser