0

Due to a machine crash, I need to move my mail server to another host. This includes user IMAP, but as the old server is not accessible I can't just drag and drop in an imap client application like Thunderbird. Rather, I have the old hard drive, and am trying to move the file structure to the new /home partition. I have not yet had success.

I have copied (cp -pr) the old file structure wholesale onto the new server/drive. However, the imap client isn't recognizing the old folder structure or the old messages anywhere but the inbox. The file structure has a '~mail' directory under ~home, and in that are the folders containing the email. What do I need to copy, and where, to ensure that the users can access their imap data on the new server? Running CentOS 8 with Sendmail and Dovecot.

[spamtrap_003@davinci ~mail]$ ls -la
total 90496
drwxr-xr-x.  4 spamtrap_003 spamtrap_003     4096 Dec  8 14:05  .
drwx------.  6 spamtrap_003 spamtrap_003      213 Dec  8 11:46  ..
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003      562 Apr  5  2013  Carolingia
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003      620 Jun  8  2014 'Deleted Messages'
-rw-r--r--.  1 spamtrap_003 spamtrap_003      580 Dec  8 14:05  dovecot.list.index.log
-rw-r--r--.  1 spamtrap_003 spamtrap_003       24 Dec  8 14:05  dovecot.mailbox.log
-rw-r--r--.  1 spamtrap_003 spamtrap_003        8 Dec  8 14:05  dovecot-uidvalidity
-r--r--r--.  1 spamtrap_003 spamtrap_003        0 Dec  8 14:05  dovecot-uidvalidity.61b101e2
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003  6672436 May 25  2021  Drafts
-rw-r--r--.  1 spamtrap_003 spamtrap_003  6902202 May 24  2021  Fitbit
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003   639800 Dec  8 12:45  ham
drwxrwxrwx. 20 spamtrap_003 spamtrap_003     4096 Dec  8 14:06  .imap
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003   149895 Nov 20  2014  PSL.iPad
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003    28823 Jan 21  2013  Rayburn
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003   195356 Sep 10  2014  RenStore
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003  6245982 May 25  2021  Sent
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003    45228 Oct 12  2015 'Sent Messages'
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003 71725052 Aug 17 08:51  spam
-rw-r--r--.  1 spamtrap_003 spamtrap_003      102 Apr  9  2021  .subscriptions
-rw-r--r--.  1 spamtrap_003 spamtrap_003       11 Dec  8 14:05  subscriptions
drwxr-xr-x.  6 spamtrap_003 spamtrap_003      121 Dec  8 14:06  .Trash
-rwxrwxrwx.  1 spamtrap_003 spamtrap_003      603 Apr 13  2021  Trash

The .imap subdirectory shows as follows:

[spamtrap_003@davinci .imap]$ ls -la
total 28
drwxrwxrwx. 20 spamtrap_003 spamtrap_003 4096 Dec  8 14:06  .
drwxr-xr-x.  4 spamtrap_003 spamtrap_003 4096 Dec  8 14:05  ..
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019 Carolingia
drwxrwxrwx.  2 spamtrap_003 spamtrap_003    6 Dec  8 14:05  cur
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019 'Deleted Messages'
-rw-rw-rw-.  1 spamtrap_003 spamtrap_003   40 Dec  8 14:05  dovecot.index.log
-rw-rw-rw-.  1 spamtrap_003 spamtrap_003 3748 Dec  8 14:06  dovecot.list.index.log
-rw-r--r--.  1 spamtrap_003 spamtrap_003   24 Apr  9  2021  dovecot.mailbox.log
-rw-rw-rw-.  1 spamtrap_003 spamtrap_003   51 Dec  8 14:05  dovecot-uidlist
-rw-r--r--.  1 spamtrap_003 spamtrap_003    8 Apr  9  2021  dovecot-uidvalidity
-r--r--r--.  1 spamtrap_003 spamtrap_003    0 Apr  9  2021  dovecot-uidvalidity.607089eb
drwxr-xr-x.  2 spamtrap_003 spamtrap_003   31 Dec  8 14:06  dovecot-uidvalidity.61b101e2
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 May  3  2021  Drafts
drwxr-xr-x.  2 spamtrap_003 spamtrap_003   58 Apr  9  2021  Fitbit
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Apr 11  2021  ham
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Aug 25 17:08  INBOX
drwxrwxrwx.  2 spamtrap_003 spamtrap_003    6 Dec  8 14:05  new
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019  PSL.iPad
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019  Rayburn
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019  RenStore
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Aug 26 08:11  Sent
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Mar 26  2019 'Sent Messages'
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Aug 17 08:40  spam
drwxr-xr-x.  2 spamtrap_003 spamtrap_003   31 Dec  8 14:06  subscriptions
drwxrwxrwx.  2 spamtrap_003 spamtrap_003    6 Dec  8 14:05  tmp
drwxrwxrwx.  2 spamtrap_003 spamtrap_003   79 Jul  5 22:30  Trash

Could it be the permissions on the Dovecot index files?

The old and new both use Dovecot. I don't have the version for the old one; when it was running it had CentOS 7, fairly well updated. The new one is 2.3.8. The configuration for storage and mail folder type should be the same: {mail_location = mbox:~/~mail:INBOX=/var/spool/mail/%u} The new and old users are not necessarily the same (UID and GID), though the names match. I have, for one box, changed the owner for all files in and under $HOME/~mail to be owned by that user, to no avail.

EDIT 13Dec21: I have determined that it is NOT a permissions/ownership problem. I was able to create a new folder via my imap client (Thunderbird), and it showed properly. I then examined the ownership and permissions of the created files and directories and duplicated them in an existing folder. This did not work; the folder still wouldn't show. Next is examining and possibly doing surgery to the actual dovecot index files that are created, since clearly it's not like I'm going to lose anything more.

But wait. there's more. After collapsing and reopening the account's folder tree in Thunderbird, the new folder is no longer visible. Needless to say, neither are any old ones. I cannot discern why one account shows properly and the rest don't.

5
  • 1
    What you need to copy, and to where, depends entirely on your configuration. Are the old and the new both using Dovecot? Same major versions? What about the configuration for storage and mail folder type? Old and new userid (UID and GID)? Can you add those to your question (format code blocks with the {} button) Commented Dec 8, 2021 at 17:47
  • What error(s) do you get from Dovecot when users try to access their messages? Authentication is a different issue to getting messages, for example Commented Dec 11, 2021 at 19:06
  • "Next is examining and possibly doing surgery to the actual dovecot index files that are created". Delete the index files. Move the IMAP files from cur/ to the corresponding new/ and allow the messages to be discovered and suitably indexed Commented Dec 13, 2021 at 15:12
  • Assuming I did this correctly. it still did not work.
    – Don Levey
    Commented Dec 15, 2021 at 0:08
  • Does dovecot really run as user spamtrap_003 with that as its same group? Usually it would run as something like mail/mail Commented Dec 15, 2021 at 23:04

0

You must log in to answer this question.

Browse other questions tagged .