We’ve briefly explained how to restore a backup to a different folder or computer in Duplicacy quick-start and Restore command details, but this topic is so important that it deserves its own page.
Suppose you’ve set up a repository with the repository id backup1
and run the first backup:
cd path/to/repository1
duplicacy init backup1 sftp://user@192.168.1.100/path/to/storage
duplicacy backup -stats
If you edit some files in the repository and later want to undo the edits, you can simply run the restore command:
cd path/to/repository1
duplicacy restore -r 1
But what if you want to restore the original files to a different folder other than repository1
? You’ll notice that the Restore command details command does not have a -restore-to
option.
This is because the use of the repository id makes such an option unnecessary. In Duplicacy, a repository id is what uniquely identifies a repository. In fact, Duplicacy does not care about the path of the repository nor does it keep track of it.
Therefore, when you create a new repository on a different folder on the same or a different computer, if you pass the same repository id to Duplicacy, Duplicacy will think it is the same repository and allow you to restore files (or to continue to run new backups), regardless of the location of the new repository.
cd path/to/repository2 # this can be on the same or a different computer
duplicacy init backup1 sftp://user@192.168.1.100/path/to/storage # the storage url must be the same
duplicacy restore -r 1
In other words, the repository id is the only thing that you need in order to restore an existing backup (if you know where the storage is). Do you need to write it down in a safe place in case your computer crashes? The answer is no. If you log in to the remote computer where the storage resides (or the website of the cloud storage provider) and look under the storage folder you’ll see a snapshots
subfolder which contains all repository ids – the name of every subfolder under snapshots
is a repository id.
And yes, there may be more than one repository id under the snapshots
folder, because multiple repositories can and should back up to the same storage, taking advantage of the unique feature of Duplicacy – cross-computer deduplication.