Migrate Mails from Nethserver to Nethserver

,

NethServer Version: v6.8 / v7 final
Module: Mail

Hi,
I have two Nethservers. One in the old and current stable version 6.8 and one on the new 7 final version.
I like to migrate all mails, only two inboxes, from one Nethserver to the other.
The following ways came to my mind:

  1. Use the backup data function of Nethserver. But I am unsure what exactly is backuped and I don’t know if it will work like I expect - only backup the mails (I don’t use the fileserver).
  2. Connect old and new inbox via any Mailclient and move the content from one Mailserver to the other.

I am curious if there is also a “copy-paste”-Way by just moving the Files from one Nethserver to the other, in case you have more than just two inboxes.
Is there a recommended way to do the migration in general?

Moin Kristian,

i think that Mailstore Home can be a Solution.

Regards

Uwe

Imapsync also but you have to know all password of your users

A rsync also on the folder /var/lib/nethserver/vmail should do the trick. Normally rsync used with the root user to the remote server should preserve all permissions.

Of course you must create your user throught ldap or samba4 Ad before to use imapsync or rsync

The other way i have in mind is to do a backup and a restoration

1 Like

As said by @stephdl, the method I prefer is rsync. It allows you to make a copy at different times. sopprattutto convenient solution if you have large amounts of data and minimizes downtime

There is a script that should simplify operations (I have not tried it as I have always used rsync manually)
Try reading
http://docs.nethserver.org/en/latest/migration.html#email

No,if you use dovecot’s master user

2 Likes

Do You have some pointers please ?

Take a look at sogo and dovecot “on the other side” :wink:
Btw, “dovecot master user” will vive you many hints

I don’t use Sogo and/or dovecot

As others already pointed out:

  • if you need a 1-1 copy of everything, I think rsync is the best tool to transfer a mailbox between two NethServer/Dovecot installations
  • if the IMAP servers are not Dovecot, imapsync should be a good alternative
  • if you want to cherry-pick some messages, an IMAP client configured with two accounts should do the job

The dovecot master user has a special pass key/passepartout that allows log in as another user; see also

http://docs.nethserver.org/en/v7rc/mail.html#index-9

2 Likes

I am currently trying this one.
Just have to get the SSH connection to work. I assume the source server is blocking the connection, but I am investigating…

Edit:
Found the reason. See

if you’re using NS, you’re using dovecot AFAIK

Hi,

I moved my mails by copying the directories (NOT all the files) in /var/lib/nethserver/vmail//Maildir from the old to the new server. Only the file “subscriptions” need to be copied manually. It contains the folders you created in your inbox. All other files (all are starting with “dovecot-” were not copied by me). The Account was already created on the new server before, so I have the same folderstructure already in on the new server.

the script that is mentioned by @enzoturri at http://docs.nethserver.org/en/latest/migration.html#email does not work. It ends with the message

rsync: change_dir "/home/e-smith/files/users/vmail/Maildir" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1518) [Receiver=3.0.9]
[INFO] Tue Feb  7 12:02:55 CET 2017 -- Synchronizing vmail@mydomain.de Maildir/
[INFO] Skip vmail@mydomain.de

Maybe something that must be fixed, because the mails are stored on a different location than the script seems to expect.

1 Like

That’s why I adviced you to use imapsync… :wink:

I’m going to fix this: it’s required by the migration procedure from ns6 to ns7.

Yes, didn’t checked that but it sounds like I have to know the credentials of each inbox, which I maybe don’t have.
Its not only about moving Mails from A to B in THIS case with my two mailboxes. It is also a tech-check if you have to do it for maybe hundreds of boxes.

please, re read all the 3ad… both me and Davive told you about dovecot master user… IOW, you can have an user (on each server) that can auth himself on behalf of any user…
so the migration script is just a loop among user list… quite trivial… and without knowing anything about the user except the username

@Hunv, remember to enable the dovecot master user checking Admin can log in as another user in the Mailboxes tab in Email.

@Stefano_Zamboni @filippo_carletti
The box is checked.
I tried to login as username*admin with admin-password like it is mentioned in the help dialog (Replace “username” with random username and “admin” with an administrative user). That didn’t worked. Checked it with Outlook and Thunderbird.

if so, it’s a bug and must be investigated

The easiest way is to use imapsync in my experience. This means that all users can be processed at once, there are good logs and only certain folders can be synchronized.

https://imapsync.lamiral.info/

3 Likes