backup()
Performs a backup operation, creating a new snapshot.Parameters
repo: The repository to backup toopts: Backup optionssource: The source paths to backupsnap: Snapshot metadata
Returns
Returns the createdSnapshotFile containing metadata about the backup.
Errors
- If sending messages to the packer fails
- If the index file cannot be serialized
- If time conversion fails
BackupOptions
Configuration options for the backup operation.Filename to use when backing up from stdin.
Call the given command and use its output as stdin.
Manually set the backup path in the snapshot.
Don’t scan the backup source for its size. This disables ETA estimation for backup.
Dry-run mode: Don’t write any data or snapshot.
Options for how to use a parent snapshot.
Options for how to save entries from a local source.
Files and patterns to exclude from backup.
Options for how to filter files from a local source.
ParentOptions
Options for using parent snapshots during backup.Group snapshots by any combination of host, label, paths, tags to find a suitable parent.
Default: host, label, paths.
Snapshot(s) to use as parent. Can be specified multiple times.
Skip writing the snapshot if nothing changed compared to the parent snapshot.
Use no parent, read all files.
Ignore ctime changes when checking for modified files.
Ignore inode number changes when checking for modified files.
PathList
Represents a list of paths to backup.- for stdin or file paths.
Example
Notes
- The backup process uses deduplication to avoid storing duplicate data
- Parent snapshots are used to detect unchanged files
- Backup supports reading from stdin using
-as the source path - Use
dry_runto test backup operations without writing data