Hostwinds VPS教程:如何删除restic备份快照

Hostwinds是一家知名的美国主机商,国内站长使用较多的是美国VPS主机,其VPS产品方案多样,支持全球CDN加速,国内外用户访问速度都比较快。Hostwinds云备份默认有60个快照,restic备份存储随着时间推移形成重复快照,需要删除。下面就来看下删除restic备份快照的操作步骤。

1、我们要想删除以前的快照,将会用到forget和prune两个命令。首先我们登录到Hostwinds VPS主机,然后初始化repo以能够在restic中执行操作,相关运行命令及输出结果如下。

# restic snapshots

password is correct

ID Date Host Tags Directory

———————————————————————-

37f632eb 2021-06-04 11:32:43 hwkb.hostwindsdns.com all_databases.sql

b923eed6 2021-06-04 11:45:17 hwkb.hostwindsdns.com database_dump.sql

———————————————————————-

2 snapshots

2、使用上面命令,在输出中我们可以看到有2个备份。要删除快照,还需要知道快照的ID。在此示例中,我们将删除具有ID的第二个快照b923eed6,运行命令如下。

# restic forget b923eed6

password is correct

storage ID 9babef79

removed snapshot b923eed6

3、接下来,您需要运行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

建议在修剪后运行restic 检查,以确保您存储库的内部数据结构没有损坏。

# restic check

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

# restic snapshots

更多教程:Hostwinds教程

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注