rewrite: Polish documentation
This commit is contained in:
parent
f86ef4d3dd
commit
f175da2756
3 changed files with 41 additions and 35 deletions
|
@ -17,22 +17,23 @@ import (
|
||||||
|
|
||||||
var cmdRewrite = &cobra.Command{
|
var cmdRewrite = &cobra.Command{
|
||||||
Use: "rewrite [flags] [snapshotID ...]",
|
Use: "rewrite [flags] [snapshotID ...]",
|
||||||
Short: "Rewrite existing snapshots",
|
Short: "Rewrite snapshots to exclude unwanted files",
|
||||||
Long: `
|
Long: `
|
||||||
The "rewrite" command excludes files from existing snapshots.
|
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.
|
||||||
|
|
||||||
By default 'rewrite' will create new snapshots that will contains same data as
|
The snapshots to rewrite are specified using the --host, --tag and --path options,
|
||||||
the source snapshots but without excluded files. All metadata (time, host, tags)
|
or by providing a list of snapshot IDs. Please note that specifying neither any of
|
||||||
will be preserved. The special tag 'rewrite' will be added to new snapshots to
|
these options nor a snapshot ID will cause the command to rewrite all snapshots.
|
||||||
distinguish it from the source (unless --forget is used).
|
|
||||||
|
|
||||||
If --forget option is used, old snapshot will be removed from repository.
|
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.
|
||||||
|
|
||||||
Snapshots to rewrite are specified using --host, --tag, --path or by providing
|
Please note that the --forget option only removes the snapshots and not the actual
|
||||||
a list of snapshot ids. Not specifying a snapshot id will rewrite all snapshots.
|
data stored in the repository. In order to delete the no longer referenced data,
|
||||||
|
use the "prune" command.
|
||||||
Please note, that this command only creates new snapshots. In order to delete
|
|
||||||
data from the repository use 'prune' command.
|
|
||||||
|
|
||||||
EXIT STATUS
|
EXIT STATUS
|
||||||
===========
|
===========
|
||||||
|
@ -60,7 +61,7 @@ func init() {
|
||||||
cmdRoot.AddCommand(cmdRewrite)
|
cmdRoot.AddCommand(cmdRewrite)
|
||||||
|
|
||||||
f := cmdRewrite.Flags()
|
f := cmdRewrite.Flags()
|
||||||
f.BoolVarP(&rewriteOptions.Forget, "forget", "", false, "replace existing snapshots")
|
f.BoolVarP(&rewriteOptions.Forget, "forget", "", false, "remove original snapshots after creating new ones")
|
||||||
f.BoolVarP(&rewriteOptions.DryRun, "dry-run", "n", false, "do not do anything, just print what would be done")
|
f.BoolVarP(&rewriteOptions.DryRun, "dry-run", "n", false, "do not do anything, just print what would be done")
|
||||||
|
|
||||||
initMultiSnapshotFilterOptions(f, &rewriteOptions.snapshotFilterOptions, true)
|
initMultiSnapshotFilterOptions(f, &rewriteOptions.snapshotFilterOptions, true)
|
||||||
|
|
|
@ -141,7 +141,7 @@ Filtering snapshots to copy
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
The list of snapshots to copy can be filtered by host, path in the backup
|
The list of snapshots to copy can be filtered by host, path in the backup
|
||||||
and / or a comma-separated tag list:
|
and/or a comma-separated tag list:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
|
@ -179,9 +179,11 @@ Note that it is not possible to change the chunker parameters of an existing rep
|
||||||
Removing files from snapshots
|
Removing files from snapshots
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
Sometimes a backup includes more files that intended. Instead of removing the snapshot,
|
Snapshots sometimes turn out to include more files that intended. Instead of
|
||||||
it is possible to rewrite its contents to remove the files in question. For this you
|
removing the snapshots entirely and running the corresponding backup commands
|
||||||
can use the ``rewrite`` command:
|
again (which is not always practical after the fact) it is possible to remove
|
||||||
|
the unwanted files from affected snapshots by rewriting them using the
|
||||||
|
``rewrite`` command:
|
||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
|
@ -190,7 +192,7 @@ can use the ``rewrite`` command:
|
||||||
|
|
||||||
snapshot 6160ddb2 of [/home/user/work] at 2022-06-12 16:01:28.406630608 +0200 CEST)
|
snapshot 6160ddb2 of [/home/user/work] at 2022-06-12 16:01:28.406630608 +0200 CEST)
|
||||||
excluding /home/user/work/secret-file
|
excluding /home/user/work/secret-file
|
||||||
new snapshot saved as b6aee1ff7f5e0ac15157f16370015978e496fa60f7351bc94a8d6049e4c7096d
|
saved new snapshot b6aee1ff
|
||||||
|
|
||||||
snapshot 4fbaf325 of [/home/user/work] at 2022-05-01 11:22:26.500093107 +0200 CEST)
|
snapshot 4fbaf325 of [/home/user/work] at 2022-05-01 11:22:26.500093107 +0200 CEST)
|
||||||
|
|
||||||
|
@ -201,29 +203,32 @@ can use the ``rewrite`` command:
|
||||||
|
|
||||||
snapshot 6160ddb2 of [/home/user/work] at 2022-06-12 16:01:28.406630608 +0200 CEST)
|
snapshot 6160ddb2 of [/home/user/work] at 2022-06-12 16:01:28.406630608 +0200 CEST)
|
||||||
excluding /home/user/work/secret-file
|
excluding /home/user/work/secret-file
|
||||||
new snapshot saved as b6aee1ff7f5e0ac15157f16370015978e496fa60f7351bc94a8d6049e4c7096d
|
new snapshot saved as b6aee1ff
|
||||||
|
|
||||||
modified 1 snapshots
|
modified 1 snapshots
|
||||||
|
|
||||||
The options ``--exclude``, ``--exclude-file``, ``--iexclude`` and ``--iexclude-file`` are
|
The options ``--exclude``, ``--exclude-file``, ``--iexclude`` and
|
||||||
supported. They behave the same way as for the backup command, see :ref:`backup-excluding-files`
|
``--iexclude-file`` are supported. They behave the same way as for the backup
|
||||||
for details.
|
command, see :ref:`backup-excluding-files` for details.
|
||||||
|
|
||||||
It is possible to only rewrite a subset of snapshots. Filtering the snapshots works the
|
It is possible to rewrite only a subset of snapshots by filtering them the same
|
||||||
same way as for the ``copy`` command, see :ref:`copy-filtering-snapshots`.
|
way as for the ``copy`` command, see :ref:`copy-filtering-snapshots`.
|
||||||
|
|
||||||
By default, the ``rewrite`` command will keep the original snapshot and create a new
|
By default, the ``rewrite`` command will keep the original snapshots and create
|
||||||
snapshot for every snapshot which was modified while rewriting. All new snapshots are
|
new ones for every snapshot which was modified during rewriting. The new
|
||||||
marked with the tag ``rewrite``.
|
snapshots are marked with the tag ``rewrite`` to differentiate them from the
|
||||||
|
original, rewritten snapshots.
|
||||||
|
|
||||||
Alternatively, you can use the ``--forget`` option to immediatelly remove the original
|
Alternatively, you can use the ``--forget`` option to immediately remove the
|
||||||
snapshot. In this case, no tag is added to the snapshots. Please note that only the
|
original snapshots. In this case, no tag is added to the new snapshots. Please
|
||||||
original snapshot file is removed from the repository, but not the excluded data.
|
note that this only removes the snapshots and not the actual data stored in the
|
||||||
Run the ``prune`` command afterwards to cleanup the now unused data.
|
repository. Run the ``prune`` command afterwards to remove the now unreferenced
|
||||||
|
data (just like when having used the ``forget`` command).
|
||||||
|
|
||||||
In order to preview the changes which ``rewrite`` would make, you can use the ``--dry-run``
|
In order to preview the changes which ``rewrite`` would make, you can use the
|
||||||
option. This will simulate the rewriting process without actually modifying the repository.
|
``--dry-run`` option. This will simulate the rewriting process without actually
|
||||||
Instead restic will only print the expected changes.
|
modifying the repository. Instead restic will only print the actions it would
|
||||||
|
perform.
|
||||||
|
|
||||||
|
|
||||||
Checking integrity and consistency
|
Checking integrity and consistency
|
||||||
|
|
|
@ -38,7 +38,7 @@ Usage help is available:
|
||||||
rebuild-index Build a new index
|
rebuild-index Build a new index
|
||||||
recover Recover data from the repository not referenced by snapshots
|
recover Recover data from the repository not referenced by snapshots
|
||||||
restore Extract the data from a snapshot
|
restore Extract the data from a snapshot
|
||||||
rewrite Rewrite existing snapshots
|
rewrite Rewrite snapshots to exclude unwanted files
|
||||||
self-update Update the restic binary
|
self-update Update the restic binary
|
||||||
snapshots List all snapshots
|
snapshots List all snapshots
|
||||||
stats Scan the repository and show basic statistics
|
stats Scan the repository and show basic statistics
|
||||||
|
|
Loading…
Reference in a new issue