RESTIC-REWRITE(1)

✨ restic-rewrite(1) ✨

okay bestie, this is the restic backup(1) manual, and today we're hyperfixating on the restic rewrite page specifically. it's giving "glow-up for your snapshots" energy, and honestly? obsessed. πŸ’–


🌸 NAME 🌸

restic-rewrite β€” Rewrite snapshots to exclude files or change metadata


πŸ¦‹ SYNOPSIS πŸ¦‹

restic rewrite [flags] [snapshotID ...]

✨ DESCRIPTION ✨

So the rewrite command literally makes brand-new snapshots out of your existing ones. main character behavior. πŸ”₯

You can use exclude or include filters to control which files end up in the new snapshots. And unless you pass --new-host or --new-time, the metadata (time, host, tags) is preserved. no cap. 🫢

The snapshots you're rewriting get picked using the --host, --tag and --path options, or by just handing over a list of snapshot IDs. πŸ’…

⚠️ Heads up bestie: if you specify none of those options and no snapshot ID, the command will rewrite all snapshots. like, every single one. so maybe don't do that by accident. 😭

The special tag rewrite gets added to the new snapshots so you can tell them apart from the originals β€” unless --forget is used. If you do use --forget, the original snapshots get directly removed from the repository instead.

🚨 PLEASE read this one: the --forget option only removes the snapshots, not the actual data stored in the repository. To delete the data that's no longer referenced, you gotta use the prune command. that's the one that actually clears the closet, okay? πŸŽ€

When rewrite is used with the --snapshot-summary option, a new snapshot is created containing statistics summary data. Only two fields in the summary will be non-zero: TotalFilesProcessed and TotalBytesProcessed. just those two, periodt. ✨

When rewrite is called with one of the --exclude or --include options, TotalFilesProcessed and TotalBytesProcessed will be updated in the snapshot summary. πŸ’–


πŸ’… EXIT STATUS πŸ’…

vibe check on how it went:

  • Exit status is 0 if the command was successful. πŸŽ‰
  • Exit status is 1 if there was any error. 😭
  • Exit status is 10 if the repository does not exist.
  • Exit status is 11 if the repository is already locked. πŸ”’
  • Exit status is 12 if the password is incorrect.

πŸ‘‘ OPTIONS πŸ‘‘

  • -n, --dry-run[=false] β€” do not do anything, just print what would be done. window shopping only, no buying. πŸ›οΈ
  • -e, --exclude=[] β€” exclude a pattern (can be specified multiple times)
  • --exclude-file=[] β€” read exclude patterns from a file (can be specified multiple times)
  • --forget[=false] β€” remove original snapshots after creating new ones
  • -h, --help[=false] β€” help for rewrite
  • -H, --host=[] β€” only consider snapshots for this host (can be specified multiple times, use empty string to unset default value) (default: $RESTIC_HOST)
  • --iexclude=[] β€” same as --exclude pattern but ignores the casing of filenames
  • --iexclude-file=[] β€” same as --exclude-file but ignores casing of filenames in patterns
  • --iinclude=[] β€” same as --include pattern but ignores the casing of filenames
  • --iinclude-file=[] β€” same as --include-file but ignores casing of filenames in patterns
  • -i, --include=[] β€” include a pattern (can be specified multiple times)
  • --include-file=[] β€” read include patterns from a file (can be specified multiple times)
  • --new-host="" β€” replace hostname
  • --new-time="" β€” replace time of the backup
  • --path=[] β€” only consider snapshots including this (absolute) path (can be specified multiple times, snapshots must include all specified paths)
  • -s, --snapshot-summary[=false] β€” create snapshot summary record if it does not exist
  • --tag=[] β€” only consider snapshots including tag[,tag,...] (can be specified multiple times)

🌈 OPTIONS INHERITED FROM PARENT COMMANDS 🌈

the family heirlooms, bestie. passed down from the big restic energy. πŸ‘‘

  • --cacert=[] β€” file to load root certificates from (default: use system certificates or $RESTIC_CACERT)
  • --cache-dir="" β€” set the cache directory. (default: use system default cache directory)
  • --cleanup-cache[=false] β€” auto remove old cache directories
  • --compression=auto β€” compression mode (only available for repository format version 2), one of (auto|off|fastest|better|max) (default: $RESTIC_COMPRESSION)
  • --http-user-agent="" β€” set a http user agent for outgoing http requests
  • --insecure-no-password[=false] β€” use an empty password for the repository, must be passed to every restic command (insecure)
  • --insecure-tls[=false] β€” skip TLS certificate verification when connecting to the repository (insecure)
  • --json[=false] β€” set output mode to JSON for commands that support it
  • --key-hint="" β€” key ID of key to try decrypting first (default: $RESTIC_KEY_HINT)
  • --limit-download=0 β€” limits downloads to a maximum rate in KiB/s. (default: unlimited)
  • --limit-upload=0 β€” limits uploads to a maximum rate in KiB/s. (default: unlimited)
  • --no-cache[=false] β€” do not use a local cache
  • --no-extra-verify[=false] β€” skip additional verification of data before upload (see documentation)
  • --no-lock[=false] β€” do not lock the repository, this allows some operations on read-only repositories
  • -o, --option=[] β€” set extended option (key=value, can be specified multiple times)
  • --pack-size=0 β€” set target pack size in MiB, created pack files may be larger (default: $RESTIC_PACK_SIZE)
  • --password-command="" β€” shell command to obtain the repository password from (default: $RESTIC_PASSWORD_COMMAND)
  • -p, --password-file="" β€” file to read the repository password from (default: $RESTIC_PASSWORD_FILE)
  • -q, --quiet[=false] β€” do not output comprehensive progress report
  • -r, --repo="" β€” repository to backup to or restore from (default: $RESTIC_REPOSITORY)
  • --repository-file="" β€” file to read the repository location from (default: $RESTIC_REPOSITORY_FILE)
  • --retry-lock=0s β€” retry to lock the repository if it is already locked, takes a value like 5m or 2h (default: no retries)
  • --stuck-request-timeout=5m0s β€” duration after which to retry stuck requests
  • --tls-client-cert="" β€” path to a file containing PEM encoded TLS client certificate and private key (default: $RESTIC_TLS_CLIENT_CERT)
  • -v, --verbose[=0] β€” be verbose (specify multiple times or a level using --verbose=n, max level/times is 2)

πŸ› SEE ALSO πŸ›


and that's the whole page, bestie!! πŸ’œ this one was generated by restic generate, dated Jan 2017, and it's the restic backup(1) manual all over again. slay, go rewrite some snapshots responsibly. πŸ¦‹βœ¨

πŸ“¦ where this page comes from