Init command details

   duplicacy init - Initialize the storage if necessary and the current directory as the repository

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

   -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)
   -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
   -repository <path>              initialize a new repository at the specified path rather than the current working directory

The init command first connects to the storage specified by the storage URL. If the storage has already been initialized, 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 create the destination path on the storage if it does not already exist.

The initialized storage will then become the default storage for other commands if the -storage 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 _. :bulb: It is important that IDs are unique across machines.

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, and snapshot files are encrypted by a key derived from the snapshot ID and the revision number.

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.

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 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.

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

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.