Merge pull request #5243 from zmanda/feat-gh-4868-show-repo-id-in-df-and-mount

mount: append the repository ID to the name of the FUSE mount
This commit is contained in:
Michael Eischer 2025-04-02 21:16:11 +02:00 committed by GitHub
commit 0dffa1208d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1,14 @@
Enhancement: Include repository id in filesystem name used by `mount`
The filesystem created by restic's `mount` command now includes the repository
id in the filesystem name. The repository id is printed by restic when opening
a repository or can be looked up using `restic cat config`.
```
[restic-user@hostname restic]$ df ./test-mount/
Filesystem 1K-blocks Used Available Use% Mounted on
restic:d3b07384d1 0 0 0 - /mnt/my-restic-repo
```
https://github.com/restic/restic/issues/4868
https://github.com/restic/restic/pull/5243

View File

@ -5,6 +5,7 @@ package main
import (
"context"
"fmt"
"os"
"strings"
"time"
@ -148,9 +149,11 @@ func runMount(ctx context.Context, opts MountOptions, gopts GlobalOptions, args
return err
}
fuseMountName := fmt.Sprintf("restic:%s", repo.Config().ID[:10])
mountOptions := []systemFuse.MountOption{
systemFuse.ReadOnly(),
systemFuse.FSName("restic"),
systemFuse.FSName(fuseMountName),
systemFuse.MaxReadahead(128 * 1024),
}