In-waiting for Pruning rewrite snapshots to prune, and “not wanting to mix a new pruning with those months-old prunes”, I’d like to attach e.g. a rewrite-2024-04-17
tag to those new rewrites.
Would that be possible?
In-waiting for Pruning rewrite snapshots to prune, and “not wanting to mix a new pruning with those months-old prunes”, I’d like to attach e.g. a rewrite-2024-04-17
tag to those new rewrites.
Would that be possible?
I guess you’re looking for Method to discern between previous and current rewritten snapshots · Issue #4055 · restic/restic · GitHub .
Yes, probably I need this here Pruning rewrite snapshots - #2 by MichaelEischer AND also there’s a new rewrite I want to do as of recent
So I was hoping to “prune now” the year-old snapshots, and “prune a month later” or something the redundant snapshots of the new rewrite.
You can use the tag
command to replace the rewrite
tag of all snapshots with a different one: restic rewrite --tag rewrite --remove rewrite --add rewrite-2024-04-17
.
Idk; that doesn’t seem to work:
$ restic rewrite --tag rewrite --remove rewrite --add rewrite-pre-2024-04
unknown flag: --remove
$ restic rewrite -h
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.
EXIT STATUS
===========
Exit status is 0 if the command was successful, and non-zero if there was any error.
Usage:
restic rewrite [flags] [snapshotID ...]
Flags:
-n, --dry-run do not do anything, just print what would be done
-e, --exclude pattern exclude a pattern (can be specified multiple times)
--exclude-file file read exclude patterns from a file (can be specified multiple times)
--forget remove original snapshots after creating new ones
-h, --help help for rewrite
-H, --host host only consider snapshots for this host (can be specified multiple times)
--iexclude pattern same as --exclude pattern but ignores the casing of filenames
--iexclude-file file same as --exclude-file but ignores casing of filenames in patterns
--path path only consider snapshots including this (absolute) path (can be specified multiple times)
--tag tag[,tag,...] only consider snapshots including tag[,tag,...] (can be specified multiple times) (default [])
Global Flags:
--cacert file file to load root certificates from (default: use system certificates or $RESTIC_CACERT)
--cache-dir directory set the cache directory. (default: use system default cache directory)
--cleanup-cache auto remove old cache directories
--compression mode compression mode (only available for repository format version 2), one of (auto|off|max) (default: $RESTIC_COMPRESSION) (default auto)
--insecure-tls skip TLS certificate verification when connecting to the repository (insecure)
--json set output mode to JSON for commands that support it
--key-hint key key ID of key to try decrypting first (default: $RESTIC_KEY_HINT)
--limit-download rate limits downloads to a maximum rate in KiB/s. (default: unlimited)
--limit-upload rate limits uploads to a maximum rate in KiB/s. (default: unlimited)
--no-cache do not use a local cache
--no-extra-verify skip additional verification of data before upload (see documentation)
--no-lock do not lock the repository, this allows some operations on read-only repositories
-o, --option key=value set extended option (key=value, can be specified multiple times)
--pack-size size set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
--password-command command shell command to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)
-p, --password-file file file to read the repository password from (default: $RESTIC_PASSWORD_FILE)
-q, --quiet do not output comprehensive progress report
-r, --repo repository repository to backup to or restore from (default: $RESTIC_REPOSITORY)
--repository-file file file to read the repository location from (default: $RESTIC_REPOSITORY_FILE)
--retry-lock duration retry to lock the repository if it is already locked, takes a value like 5m or 2h (default: no retries)
--tls-client-cert file path to a file containing PEM encoded TLS client certificate and private key (default: $RESTIC_TLS_CLIENT_CERT)
-v, --verbose be verbose (specify multiple times or a level using --verbose=n, max level/times is 2)
$ restic version
restic 0.16.4 compiled with go1.21.6 on linux/amd64
… also -h
doesn’t seem to list things specifically about the command.
--tag
exists because it’s a generic filter, but neither --remove
nor --add
exist:
$ restic rewrite -h | grep remove
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
--forget remove original snapshots after creating new ones
--cleanup-cache auto remove old cache directories
$ restic rewrite -h | grep add
The special tag 'rewrite' will be added to the new snapshots to distinguish
--no-extra-verify skip additional verification of data before upload (see documentation)
Also docs have only 3 matches with rewrite (with the same problem as restic -h
): Search — restic 0.16.4 documentation
@stdedos The command should have been restic tag --tag rewrite --remove rewrite --add rewrite-2024-04-17
(tag
command instead of rewrite
). Sorry for the typo.