borg icon indicating copy to clipboard operation
borg copied to clipboard

Feature Request - List borgfs mounts

Open wolfpackmars2 opened this issue 8 years ago • 3 comments

borg mount

In addition to displaying help and usage for the mount command, borg mount can list the currently mounted borg filesystems.

Here is shell command which produces clean output: mount | grep borgfs | sed -e 's/borgfs on \(.*\) type.*/\1/'

output would be: /mount/your-mount-point

Here is a python one-liner which does the same without requiring any new imports to archiver.py:

print(re.sub(r".*borgfs (.*) fuse ro,.*", "\\1", "\n".join(s for s in open('/proc/mounts').read().split('\n') if 'borgfs' in s)))

If interested I can clean up the one-liner and create a PR. Since this just reads /proc/mounts, this won't work with Windows (not sure about cygwin).

This is easy to test in python shell:

import re
print(re.sub(r".*borgfs (.*) fuse ro,.*", "\\1", "\n".join(s for s in open('/proc/mounts').read().split('\n') if 'borgfs' in s)))

wolfpackmars2 avatar Jun 01 '17 08:06 wolfpackmars2

Good idea.

A slight problem here might be portability - this should work on all platforms where we support FUSE:

  • linux
  • freebsd
  • macOS

For the PR: please no one-liners, but rather well readable code.

ThomasWaldmann avatar Jun 01 '17 12:06 ThomasWaldmann

For the PR: please no one-liners, but rather well readable code.

Ofc. :)

wolfpackmars2 avatar Jun 01 '17 16:06 wolfpackmars2

There is no /proc/mounts on FreeBSD unless you have Linux compatibility loaded, in which case it exists as /compat/linux/proc/mounts

I don't have experience with MacOS, but I'm sure it doesn't have /proc at all.

Jamie-Landeg-Jones avatar Apr 27 '25 02:04 Jamie-Landeg-Jones