1 (edited by alpono 2016-07-08 21:16:25)

Topic: Backup & Restore user mailbox

======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.5-1
- Linux/BSD distribution name and version: CentOS 6.8
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====

Hello,
I've read this, but still have no clue...
What do I need?
Suppose, user have deleted some messages from his mail box, emptied his trashcan.Some time later he wants to recall deleted messages. Suppose I have dumps of all MySQL tables, a copy of /var/vmail/vmail1/* .
Can you give me step-by-step instructions to solve this?
I've tried just to recall message files in users directory /var/vmail/vmail1/... , that doesn't work, restoring whole user directory doesn't work either. After that user sees only emty lines in his roundсube. I guess I need to modfy some MySQL tables, but which?

----

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

2

Re: Backup & Restore user mailbox

Hi!  I don't want get in the middle here, but I'd like to give my 2 cents related to mailbox backup.

   I've been searching everywhere for a decent solution to backup Postfix. I've found just one, which is a little bit expensive. It would be great to have a tool that could make granular backup, where you can restore a message or the entire user maibox. All we have now are very rudimentary methods, where you compress the entire folder and if you need a restore just decompress it and copy and paste.
   I'm not a programmer, nor have to time to learn it, but I'd like to understand why we don't have such a tool? Why is it so expensive?

Yes, I know, that this is not the answer for the OP, I just took this chance to bring up the subject.

Sorry if I'm posting incorrectly - and if this the case, feel free to delete it, please.

Cheers smile

3

Re: Backup & Restore user mailbox

alpono wrote:

What do I need?
Suppose, user have deleted some messages from his mail box, emptied his trashcan.Some time later he wants to recall deleted messages. Suppose I have dumps of all MySQL tables, a copy of /var/vmail/vmail1/* .

iRedMail doesn't have mailbox backup tool like this, you have to setup tool to do regular backup for this.

4 (edited by time4e 2016-07-10 02:21:47)

Re: Backup & Restore user mailbox

This is my solution for backing up mailboxes

I use two scripts:
1) creates a local tar of /var/vmail, deletes local tars older than 3 days, and runs as a cronjob
2) runs as a cronjob on a remote/offsite server and uses rsync to copy the tars created by script one.


script 1: (runs on iredmail server)
#!/bin/bash
#cd /root/backups
#archiving maildir


cd /var/vmail/backup/maildir-archives
echo "backing up maildirs"
tar -cvf "maildir-archiver_$(date +%m-%d-%Y).tar.gz" /var/vmail --exclude "/var/vmail/backup/maildir-archives"
echo "maildir archive complete"

#removing local archives  older than 3 days
echo "purging local archives older than 3 days"
find /var/vmail/backup/maildir-archives* -mtime +3 -exec rm {} \;
echo "purge complete"


script 2 (runs on remote server)
#!/bin/bash
rsync -avhP -e 'sshpass -p password ssh' backup@iredmailserver.com:/var/vmail/backup/maildir-archives/ /maildirbackup

you can also use ssh keys and avoid storing an account password in plain text.

This works ok, when a need to restore a single mailbox I just copy it's maildir from the tar file. Only set back is all restore messages are marked as unread, I think this is because the read attribute is stored in the DB. I have asked for help with this here http://www.iredmail.org/forum/topic1137 … store.html so hopefully someone will have a solution.