Please, who can give some instructions how to restore a backup on a running MaiB server.
I accidently deleted a user account and I would like to now if this mailbox can be restore
if I would restore a system backup.
I read here Restore from a backup some instructions to restore from a backup, but I really don’t understand those instructions.
Maybe because the backup is restore on a new server.
If someone could guide to this on the existing server, you would be great.
The files were deleted using SSH/FTP indeed.
I deleted the directory /home/user-data/mail/mailboxes/mydomain.nl/userA on the machine.
I wanted to deleted another account, from user B, because user B migrate to another server. But instead to deleted the account of user B, I deleted the account from user A.
I really hope that I still can do some kind of recovery.
So, restoring files is a bit difficult. Sorry that this isn’t more polished yet.
Assuming you haven’t changed the backup settings in the control panel, this very long line will help you:
PASSPHRASE=$(cat /home/user-data/backup/secret_key.txt) duplicity restore --time 3D --file-to-restore mail/mailboxes/domain/user file:///home/user-data/backup/encrypted/ /tmp/restored-files
The part --time 3D says how long ago to restore from. 3D means three days ago. You may have to change that part. This should be just before when you deleted the files. A backup is made each night — hopefully the backup from a few days ago is still there. (It should be. Backups are held for a minimum of three days.)
--file-to-restore mail/mailboxes/domain/user says what files to restore. You should change domain and user to match the directory path that you deleted.
The restored files will be placed in /tmp/restored-files. You can then move that whole directory into the right place, like:
I follow your instructions and the files from userA were restored. I move them to the right folder. But when login with Roundcube, I can see only the INBOX folder. No Sent and any other folders.
Does this mean that a backup is only made for the INBOX folder or is something else what is missing to see all folder in Roundcube.
First I have move everything in /home/user-data/mail to /home/user-data/mail01, because I don’t want to change nothing for the current users.
Then I ran:
PASSPHRASE=$(cat /home/user-data/backup/secret_key.txt) duplicity restore --time 7D --file-to-restore mail file:///home/user-data/backup/encrypted/ /tmp/restored-files
After that I move all directories/files in /tmp/restored-files to /home/user-data/mail
If passwords of mail account have been change recently, then set these password again.
Now when login to Roundcube I can see all folders off userA.
Hi @pbx_ramdas. I’m glad you were able to figure it out. I’m not sure why the non-inbox folders weren’t restored by the first method. Thanks for reporting back what happened — I’ll look into it.
If you’ve followed the above instructions exactly, using the --file-to-restore flag, then yes, you’d move that folder entirely to its new home, which from your message does look to be correct.
Okay, change into one of the directories causing you the issue. You will find a file called: dovecot.index
You want to move that index to a different filename so that the indexes regenerate.
mv dovecot.index dovecot.index.bak
Then navigate to that one in Roundcube again and see if it now works. If so, then you can repeat for the other directories. This occurs because dovecot indexes are stale since this was a rebuilt mailbox.