使い方
$ mkdir ~/tmp
$ cp /etc/hosts ~/tmp
このディレクトリ/tmp/restic-repoにバックアップが保存される
$ restic -r /tmp/restic-repo init
enter password for new repository: enter password again: created restic repository eb84c7bec1 at /tmp/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.
ホームディレクトリの/tmpのバックアップする
$ restic -r /tmp/restic-repo backup ~/tmp
enter password for repository: repository eb84c7be opened successfully, password is correct created new cache in /home/ckenko25/.cache/restic Files: 1 new, 0 changed, 0 unmodified Dirs: 2 new, 0 changed, 0 unmodified Added to the repo: 1.364 KiB processed 1 files, 267 B in 0:00 snapshot 5da80232 saved
バックアップのsnapshotを確認してIDを調べる
$ restic -r /tmp/restic-repo snapshots
enter password for repository: repository eb84c7be opened successfully, password is correct ID Time Host Tags Paths ------------------------------------------------------------------------- 5da80232 2021-09-13 07:43:07 deskmini /home/ckenko25/tmp ------------------------------------------------------------------------- 1 snapshots
restic -r /tmp/restic-repo restore <上記のsnapshotのID> –target <リストアしたいディレクトリ>
ホームディレクトリの/tmp1にリストアされる
$ restic -r /tmp/restic-repo restore 5da80232 –target ~/tmp1
enter password for repository: repository eb84c7be opened successfully, password is correct restoring <Snapshot 5da80232 of [/home/ckenko25/tmp] at 2021-09-13 07:43:07.871039667 +0900 JST by ckenko25@deskmini> to /home/ckenko25/tmp1
$ cd ~/tmp1
$ ls ~/tmp1
コメント