Restic 快速入门:本地备份
初始化备份
为了可以在 /srv/restic-repo 创建一个本地存储库,请运行以下命令并输入相同的密码两次:
restic init --repo /srv/restic-repo
enter password for new repository:
enter password again:
created restic repository 085b3c76b9 at /srv/restic-repo
Please note that knowledge of your password is required to access the repository.
Losing your password means that your data is irrecoverably lost.警告:记住密码很重要!如果丢失密码,您将无法访问存储库中存储的数据。
[root@~]# ls
config  data  index  keys  locks  snapshots备份操作
执行数据备份
# 将 /www 目录备份到 /srv/restic-repo 备份存储库
$ restic -r /srv/restic-repo --verbose backup /etc查看备份
$ restic -r /srv/restic-repo snapshots
enter password for repository:
repository 69401019 opened (version 2, compression level auto)
ID        Time                 Host              Tags        Paths  Size
------------------------------------------------------------------------------
4a793a10  2024-08-19 14:22:06  XSZHPJ-LSB-Nginx              /etc   29.182 MiB查看备份内容
$ restic -r /srv/restic-repo ls 4a793a10恢复快照
$ restic -r /srv/restic-repo restore 4a793a10 -t ./
# 或者
$ restic -r /srv/restic-repo restore 4a793a10 --target ./删除备份
$ restic -r /srv/restic-repo forget 4a793a10定时备份
作者:Jeebiz  创建时间:2024-08-19 14:05
最后编辑:Jeebiz 更新时间:2025-10-29 10:08
最后编辑:Jeebiz 更新时间:2025-10-29 10:08
