Deutsch

Using my Restic Backup


One of the servers I manage has a Wordpress installation that caught some malware, so i needed my backup today.

I used the following commands to restore my files:

restic find <path>, to find all the snapshots that contain the file(s) I was searching for, and restic snapshots to list every snapshot with a timestamp. restic ls <snapshot id> lists all the files in the selected snapshot.

To see the difference between snapshots, restic diff <snapshot id 1> <snapshot id 2> tells you which files were added or removed.

To restore, you can either use restic dump <snapshot> <path> to dump the file to stdout, or mount your backup via restic mount <directory>. The mounted directory contains folders for hosts, snapshots by date and id, and tags. You can copy your files from the desired snapshot easily.

The faster way (according to the manual) is to restore the snapshot directly via restic restore <snapshot id> --target <local folder>. The backup as seen from restic ls will be dumped in the local folder and can be processed from there. I did not do that since I only searched for specific files. Mounting and copying the files felt slow, however.

So, to recap: After rebuilding the server I

  1. Found the desired files with restic find <file>
  2. Looked at the snapshot to verify all the files I needed were there with restic ls <snapshot id>
  3. Mounted the backup: restic mount <local folder>
  4. Copied the needed files with cp