💽

resticでlinuxのhomeをバックアップ管理

に公開

snapshots

:) restic snapshots -r /mnt/bk_disk/bk_may/
enter password for repository: 
repository 298a3fc8 opened (version 2, compression level auto)
created new cache in /home/alice/.cache/restic
ID        Time                 Host             Tags        Paths        Size
------------------------------------------------------------------------------------
5d3d5b2b  2026-05-12 15:30:28  aliceisthinking              /home/alice  66.013 GiB
3567debd  2026-05-13 13:32:02  aliceisthinking              /home/alice  63.477 GiB
bbdec0ee  2026-05-13 14:00:41  aliceisthinking              /home/alice  48.931 GiB
379428a5  2026-05-13 14:35:21  aliceisthinking              /home/alice  84.309 GiB
f8188612  2026-05-15 22:48:26  aliceisthinking              /home/alice  101.409 GiB
60618f62  2026-05-15 22:50:15  aliceisthinking              /home/alice  86.794 GiB
------------------------------------------------------------------------------------
6 snapshots

mount backups

そのままでは読み取れないのでrestic mountによって通常のファイルとして読めるようにする。

mount 展開先 -r バックアップrepo

:) mkdir -p ~/mnt/bk_mount
~ 
:) restic mount ~/mnt/bk_mount/ -r /mnt/bk_disk/bk_may/

最新のバックアップはxxx/snapshots/latest/home/{user-name}/にある。

:) eza -l --icons=always ~/mnt/bk_mount/snapshots/latest/home/alice/
.rw-r--r--@ 1.7M alice 14 May 18:47 '2026-05-14 18-47-26.mp4'
.rw-r--r--@ 8.5M alice 14 May 18:50 '2026-05-14 18-47-262.mov'
.rw-r--r--@ 8.5M alice 14 May 18:50 '2026-05-14 18-47-262.mp4'
drwxr-xr-x@    - alice 13 May 15:03 Desktop
drwxr-xr-x@    - alice 11 May 17:13 Develop
drwxr-xr-x@    - alice 14 May 16:56 󰲂 Documents
drwxr-xr-x@    - alice 14 May 16:02 dotfiles
drwxr-xr-x@    - alice 14 May 17:49 󰉍 Downloads
drwxr-xr-x@    - alice 14 May 15:44 ghq
drwxr-xr-x@    - alice 12 May 17:26 go
.rw-r--r--@   80 alice 14 May 18:03 hello.c
drwxr-xr-x@    - alice 12 May 15:47 󱍙 Music
drwxr-xr-x@    - alice 10 May 01:07 my_apps
drwxr-xr-x@    - alice 13 May 14:12 󰉏 Pictures
drwxr-xr-x@    - alice 12 May 15:47 Public
.rw-r--r--@ 671k alice 13 May 14:33 rmlint.json
drwxr-xr-x@    - alice 12 May 15:47 Templates
drwxr-xr-x@    - alice 12 May 16:16 Videos

個人的にはresoreやるより手動で移行するファイル/ディレクトリを移動する方が安心。雑にバックアップを取るせいで安易に戻せないのもそうですが。

おまけ GUIクライアントもあるよ

https://flathub.org/en/apps/org.gnome.DejaDup

Déjà DupというresticをバックエンドとしたGUIクライアントもあります。入れるのが面倒でやめましたがこっちの方が手軽かも

Discussion