Nethserver 8 Email Storage Location

I have a crashed NethServer 7 installation that seems to be unrepairable (domain won’t reauthorize, and when it does the user database is blank… I’m not really interested in keeping the NS 7 install, I have the data I need from it), either way I’m in the process of setting up a fresh install of NethServer 8 and I’m trying to figure out where the email messages are stored so that I can manually just import all the message files over to the new system.

It’s not really going to be feasible to setup a new NethServer 7 install (domain and all), then move the emails over…and then upgrade to NS8. So my hope is that this is a simple fix.

Anyone have any ideas?

Hi Brad,

If you want to avoid NS7 reinstall + NS8 migration, you’ve to explore a new path!

To import existing mails I can just give you some commands, but finding the missing pieces is up to you.

I assume the Mail module is new, already configured, but no message received yet.

Get the absolute volume path with this command.

 VMAIL_PATH=$(runagent -m mail1 podman volume inspect dovecot-data --format '{{.Mountpoint}}')
 echo $VMAIL_PATH

Copy/Move /var/lib/nethserver/vmail contents of NS7 to that path.

:warning: As said many times, fixing the ownership to the correct value is a real challenge in the containers world and for this reason absolute path operations must be avoided.

The VMAIL_PATH directory ownership should be already correct (if you didn’t overwrite it in the copy/move step). Let’s use it as reference to fix the ownership of that dir contents (in this case they are homogeneous and the trick works):

chown -R --reference "${VMAIL_PATH}" "${VMAIL_PATH}"/*

Now you have imported the Maildirs, but some format conversion are needed by NS8.

Get a shell of mail1:

runagent -m mail1

Stop Dovecot

systemctl --user stop dovecot

Run the Maildir conversion

../actions/import-module/35migrate_maildirs

Start Dovecot

systemctl --user start dovecot

Start quota recalculation

../actions/import-module/60quota_recalc

Good luck!

4 Likes

Thank you, I was able to get most, if not all the emails put into the new install. But now I’m have this strange issue with email using the wrong domain name?

I posted a new topic regarding it.