Hostwinds Tutorials

Search results for:


Performing Restorations with Restic

Tags: Restic,  Backups 

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.

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 file path 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 to have 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

Written by Hostwinds Team  /  June 5, 2021