restore

$ kopia restore <sources>

Restore a directory or a file.

Restore can operate in two modes:

  • from a snapshot: restoring (possibly shallowly) a specified file or directory from a snapshot into a target path. By default, the target path will be created by the restore command if it does not exist.

  • by expanding a shallow placeholder in situ where the placeholder was created by a previous restore.

In the from-snapshot mode:

The source to be restored is specified in the form of a directory or file ID and optionally a sub-directory path.

For example, the following source and target arguments will restore the contents of the ‘kffbb7c28ea6c34d6cbe555d1cf80faa9’ directory into a new, local directory named ‘d1’

‘restore kffbb7c28ea6c34d6cbe555d1cf80faa9 d1’

Similarly, the following command will restore the contents of a subdirectory ‘subdir/subdir2’ under ‘kffbb7c28ea6c34d6cbe555d1cf80faa9’ into a new, local directory named ‘sd2’

‘restore kffbb7c28ea6c34d6cbe555d1cf80faa9/subdir1/subdir2 sd2’

When restoring to a target path that already has existing data, by default the restore will attempt to overwrite, unless one or more of the following flags has been set (to prevent overwrite of each type):

–no-overwrite-files –no-overwrite-directories –no-overwrite-symlinks

If the ‘–shallow’ option is provided, files and directories this depth and below in the directory hierarchy will be represented by compact placeholder files of the form ‘entry.kopia-entry’ instead of being restored. (I.e. setting ‘–shallow’ to 0 will only shallow restore.) Snapshots created of directory contents represented by placeholder files will be identical to snapshots of the equivalent fully expanded tree.

In the expanding-a-placeholder mode:

The source to be restored is a pre-existing placeholder entry of the form ‘entry.kopia-entry’. The target will be ‘entry’. ‘–shallow’ controls the depth of the expansion and defaults to 0. For example:

‘restore d3.kopiadir’

will remove the d3.kopiadir placeholder and restore the referenced repository contents into path d3 where the contents of the newly created path d3 will themselves be placeholder files.

Flag Short Default Help
--[no-]consistent-attributes false When multiple snapshots match, fail if they have inconsistent attributes
--[no-]ignore-errors false Ignore all errors
--[no-]ignore-permission-errors true Ignore permission errors
--mode auto Override restore mode
--[no-]overwrite-directories true Overwrite existing directories
--[no-]overwrite-files true Specifies whether or not to overwrite already existing files
--[no-]overwrite-symlinks true Specifies whether or not to overwrite already existing symlinks
--parallel 8 Restore parallelism (1=disable)
--shallow Shallow restore the directory hierarchy starting at this level (default is to deep restore the entire hierarchy.)
--shallow-minsize When doing a shallow restore, write actual files instead of placeholders smaller than this size.
--[no-]skip-existing false Skip files and symlinks that exist in the output
--[no-]skip-owners false Skip owners during restore
--[no-]skip-permissions false Skip permissions during restore
--[no-]skip-times false Skip times during restore
--[no-]sparse false When doing a restore, attempt to write files sparsely-allocating the minimum amount of disk space needed.
--[no-]write-files-atomically false Write files atomically to disk, ensuring they are either fully committed, or not written at all, preventing partially written files
Argument Help
sources Two forms: 1. Source directory ID/path in the form of a
directory ID and optionally a sub-directory path. For example,
‘kffbb7c28ea6c34d6cbe555d1cf80faa9’ or
‘kffbb7c28ea6c34d6cbe555d1cf80faa9/subdir1/subdir2’
followed by the path of the directory for the contents to be restored.
  1. one or more placeholder files of the form path.kopia-entry |
Last modified January 1, 0001