Skip to content

Introduce path mapping for backup and restore commands #5639

@vitonsky

Description

@vitonsky

Output of restic version

restic 0.16.4 compiled with go1.22.2 on linux/amd64

What should restic do differently? Which functionality do you think we should add?

Add option to set a virtual path of target file/directory.

Examples how it could work:

  • restic backup ./foo/bar --vpath /x would backup whole files in directory ./foo/bar and save it in directory /x
  • restic restore 00000000 -t ./ would restore files i've backup above to a directory ./x
  • restic restore 00000000 -t ./ --vpath /y/z would restore files i've backup above to a directory ./y/z

What are you trying to do? What problem would this solve?

First of all, I consider my file system structure as sensitive information. Currently Restic compromising my system when i run restic snapshots since there are listed full paths of my backups.

The more imprtant point is restic UX feels bad when I trying to restore backups, because when i run restic restore 00000000 -t ./ I expect whole content of directory from backup will be saved in directory ./, but currently it works different and files will be saved as ./ + path in snapshot.

For example, if i have directory ./foo/bar/baz/image.jpeg and i run restic backup ./foo/bar then restic restore 00000000 -t ./test i will have structure like ./test/foo/bar/baz/image.jpeg.

That is bad, because i have to go through whole path to just check my image.

Additionally I have concerns about path sizes that may be created via current approach, because file path have limitations in different OS. I did not tested this problem, so it's only potential problem i imagine.

Did restic help you today? Did it make you happy in any way?

Recently I've compare a borg and restic for my personal purposes. I had choose restic because it looks simpler.
I've seen opinions that compression in borg may squeeze better on some payloads, but for me as user the UX is more important if difference in performance is not too critical.

I hope you will consider this feature to implement, because in my opinion that's quite significant improvement, and it looks not very difficult to implement.

Btw, I've tried to invent any workaround like use proot and I've got failure in my attempts. The problem is all potential solutions require a root privileges or creation of temporary directory that is unacceptable by security and privacy reasons. So it looks the best place to implement this feature is Restic itself. All we need is to add flag and trim/replace paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions