1

Topic: Merging vmail directories

==== Provide required information to help troubleshoot and get quick answer ====
- iRedMail version:
- Linux/BSD distribution name and version:
- Any related log? Log is helpful for troubleshooting.
==== Hello to all,

I have iRedMail version 0.7.3 on a ubuntu server 11.04 32 bit virtual machine (VirtualBox) installed with mysql. Everything working fine until the virtual machine crashed, corrupting the virtual disk.

The server was restored and restarted using a backup from the day before, so some messages are missing in /var/vmail, but no new users were added during the period since the backup was taken. However, later I managed to recover the vmail directory and mysql data from the corrupted virtual disk. Is there a way to "merge" the /var/vmail directories (and possibly mysql) so that the missing messages can be re-inserted in the mail server ?

I searched several forums including this one and did not find a clear answer. I know I cannot just copy the files from one directory to another since the index files will be messed up.

Thanks in advance for any info on this.

==== Provide required information to help troubleshoot and get quick answer ====
- iRedMail version:
- Linux/BSD distribution name and version:
- Any related log? Log is helpful for troubleshooting.
====

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Merging vmail directories

You can simply copy restored /var/vmail to the running server, and set correct file owner (vmail:vmail) and permission (0700).

Personally, i suggest you try to restore missed emails for ONE mailbox first, so that you won't mess up the new server.

3

Re: Merging vmail directories

I' m sorry to report that copying the files over did not work. I tried for only one mailbox, after copying the files over and settings perms & owner, Thunderbird & RoundCube both report "Internal server errors". Tried a reboot of the server just in case, but no go.Had to delete the account & re-create it, but all messages are now gone, fortunately it was my own mailbox with few messages.

I am open to suggestions, will keep on googling, if I find a solution I will post it.

Thanks Again.

ZhangHuangbin wrote:

You can simply copy restored /var/vmail to the running server, and set correct file owner (vmail:vmail) and permission (0700).

Personally, i suggest you try to restore missed emails for ONE mailbox first, so that you won't mess up the new server.

4

Re: Merging vmail directories

Please clearly explain below items:

- What are your source and destination mailboxes? Please show us the full/absolute path on file system.
- How did you copy them. Show us the detailed shell commands and their output.

5

Re: Merging vmail directories

Got it to work, the trick is to copy only the message files to an existing folder on the target machine, nothing else (index etc). If a folder has to be created on the target server it must be created with the mail client or web based client. Got some info from the following url :

http://www.dovecot.org/list/dovecot/201 … 59493.html

Thanks again


ZhangHuangbin wrote:

Please clearly explain below items:

- What are your source and destination mailboxes? Please show us the full/absolute path on file system.
- How did you copy them. Show us the detailed shell commands and their output.

6

Re: Merging vmail directories

Thanks for your sharing.

windigo wrote:

If a folder has to be created on the target server it must be created with the mail client or web based client.

Not exactly.
You can create a new IMAP folder with command 'mkdir'. For example:

# mkdir .TestFolder

There's a dot in folder name, and you must set correct file owner (vmail:vmail) and permission (0700) for newly created IMAP folders (and mail messages too).