--path option problem

The following backup is done by the Restic version 0.14.0 and I am trying to restore a file from the repository by the Restic version 0.17.3

This is the command

restic restore da5a4d3e --repo rclone:gdrive:/backup --password-file /home/joe/.backup_password --path /home/joe/bin/mem --target /home/joe/t

And it gives the following output:

repository 9a03e76e opened (version 2, compression level auto)
[0:00] 100.00% 2 / 2 index files loaded
restoring snapshot da5a4d3e of [/] at 2024-11-21 11:15:24.329740814 -0500 EST by root@site.com to /home/joe/t

Why the path is shown as [/] instead of [/home/joe/bin/mem] and the command will restore the whole repository instead of the requested file “mem” ?

1 Like

Accoding to the docs you can use restic restore <snapshot>:<folder>if you want to restore a single folder.

If you want to restore a single file you can use the dump command like this.

restic \
  --repo rclone:gdrive:/backup \
  --password-file /home/joe/.backup_password  \
  dump \
  da5a4d3e \
  /home/joe/bin/mem > /home/joe/t
1 Like

It just shows the paths in the snapshot.

9fa48cd7  2024-11-22 08:50:09  micro                   /boot       32.615 GiB
                                                       /etc
                                                       /home
                                                       /root
                                                       /usr/local
                                                       /var
[09:00:25] root :: micro  ➜  ~ » restic restore latest --include /home/tim/cheer_sadness --target /tmp                                                                                                              1 ↵
repository 275592a4 opened (version 2, compression level max)
[0:03] 100.00%  173 / 173 index files loaded
restoring snapshot 9fa48cd7 of [/etc /var /home /root /usr/local /boot] at 2024-11-22 08:50:09.058215501 +1300 NZDT by root@micro to /tmp
Summary: Restored 3 / 1 files/dirs (5.396 KiB / 5.396 KiB) in 0:00
[09:00:41] root :: micro  ➜  ~ » ls -la /tmp/home/tim/cheer_sadness 
-rw-r--r-- 1 tim tim 5526 Feb  9  2024 /tmp/home/tim/cheer_sadness

Where it says “Restoring snapshot” it’s just showing all the paths IN the snapshot.

Does that help?

Use --include tell restic what files/paths you want.

1 Like

Thank you for the replies.

I think I misunderstood the --path option when used with the “restore” command. It cannot be a single filename, but rather a directory name unless the snapshot is just a single file.

There was also some other problems with the parameters but when I replaced the repository and password parameters to environment variables the thing started to work.

So problem solved.

1 Like

--path is used to select snapshots when using latest as snapshot name. However, as da5a4d3e is already a specific snapshot, the --path option has no effect.