Restore account from backups without deleting existing mail?

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
su_A_ve
Advanced member
Advanced member
Posts: 173
Joined: Fri Sep 12, 2014 10:22 pm

Restore account from backups without deleting existing mail?

Post by su_A_ve »

So we need to restore everything we got from backups for a particular account for a legal issue. My thoughts were to do restores from every backup we have (fulls and incremental), but to put everything under the same account. This would basically restore every email we have a copy of (we will not be able to restore whatever came in and got deleted and purged in between backups, but that's acceptable).
My issue is that doing a restore seems to delete the contents of the existing account. Is there a way to prevent this? Of am I going to need to restore to 60 different accounts (our backup retention range)? I would script this but would be best to restore to a single account, so I can then simply do an export of the single account. Otherwise, I'll have to restore 60 accounts and export the 60 accounts with 99.9% of the data duplicated 60 times!
Worse is that it's not just one account I need to do this for, but several ones...
TIA.
chauvetp
Outstanding Member
Outstanding Member
Posts: 350
Joined: Fri Sep 12, 2014 11:28 pm

Restore account from backups without deleting existing mail?

Post by chauvetp »

I'M NOT SURE HOW THIS CAN BE DONE WITHOUT RESTORING MULTIPLE ACCOUNTS. THE BEST I CAN GUESS WHICH WOULD BE SCRIPTABLLE (THOUGH MAYBE NOT ELEGANT) WOULD BE TO SOMETHING LIKE THIS:




RESTORE ONE ACCOUNT (WITH -PRE AND -CA)

EXPORT THE CONTENTS OF THAT ACCOUNT (ZMMAILBOX -Z -M RESTORED-ACCOUNT@YOUR-DOMAIN.COM GETRESTURL "//?FMT=TGZ" > /ARCHIVE/SOMEARCHIVEFILE.TGZ

DELETE THE RESTORED ACCOUNT

REPEAT THE FIRST TWO STEPS BUT BACKUP TO A DIFFERENT ARCHIVE FILE.

THEN, WHEN DONE RESTORE WITH ZMMAILBOX -Z -M [EMAIL]SINGLEACCOUNT@YOUR-DOMAIN.COM POSTRESTURL "//?FMT=TGZ?RESOLVE=RESET" /ARCHIVESOMEARCHIVEFILE.TGZ

REPEAT STEP 5 FOR EACH ARCHIVE FILE


MIGHT BE A BIT UGLY, BUT MIGHT BE THE ONLY WAY OF DOING THIS TO A SINGLE ACCOUNT THAT I CAN THINK OF.
su_A_ve
Advanced member
Advanced member
Posts: 173
Joined: Fri Sep 12, 2014 10:22 pm

Restore account from backups without deleting existing mail?

Post by su_A_ve »

[quote]I'M NOT SURE HOW THIS CAN BE DONE WITHOUT RESTORING MULTIPLE ACCOUNTS. THE BEST I CAN GUESS WHICH WOULD BE SCRIPTABLLE (THOUGH MAYBE NOT ELEGANT) WOULD BE TO SOMETHING LIKE THIS:




RESTORE ONE ACCOUNT (WITH -PRE AND -CA)

EXPORT THE CONTENTS OF THAT ACCOUNT (ZMMAILBOX -Z -M RESTORED-ACCOUNT@YOUR-DOMAIN.COM GETRESTURL "//?FMT=TGZ" > /ARCHIVE/SOMEARCHIVEFILE.TGZ

DELETE THE RESTORED ACCOUNT

REPEAT THE FIRST TWO STEPS BUT BACKUP TO A DIFFERENT ARCHIVE FILE.

THEN, WHEN DONE RESTORE WITH ZMMAILBOX -Z -M [EMAIL]SINGLEACCOUNT@YOUR-DOMAIN.COM POSTRESTURL "//?FMT=TGZ?RESOLVE=RESET" /ARCHIVESOMEARCHIVEFILE.TGZ

REPEAT STEP 5 FOR EACH ARCHIVE FILE


MIGHT BE A BIT UGLY, BUT MIGHT BE THE ONLY WAY OF DOING THIS TO A SINGLE ACCOUNT THAT I CAN THINK OF.[/QUOTE]
OH - SO A RESTORE FROM A TAR FILE WILL MERGE THE CONTENTS WITH THE EXISTING ? IF SO, THEN, THIS MIGHT DO IT? NOT SURE ON THE -PRE AND -CA (WILL LOOK IT UP)
1 - RESTORE ACCOUNT FROM OLDEST BACKUP TO A TEMP ACCOUNT

2 - EXPORT CONTENTS TO AN ARCHIVE FILE

3 - IMPORT CONTENTS FROM ARCHIVE FILE TO REAL ACCOUNT (OR ANOTHER ACCOUNT)

4 - REPEAT 1-3 FOR ALL OTHER BACKUPS
THANKS...
chauvetp
Outstanding Member
Outstanding Member
Posts: 350
Joined: Fri Sep 12, 2014 11:28 pm

Restore account from backups without deleting existing mail?

Post by chauvetp »

-ca means to create a new account (so you don't impact the existing account you're restoring a copy of). -pre is the prefix to give that account (its actually more of a postfix, since if you use -pre restored then the account will be created accountname-restored@domain.com.
I haven't done this before with the postRestURL (I use the getRestURL to export accounts all the time though) so cannot guarantee it. It should be easy enough to test though.
su_A_ve
Advanced member
Advanced member
Posts: 173
Joined: Fri Sep 12, 2014 10:22 pm

Restore account from backups without deleting existing mail?

Post by su_A_ve »

Flags make sense...
We are working with support on this. They've suggested we restore to the earliest full backup we have and pass on the -br and --skipdelete - It LOOKS like it does what we need, but we are verifying this is the case. Hoping someone else would chime in too...
Post Reply