Restore HSM volumes

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Restore HSM volumes




Problem

How to restore lost HSM volume


Solution:

1) Restore an account backup to a new account
2) Recreate the filesystem HSM path for the existing account
3) Move the restored HSM blobs to the correct filesystem path
4) Delete the restored account

Preliminary: you need to have the replacement HSM volume mounted at the same path as the old one. For example:

zmvolume -l 
Volume id: 1 
name: message1 
type: primaryMessage 
path: /opt/zimbra/store 
compressed: false 
current: true 

Volume id: 2 
name: index1 
type: index 
path: /opt/zimbra/index 
compressed: false 
current: true 

Volume id: 3 
name: hsm1 
type: secondaryMessage 
path: /opt/zimbra/hsm 
compressed: false 
current: true 

In the above example, /opt/zimbra/hsm was the HSM store. Mount the replacement at /opt/zimbra/hsm, and make sure to

chown zimbra:zimbra /opt/zimbra/hsm 

1) Restore from a full account backup to a new account:

zmrestore -rf -a account@example.com -ca -pre "hsm_" 

Depending on the HSM policy (30 days default), you need to be sure the latest full backup is newer than that (?).

2) Gather account data:

  • Mailbox ID:
zmprov gmi account@example.com | grep mailboxId 
Mailbox ID: 4 
  • Account Hash (substitute actual Mailbox ID):
perl -e "print (mailboxId>>12)" 
Account Hash: 0  
  • Restored Mailbox ID:
zmprov gmi hsm_account@example.com | grep mailboxId 
Restored MailboxID: 37 
  • Restored Account Hash (substitute actual Mailbox ID):
perl -e "print (mailboxId>>12)"

Restored Account Hash: 0

3) Recreate the filesystem HSM path for the existing account (/opt/zimbra/hsm/Account Hash/MailboxID):

mkdir -p /opt/zimbra/hsm/0/4

4) Move the HSM blobs from the restored account to the real account:

mv /opt/zimbra/hsm/Restored Account Hash/Restored MailboxID/msg /opt/zimbra/hsm/Account Hash/MailboxID/ 

Actual:

mv /opt/zimbra/hsm/0/37/msg /opt/zimbra/hsm/0/4/

5) Delete the restored account:

zmprov da hsm_account@example.com  

6) Restart mailboxd for account to see HSM blobs:

zmmailboxdctl restart

7) Log in to account (account@example.com) and verify HSM messages are there



Submitted by: Raunaq Malik

Jump to: navigation, search