Performing Restorations with Restic

Performing restorations, as with any process with restic is incredibly easy and quick.

As with any interaction with Restic, you must first initialize the repo to perform actions within restic, to do so follow this guide.

The restore command has multiple options available, as shown below –

The below command will restore from the given SnapshotID (retrieved from restic snapshots) it will restore the PathBeingRestored to the LocationToRestoreTo

restic restore $SnapshotID --target $LocationToRestoreTo --path $PathBeingRestored

The below command will restore from the given SnapshotID (retrieved from restic snapshots) it will restore the PathtoFileBeingRestored to the LocationToRestoreTo

restic restore $SnapshotID --target $LocationToRestoreTo --include $PathtoFileBeingRestored

The below command will restore from the given SnapshotID (retrieved from restic snapshots) it will restore the PathBeingRestored to the LocationToRestoreTo, it will exclude any files/folders under FileOrPathBeingExcluded.

restic restore $SnapshotID --target $LocationToRestoreTo --path $PathBeingRestored --exclude $FileOrPathBeingExcluded

Note: With restores, the full filepath will be restored, meaning if you are running the below command, it will restore the file to /tmp/restore/home/kbuser/public_html/index.php

restic restore 7e83abo1 --target /tmp/restore --path /home/kbuser/public_html/index.php

To avoid this, and having to move the content around after the restore, you can specify a restore path of / shown in the below example.

restic restore 7e83abo1 --target / --path /home/kbuser/public_html/index.php

In the above example, the file index.php will be restored to its original path, /home/kbuser/public_html/index.php


Share:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.