Skip to content
gilbertchen edited this page Jan 29, 2024 · 7 revisions

The backup command creates a snapshot of the repository and uploads it to the storage. Click here for a list of related forum topics.

Quick overview

NAME:
   duplicacy backup - Save a snapshot of the repository to the storage
USAGE:
   duplicacy backup [command options]
OPTIONS:
   -hash                        detect file differences by hash (rather than size and timestamp)
   -t <tag>                     assign a tag to the backup
   -stats                       show statistics during and after backup
   -threads <n>                 number of uploading threads
   -limit-rate <kB/s>           the maximum upload rate (in kilobytes/sec)
   -dry-run                     dry run for testing, don't backup anything. Use with -stats and -d
   -zstd-level <level>          set zstd compression level (fastest, default, better, or best)
   -zstd                        short for -zstd-level default
   -vss                         enable the Volume Shadow Copy service (Windows and macOS using APFS only)
   -vss-timeout <timeout>       the timeout in seconds to wait for the Volume Shadow Copy operation to complete
   -storage <storage name>      backup to the specified storage instead of the default one
   -enum-only                   enumerate the repository recursively and then exit

Usage

duplicacy backup [command options]

Options

-hash

By default duplicacy detects modified files (since last backup) by comparing file sizes and timestamps. This is the default option and works in more than 99% of cases. If -hash is provided, duplicacy will scan every file in your repository by reading its contents in order to detect the modifications. Using this option leads to increased running time since all the files are read from the disk, so it is not advised to run all the backups with the option.

Example
duplicacy backup -hash

-t <tag>

You can assign a tag to this snapshot so that later you can refer to it by tag in other commands, instead of revision number.

Example
duplicacy backup -t some_revisions_are_more_special_and_have_this_tag

-stats

If the -stats option is specified, statistical information such as transfer speed and the number of chunks uploaded or skipped will be displayed throughout the backup process.

-threads <n>

This option is used to specify more than one thread to upload chunks. This is generally useful to increase upload speed. :bulb: You should test the best number of threads for your connection and storage provider but using more than 30 threads is unadvised as it will not improve speeds significantly. :point_up: Reading the repository is always done using only 1 thread, since even a normal HDD can have read speeds of 50MB per second or more, which is more than most storage providers offer for upload per user.

Example

duplicacy backup -threads 10 # use 10 threads for the upload process

-limit-rate <kB/s>

The -limit-rate option sets a cap on the maximum upload rate. This applies to the global upload speed, disregarding the number of threads used.

Example
duplicacy backup -limit-rate 650                    # maximum upload speed is 650 kb/s
duplicacy backup -threads 10 -limit-rate 650        # maximum total upload speed for the 10 threads is 650 kb/s

-dry-run

This option is used to test what changes the backup command would have done. It is guaranteed not to make any changes on the storage.

Example:

After running this nothing will be modified in the storage, but duplicacy will show all output just like a normal backup: duplicacy backup -dry-run or duplicacy backup -dry-run -threads 500 -vss -stats

-vss, -vss-timeout <timeout>

The -vss option works on Windows and on MacOS (APFS format only) but not on linux. It is used to turn on the Volume Shadow Copy (Windows) or AFPS snapshot (MacOS) services such that files opened by other processes with exclusive locks can be read as usual. The -vss-timeout option changes the grace period in which duplicacy will wait for the system to enable or disable the vss. The minimum is 60 seconds. This option should be used only with -vss.

Example
duplicacy backup -vss
duplicacy backup -vss -vss-timeout 200            # wait 200 seconds instead of 60

-storage <storage name>

When the repository can have multiple storage destinations (added by the add command), you can select the storage to back up to by giving a storage name.

Example
duplicacy backup -storage backblaze_b2_storage      # backup to storage backblaze_b2_storage instead of the default one

-enum-only

This option will only list all the files and folders included or excluded in the repository. It will not modify anything in the repository or on the storage. This offers a quick way to test the filters file. Historical note: this was first proposed here.

Example
duplicacy -d -log backup -enum-only

Notes

📄 Include/exclude files and filters

You can specify patterns to include/exclude files by putting them in a file named .duplicacy/filters. Please refer to Include/Exclude Patterns for how to specify the filtering patterns.