删除RESTIC BACKUP快照

RESERIC BACKUPS存储随时间的变化为一系列的服务器的重复"快照"。任何给定的快照都可以在当时还原任何给定的文件。如果您进行了大量的数据更改,则对象存储中的备份可能非常大,有时您希望终于忘记这些更改。您可以从备份中删除快照,并且RESTIC将自动弄清楚需要保留的数据以保持系统的完整备份,但丢弃这些快照中的更改。HostWinds云备份默认为70个快照,但可以更改。

要删除以前的快照,只需要两个命令来运行,"忘记"和"修剪"如何这样做是以下 -

与任何与RESTIC的互动一样,您必须首先初始化REPO以在RESTIC中执行操作。

# restic snapshots
password is correct
ID Date Host Tags Directory
----------------------------------------------------------------------
37f632eb 2018-02-22 11:32:43 hwkb.hostwindsdns.com all_databases.sql
b923eed6 2018-02-22 11:45:17 hwkb.hostwindsdns.com database_dump.sql
----------------------------------------------------------------------
2 snapshots

使用上面的示例,有2个备份。要删除快照,您需要知道快照的ID,这是上述可用快照中的第一个项目。

在此示例中,我们将删除具有ID的第二个快照 B923ED6.

# restic forget b923eed6
password is correct
storage ID 9babef79
removed snapshot b923eed6

接下来,您需要运行Reyic Prune。这删除了从restic存储库中删除的快照中引用的数据,清理未引用的数据。

下面可以看出这一例 -

# restic prune
password is correct
storage ID 9babef79
counting files in repo
building new index for repo
[2:16] 100.00% 11981 / 11981 packs
repository contains 11981 packs (345057 blobs) with 56.676 GiB
processed 345057 blobs: 0 duplicate blobs, 0B duplicate
load all snapshots
find data that is still in use for 1 snapshots
[0:00] 100.00% 1 / 1 snapshots
found 2 of 345057 data blobs still in use, removing 345055 blobs
will remove 0 invalid files
will delete 11979 packs and rewrite 0 packs, this frees 56.664 GiB
counting files in repo
[0:00] 100.00% 2 / 2 packs
finding old index files
saved new indexes as [70561784]
remove 11 old index files
[1:12] 100.00% 11979 / 11979 packs deleted
done

建议在修剪后运行RESEC CHECK,以确保您知道是否有存储库的内部数据结构损坏。

正在运行的命令及其输出与下面的输出类似 -

# restic check
password is correct
create exclusive lock for repository
storage ID e7155fe8
load indexes
check all packs
check snapshots, trees and blobs
no errors were found

现在,当您查看备份快照时,将不再列出所删除的条目。

# restic snapshots
password is correct
ID Date Host Tags Directory
----------------------------------------------------------------------
37f632eb 2018-02-22 11:32:43 hwkb.hostwindsdns.com all_databases.sql
----------------------------------------------------------------------
1 snapshots

VPS1352主机测评网(www.vps1352.com)
本文链接:https://www.vps1352.com/8176.html

7

发表回复