Skip to content
gilbertchen edited this page Jan 29, 2024 · 20 revisions
SYNOPSIS:
   duplicacy init - Initialize the storage if necessary and the current directory as the repository

USAGE:
   duplicacy init [command options] <snapshot id> <storage url>

OPTIONS:
   -encrypt, -e                    encrypt the storage with a password
   -chunk-size, -c <size>          the average size of chunks (default is 4M)
   -max-chunk-size, -max <size>    the maximum size of chunks (default is chunk-size*4)
   -min-chunk-size, -min <size>    the minimum size of chunks (default is chunk-size/4)
   -zstd-level <level>             set zstd compression level (fastest, default, better, or best)
   -zstd                           short for -zstd-level default
   -iterations <i>                 the number of iterations used in storage key derivation (default is 16384)
   -pref-dir <path>                alternate location for the .duplicacy directory (absolute or relative to current directory)
   -storage-name <name>            assign a name to the storage
   -key <public key>               the RSA public key to encrypt file chunks
   -repository <path>              initialize a new repository at the specified path rather than the current working directory
   -erasure-coding <data shards>:<parity shards> 	enable erasure coding to protect against storage corruption

The init command first connects to the storage specified by the storage URL. If the storage has been already initialized before, it will download the storage configuration (stored in the file named config) and ignore the options provided in the command line. Otherwise, it will create the configuration file from the options and upload the file.

Duplicacy will not create the destination folder on the storage if the folder does not exist.

The initialized storage will then become the default storage for other commands if the -storage-name option is not specified for those commands. This default storage actually has a name, default.

After that, it will prepare the current working directory as the repository to be backed up. Under the hood, it will create a directory named .duplicacy in the repository and put a file named preferences that stores the snapshot id and encryption and storage options.

The snapshot id is an id used to distinguish different repositories connected to the same storage. Each repository must have a unique snapshot id. A snapshot id must contain only alphanumeric characters as well as - and _.

The -e option controls whether or not encryption will be enabled for the storage. If encryption is enabled, you will be prompted to enter a storage password. The storage password is used to encrypt the config file only.

If you have already created an encrypted storage to which you are now connecting, you will have to add the -e flag, so that you will be asked to enter the encryption password.

The three chunk size parameters are passed to the variable-size chunking algorithm. Their values are important to the overall performance, especially for cloud storages. If the chunk size is too small, a lot of overhead will be in sending requests and receiving responses. If the chunk size is too large, the effect of de-duplication will be less obvious as more data will need to be transferred with each chunk.

Once a storage has been initialized with certain chunk size parameters, these parameters cannot be modified any more.

The -iterations option specifies how many iterations are used to generate the key that encrypts the config file from the storage password.

The -pref-dir option is deprecated and the -repository option should be used instead. This option controls the location of the preferences directory. If not specified, a directory named .duplicacy is created in the repository. If specified, it must point to a non-existing directory. The directory is created and a .duplicacy file is created in the repository. The .duplicacy file contains the absolute path name to the preferences directory.

The -repository option specifies how the repository root directory is defined in the preferences file. This may be specified as either an absolute or relative path. Relative paths are relative to the current working directory of Duplicacy at the time it is executed (when the preferences file is being parsed). This option allows for the possibility of the repository configuration files and the repository itself being maintained in separate file system locations. When not specified, an empty repository path is written to the preferences file, causing Duplicacy to treat its current working directory as the repository root.

The -key option enables RSA encryption.

The -erasure-coding option enables Erasure coding.