io/fs: {mount,overlay}fs

236 views
Skip to first unread message

Sebastien Binet

unread,
Mar 12, 2021, 2:05:04 PM3/12/21
to golan...@googlegroups.com
hi there,

I am looking for an io/fs.FS-based package that can "mount" a provided
io/fs.FS filesystem under some directory on some other io/fs.FS.

ie: more or less the io/fs equivalent of:
$> mount /dev/sd4 /mnt/sub/dir

subtree := os.DirFS("/path/to/some/dir")
_, _ = subtree.Open("file1.txt") // ok: /path/to/some/dir/file1.txt

root := os.DirFS("/")
root, err := mountfs.Mount(root, "/mnt/sub/dir", subtree)
_, _ = root.Open("/mnt/sub/dir/file1.txt") // ok.

I know of mergefs[1], but that's not quite what I want (even if it's
probably part of the solution...)

Anybody already coded that up?
(I've tried various combinations of "io/fs" with "merge/overlay", to no
avail.)

thanks,
-s

[1]: https://github.com/laher/mergefs

Reply all
Reply to author
Forward
0 new messages