Duplicacy Command Examples (with examples)
Use current directory as the repository, initialize a SFTP storage and encrypt the storage with a password
Code: duplicacy init -e snapshot_id sftp://user@192.168.2.100/path/to/storage/
Motivation: This command allows you to initialize a new repository for backup purposes and configure it to use a SFTP storage location. The -e
flag enables encryption to secure your backup data.
Explanation:
init
: This command initializes a new repository.-e
: This flag enables encryption for the storage.snapshot_id
: This is the identifier for the initial snapshot of the repository.sftp://user@192.168.2.100/path/to/storage/
: This is the SFTP storage URL where the backup data will be stored. Replaceuser
with your SFTP username and192.168.2.100/path/to/storage/
with the actual SFTP storage path.
Example Output:
Enter a new password to encrypt files:
Re-enter the password:
Password set for the storage "snapshot_id"
Save a snapshot of the repository to the default storage
Code: duplicacy backup
Motivation: This command allows you to save a snapshot of the repository, backing up any changes made since the last snapshot. It is essential to regularly create backups to ensure data protection and recovery.
Explanation:
backup
: This command creates a new snapshot of the repository and saves it to the configured storage.
Example Output:
Storage set to default URL
No previous backup found
Indexing /path/to/repository
Files: 1000, File chunks: 2000, Metadata chunks: 3, Metadata: 3
...
List snapshots of current repository
Code: duplicacy list
Motivation: This command allows you to view the list of available snapshots for the current repository. It is useful for verifying backup history and identifying specific snapshots for restoration.
Explanation:
list
: This command lists all the available snapshots in the repository.
Example Output:
snapshot_id revision size chunks oldest creation duration
1 1 10.3MB 100 3d12h42m 2017-04-10 1h40m
2 4 15.4MB 150 1d23h8m 2017-04-11 1h43m
3 9 12.0MB 71 23h41m 2017-04-12 1h47m
...
Restore the repository to a previously saved snapshot
Code: duplicacy restore -r revision
Motivation: This command allows you to restore the repository to a specific snapshot, effectively rolling back changes made after that snapshot. In case of data loss or corruption, this feature is crucial for recovering your files.
Explanation:
restore
: This command restores the repository to a specific snapshot.-r
: This flag is followed by the desired revision number to specify the snapshot to restore.
Example Output:
Enter the path to restore the snapshot to:
Restored /path/to/repository at revision 4
Check the integrity of snapshots
Code: duplicacy check
Motivation: This command allows you to perform an integrity check on the snapshots of the repository. By ensuring the integrity of your backups, you can have confidence in their reliability and ability to restore files accurately.
Explanation:
check
: This command performs an integrity check on the snapshots of the repository.
Example Output:
Storage set to default URL
Listing all chunks
...
All chunks referenced by snapshot snapshot_id at revision 9 exist
Add another storage to be used for the existing repository
Code: duplicacy add storage_name snapshot_id storage_url
Motivation: This command allows you to add an additional storage location for your existing repository. By having multiple storage locations, you can enhance the reliability and redundancy of your backups.
Explanation:
add
: This command adds a new storage for the existing repository.storage_name
: This is the identifier for the new storage.snapshot_id
: This is the identifier of the snapshot to be copied to the new storage.storage_url
: This is the URL or path of the new storage location.
Example Output:
Enter the master password to add a new storage:
Storage set to default URL
The storage "storage_name" has been added
Prune a specific revision of snapshot
Code: duplicacy prune -r revision
Motivation: This command allows you to remove a specific revision of a snapshot from the storage, reclaiming storage space. It is beneficial when you no longer need a particular revision and want to optimize your storage usage.
Explanation:
prune
: This command removes a specific revision of a snapshot from the storage.-r
: This flag is followed by the revision number to specify the snapshot revision to delete.
Example Output:
Snapshot snapshot_id revision 10 is removed
Prune revisions, keeping one revision every n
days for all revisions older than m
days
Code: duplicacy prune -keep n:m
Motivation: This command allows you to manage the number of revisions stored in the backup storage. By specifying the n
and m
values, you can control how many revisions are kept, preventing excessive storage usage.
Explanation:
prune
: This command removes unnecessary revisions from the storage.-keep n:m
: This flag is followed by two values separated by a colon. Then
value represents the number of revisions to keep, while them
value defines the number of days. This configuration keeps one revision everyn
days for all revisions older thanm
days.
Example Output:
Deleting snapshot snapshot_id revision 7
Deleting snapshot snapshot_id revision 4
...