duplicity (1) Linux Manual Page
NAME
duplicity – Encrypted incremental backup to local or remote storage.
SYNOPSIS
For detailed descriptions for each command see chapter ACTIONS.
duplicity [full|incremental] [options] source_directory target_url
duplicity verify [options] [–compare-data] [–file-to-restore <relpath>] [–time time] source_url target_directory
duplicity collection-status [options] [–file-changed <relpath>] target_url
duplicity list-current-files [options] [–time time] target_url
duplicity [restore] [options] [–file-to-restore <relpath>] [–time time] source_url target_directory
duplicity remove-older-than <time> [options] [–force] target_url
duplicity remove-all-but-n-full <count> [options] [–force] target_url
duplicity remove-all-inc-of-but-n-full <count> [options] [–force] target_url
duplicity cleanup [options] [–force] target_url
duplicity replicate [options] [–time time] source_url target_url
DESCRIPTION
Duplicity incrementally backs up files and folders into tar-format volumes encrypted with GnuPG and places them to a remote (or local) storage backend. See chapter URL FORMAT for a list of all supported backends and how to address them. Because duplicity uses librsync, incremental backups are space efficient and only record the parts of files that have changed since the last backup. Currently duplicity supports deleted files, full Unix permissions, uid/gid, directories, symbolic links, fifos, etc., but not hard links.
If you are backing up the root directory /, remember to –exclude /proc, or else duplicity will probably crash on the weird stuff in there.
EXAMPLES
Here is an example of a backup, using sftp to back up /home/me to some_dir on the other.host machine:
- duplicity /home/me sftp://uid@other.host/some_dir
If the above is run repeatedly, the first will be a full backup, and subsequent ones will be incremental. To force a full backup, use the full action:
- duplicity full /home/me sftp://uid@other.host/some_dir
or enforcing a full every other time via –full-if-older-than <time> , e.g. a full every month:
- duplicity –full-if-older-than 1M /home/me sftp://uid@other.host/some_dir
Now suppose we accidentally delete /home/me and want to restore it the way it was at the time of last backup:
- duplicity sftp://uid@other.host/some_dir /home/me
Duplicity enters restore mode because the URL comes before the local directory. If we wanted to restore just the file "Mail/article" in /home/me as it was three days ago into /home/me/restored_file:
- duplicity -t 3D –file-to-restore Mail/article sftp://uid@other.host/some_dir /home/me/restored_file
The following command compares the latest backup with the current files:
- duplicity verify sftp://uid@other.host/some_dir /home/me
Finally, duplicity recognizes several include/exclude options. For instance, the following will backup the root directory, but exclude /mnt, /tmp, and /proc:
- duplicity –exclude /mnt –exclude /tmp –exclude /proc / file:///usr/local/backup
Note that in this case the destination is the local directory /usr/local/backup. The following will backup only the /home and /etc directories under root:
- duplicity –include /home –include /etc –exclude ‘**’ / file:///usr/local/backup
Duplicity can also access a repository via ftp. If a user name is given, the environment variable FTP_PASSWORD is read to determine the password:
- FTP_PASSWORD=mypassword duplicity /local/dir ftp://user@other.host/some_dir
ACTIONS
Duplicity knows action commands, which can be finetuned with options.
The actions for backup (full,incr) and restoration (restore) can as well be left out as duplicity detects in what mode it should switch to by the order of target URL and local folder. If the target URL comes before the local folder a restore is in order, is the local folder before target URL then this folder is about to be backed up to the target URL.
If a backup is in order and old signatures can be found duplicity automatically performs an incremental backup.
Note: The following explanations explain some but not all options that can be used in connection with that action command. Consult the OPTIONS section for more detailed informations.
full<folder> <url>- Perform a full backup. A new backup chain is started even if signatures are available for an incremental backup.
incr<folder> <url>- If this is requested an incremental backup will be performed. Duplicity will abort if no old signatures can be found.
verify[–compare-data] [–time <time>] [–file-to-restore <rel_path>] <url> <local_path>- Verify tests the integrity of the backup archives at the remote location by downloading each file and checking both that it can restore the archive and that the restored file matches the signature of that file stored in the backup, i.e. compares the archived file with its hash value from archival time. Verify does not actually restore and will not overwrite any local files. Duplicity will exit with a non-zero error level if any files do not match the signature stored in the archive for that file. On verbosity level 4 or higher, it will log a message for each file that differs from the stored signature. Files must be downloaded to the local machine in order to compare them. Verify does not compare the backed-up version of the file to the current local copy of the files unless the –compare-data option is used (see below).
The –file-to-restore option restricts verify to that file or folder. The –time option allows to select a backup to verify. The –compare-data option enables data comparison (see below). collection-status[–file-changed <relpath>]<url>- Summarize the status of the backup repository by printing the chains and sets found, and the number of volumes in each.
list-current-files[–time <time>] <url>- Lists the files contained in the most current backup or backup at time. The information will be extracted from the signature files, not the archive data itself. Thus the whole archive does not have to be downloaded, but on the other hand if the archive has been deleted or corrupted, this command will not detect it.
restore[–file-to-restore <relpath>] [–time <time>] <url> <target_folder>- You can restore the full monty or selected folders/files from a specific time. Use the relative path as it is printed by
list-current-files. Usually not needed as duplicity enters restore mode when it detects that the URL comes before the local folder. remove-older-than<time> [–force] <url>- Delete all backup sets older than the given time. Old backup sets will not be deleted if backup sets newer than time depend on them. See the
TIME FORMATSsection for more information. Note, this action cannot be combined with backup or other actions, such as cleanup. Note also that –force will be needed to delete the files instead of just listing them. remove-all-but-n-full<count> [–force] <url>- Delete all backups sets that are older than the count:th last full backup (in other words, keep the last count full backups and associated incremental sets). count must be larger than zero. A value of 1 means that only the single most recent backup chain will be kept. Note that –force will be needed to delete the files instead of just listing them.
remove-all-inc-of-but-n-full<count> [–force] <url>- Delete incremental sets of all backups sets that are older than the count:th last full backup (in other words, keep only old full backups and not their increments). count must be larger than zero. A value of 1 means that only the single most recent backup chain will be kept intact. Note that –force will be needed to delete the files instead of just listing them.
cleanup[–force] <url>- Delete the extraneous duplicity files on the given backend. Non-duplicity files, or files in complete data sets will not be deleted. This should only be necessary after a duplicity session fails or is aborted prematurely. Note that –force will be needed to delete the files instead of just listing them.
replicate[–time time] <source_url> <target_url>- Replicate backup sets from source to target backend. Files will be (re)-encrypted and (re)-compressed depending on normal backend options. Signatures and volumes will not get recomputed, thus options like
–volsizeor–max-blocksizehave no effect. When –time time is given, only backup sets older than time will be replicated.
OPTIONS
–allow-source-mismatch- Do not abort on attempts to use the same archive dir or remote backend to back up different directories. duplicity will tell you if you need this switch.
–archive-dirpath- The archive directory.
NOTE:This option changed in 0.6.0. The archive directory is now necessary in order to manage persistence for current and future enhancements. As such, this option is now used only to change the location of the archive directory. The archive directory shouldnotbe deleted, or duplicity will have to recreate it from the remote repository (which may require decrypting the backup contents).When backing up or restoring, this option specifies that the local archive directory is to be created in path. If the archive directory is not specified, the default will be to create the archive directory in ~/.cache/duplicity/.
The archive directory can be shared between backups to multiple targets, because a subdirectory of the archive dir is used for individual backups (see
–name).The combination of archive directory and backup name must be unique in order to separate the data of different backups.
The interaction between the
–archive-dirand the–nameoptions allows for four possible combinations for the location of the archive dir:-
- 1.
- neither specified (default)
~/.cache/duplicity/hash-of-url - 2.
- –archive-dir=/arch, no –name
/arch/hash-of-url - 3.
- no –archive-dir, –name=foo
~/.cache/duplicity/foo - 4.
- –archive-dir=/arch, –name=foo
/arch/foo
–asynchronous-upload- (EXPERIMENTAL) Perform file uploads asynchronously in the background, with respect to volume creation. This means that duplicity can upload a volume while, at the same time, preparing the next volume for upload. The intended end-result is a faster backup, because the local CPU and your bandwidth can be more consistently utilized. Use of this option implies additional need for disk space in the temporary storage location; rather than needing to store only one volume at a time, enough storage space is required to store two volumes.
–backend-retry-delaynumber- Specifies the number of seconds that duplicity waits after an error has occured before attempting to repeat the operation.
–cf-backendbackend- Allows the explicit selection of a cloudfiles backend. Defaults to
pyrax. Alternatively you might choosecloudfiles. –compare-data- Enable data comparison of regular files on action verify. This conducts a verify as described above to verify the integrity of the backup archives, but additionally compares restored files to those in target_directory. Duplicity will not replace any files in target_directory. Duplicity will exit with a non-zero error level if the files do not correctly verify or if any files from the archive differ from those in target_directory. On verbosity level 4 or higher, it will log a message for each file that differs from its equivalent in target_directory.
–copy-links- Resolve symlinks during backup. Enabling this will resolve & back up the symlink’s file/folder data instead of the symlink itself, potentially increasing the size of the backup.
–dry-run- Calculate what would be done, but do not perform any backend actions
–encrypt-keykey-id- When backing up, encrypt to the given public key, instead of using symmetric (traditional) encryption. Can be specified multiple times. The key-id can be given in any of the formats supported by GnuPG; see
gpg(1), section "HOW TO SPECIFY A USER ID" for details. –encrypt-secret-keyringfilename- This option can only be used with
–encrypt-key, and changes the path to the secret keyring for the encrypt key to filename This keyring is not used when creating a backup. If not specified, the default secret keyring is used which is usually located at .gnupg/secring.gpg –encrypt-sign-keykey-id- Convenience parameter. Same as
–encrypt-keykey-id–sign-keykey-id. –excludeshell_pattern- Exclude the file or files matched by shell_pattern. If a directory is matched, then files under that directory will also be matched. See the
FILE SELECTIONsection for more information. –exclude-device-files- Exclude all device files. This can be useful for security/permissions reasons or if duplicity is not handling device files correctly.
–exclude-filelistfilename- Excludes the files listed in filename, with each line of the filelist interpreted according to the same rules as
–includeand–exclude.See theFILE SELECTIONsection for more information. –exclude-if-presentfilename- Exclude directories if filename is present. Allows the user to specify folders that they do not wish to backup by adding a specified file (e.g. ".nobackup") instead of maintaining a comprehensive exclude/include list.
–exclude-older-thantime- Exclude any files whose modification date is earlier than the specified time. This can be used to produce a partial backup that contains only recently changed files. See the
TIME FORMATSsection for more information. –exclude-other-filesystems- Exclude files on file systems (identified by device number) other than the file system the root of the source directory is on.
–exclude-regexpregexp- Exclude files matching the given regexp. Unlike the
–excludeoption, this option does not match files in a directory it matches. See theFILE SELECTIONsection for more information. –file-prefix, –file-prefix-manifest, –file-prefix-archive, –file-prefix-signature- Adds a prefix to all files, manifest files, archive files, and/or signature files.
The same set of prefixes must be passed in on backup and restore.
If both global and type-specific prefixes are set, global prefix will go before type-specific prefixes.
See also
A NOTE ON FILENAME PREFIXES –file-to-restorepath- This option may be given in restore mode, causing only path to be restored instead of the entire contents of the backup archive. path should be given relative to the root of the directory backed up.
–full-if-older-thantime- Perform a full backup if an incremental backup is requested, but the latest full backup in the collection is older than the given time. See the
TIME FORMATSsection for more information. –force- Proceed even if data loss might result. Duplicity will let the user know when this option is required.
–ftp-passive- Use passive (PASV) data connections. The default is to use passive, but to fallback to regular if the passive connection fails or times out.
–ftp-regular- Use regular (PORT) data connections.
–gio- Use the GIO backend and interpret any URLs as GIO would.
–hidden-encrypt-keykey-id- Same as
–encrypt-key, but it hides user’s key id from encrypted file. It uses the gpg’s–hidden-recipientcommand to obfuscate the owner of the backup. On restore, gpg will automatically try all available secret keys in order to decrypt the backup. See gpg(1) for more details. –ignore-errors- Try to ignore certain errors if they happen. This option is only intended to allow the restoration of a backup in the face of certain problems that would otherwise cause the backup to fail. It is not ever recommended to use this option unless you have a situation where you are trying to restore from backup and it is failing because of an issue which you want duplicity to ignore. Even then, depending on the issue, this option may not have an effect.
Please note that while ignored errors will be logged, there will be no summary at the end of the operation to tell you what was ignored, if anything. If this is used for emergency restoration of data, it is recommended that you run the backup in such a way that you can revisit the backup log (look for lines containing the string IGNORED_ERROR).
If you ever have to use this option for reasons that are not understood or understood but not your own responsibility, please contact duplicity maintainers. The need to use this option under production circumstances would normally be considered a bug.
–imap-full-addressemail_address- The full email address of the user name when logging into an imap server. If not supplied just the user name part of the email address is used.
–imap-mailboxoption- Allows you to specify a different mailbox. The default is "INBOX". Other languages may require a different mailbox than the default.
–gpg-binaryfile_path- Allows you to force duplicity to use file_path as gpg command line binary. Can be an absolute or relative file path or a file name. Default value is ‘gpg’. The binary will be localized via the PATH environment variable.
–gpg-optionsoptions- Allows you to pass options to gpg encryption. The options list should be of the form "–opt1 –opt2=parm" where the string is quoted and the only spaces allowed are between options.
–includeshell_pattern- Similar to
–excludebut include matched files instead. Unlike–exclude, this option will also match parent directories of matched files (although not necessarily their contents). See theFILE SELECTIONsection for more information. –include-filelistfilename- Like
–exclude-filelist, but include the listed files instead. See theFILE SELECTIONsection for more information. –include-regexpregexp- Include files matching the regular expression regexp. Only files explicitly matched by regexp will be included by this option. See the
FILE SELECTIONsection for more information. –log-fdnumber- Write specially-formatted versions of output messages to the specified file descriptor. The format used is designed to be easily consumable by other programs.
–log-filefilename- Write specially-formatted versions of output messages to the specified file. The format used is designed to be easily consumable by other programs.
–max-blocksizenumber- determines the number of the blocks examined for changes during the diff process. For files < 1MB the blocksize is a constant of 512. For files over 1MB the size is given by:
file_blocksize = int((file_len / (2000 * 512)) * 512)
return min(file_blocksize, globals.max_blocksize)where globals.max_blocksize defaults to 2048. If you specify a larger max_blocksize, your difftar files will be larger, but your sigtar files will be smaller. If you specify a smaller max_blocksize, the reverse occurs. The –max-blocksize option should be in multiples of 512.
–namesymbolicname- Set the symbolic name of the backup being operated on. The intent is to use a separate name for each logically distinct backup. For example, someone may use "home_daily_s3" for the daily backup of a home directory to Amazon S3. The structure of the name is up to the user, it is only important that the names be distinct. The symbolic name is currently only used to affect the expansion of
–archive-dir, but may be used for additional features in the future. Users running more than one distinct backup are encouraged to use this option.If not specified, the default value is a hash of the backend URL.
–no-compression- Do not use GZip to compress files on remote system.
–no-encryption- Do not use GnuPG to encrypt files on remote system.
–no-print-statistics- By default duplicity will print statistics about the current session after a successful backup. This switch disables that behavior.
–null-separator- Use nulls (
