rewrite

Section profile.rewrite

This section configures restic command rewrite available since 0.15.0 . Information on command and flags is copied from the restic manual pages.

The “rewrite” command excludes files from existing snapshots. It creates new snapshots containing the same data as the original ones, but without the files you specify to exclude. All metadata (time, host, tags) will be preserved.

The snapshots to rewrite are specified using the –host, –tag and –path options, or by providing a list of snapshot IDs. Please note that specifying neither any of these options nor a snapshot ID will cause the command to rewrite all snapshots.

The special tag ‘rewrite’ will be added to the new snapshots to distinguish them from the original ones, unless –forget is used. If the –forget option is used, the original snapshots will instead be directly removed from the repository.

Please note that the –forget option only removes the snapshots and not the actual data stored in the repository. In order to delete the no longer referenced data, use the “prune” command.

Flags used by resticprofile only:
NameTypeDefaultNotes
run-afterone or more stringsRun shell command(s) after a successful restic command
run-after-failone or more stringsRun shell command(s) after failed restic or shell commands
run-beforeone or more stringsRun shell command(s) before a restic command
run-finallyone or more stringsRun shell command(s) always, after all other commands
Flags passed to the restic command line:
NameTypeDefaultNotes
dry-runtrue / falsefalsedo not do anything, just print what would be done. restic >= 0.15.0
excludeone or more stringsexclude a pattern. restic >= 0.15.0
exclude-fileone or more stringsread exclude patterns from a file. restic >= 0.15.0
forgettrue / falsefalseremove original snapshots after creating new ones. restic >= 0.15.0
hosttrue / false OR one or more hostnamesonly consider snapshots for this host (can be specified multiple times) (default: $RESTIC_HOST). Boolean true is replaced with the hostname of the system. Examples: true, false, "host" . restic >= 0.15.0
iexcludeone or more stringssame as –exclude pattern but ignores the casing of filenames. restic >= 0.15.0
iexclude-fileone or more stringssame as –exclude-file but ignores casing of filenames in patterns. restic >= 0.15.0
new-hoststring""replace hostname. restic >= 0.17.0
new-timestring""replace time of the backup. restic >= 0.17.0
pathtrue / false OR one or more stringsonly consider snapshots including this (absolute) path (can be specified multiple times, snapshots must include all specified paths). Boolean true is replaced with the paths from section “backup”. Examples: true, false, "path" . restic >= 0.15.0
tagtrue / false OR one or more stringsonly consider snapshots including tag[,tag,…]. Boolean true is replaced with the tags from section “backup”. Examples: true, false, "tag" . restic >= 0.15.0
Tip

Flags declared for the restic command line in section profile can be overridden in this section.