0

Obviously a noob question, but I'm playing with mounting a webdav folder in Linux, and trying to tell if the davfs is already installed. Googling shows this command to supposedly list all installed filesystems:

cat /proc/filesystems

Problem is, running that command before installing davfs (not shown in the screenshot) and after installing (shown), shows the exact same list of installed fs', which does not show davfs:

enter image description here

Is there a better way to show if davfs is in fact, installed?

3 Answers 3

1

Since you use apt for the install, you may simply search it:

apt search davfs

davfs2/stable 1.5.5-1 amd64
  mount a WebDAV resource as a regular file system

As you can see, in my case the package is found in the repositories, but not installed. In contrast to e.g. vim:

 apt search vim 

vim/stable,now 2:8.1.0875-5 amd64 [installed]
  Vi IMproved - enhanced vi editor

Alternatively (and a bit more save - it will also apply to packages not from the repositories but also manually installed via .deb-files) use dpgk to list all local and grep the package name

dpkg -l | grep davfs

(empty in my case)

dpkg -l | grep vim

ii  vim    2:8.1.0875-5   amd64  Vi IMproved - enhanced vi editor

Where ii indicates "installed".

1

/proc/filesystems shows only filesystems supported by kernel. DavFS support is implemented using FUSE in userspace so it's not shown there. The best best way to check is probably simply to check whether mount.davfs binary exists (for example using which).

0

/proc/filesystems only lists the file systems that are currently known to the kernel. But upon a mount(src, dst, fstype, ...), the kernel will try to dynamically load the corresponding kernel module if available and not already loaded.

Some filesystems such as nfs or aufs need a helper program to setup the mount. That will be mount.fsname. On Debian bullseye, the first thing the mount command does when asked to mount a FS with -t fsname is look for a mount.fsname in /sbin, /sbin/fs.d and /sbin/fs in that order.

davfs2 is a file system implemented in user space. The kernel driver will be fuse, and a mount.davfs2 helper will be responsible for starting the userspace program and connect it with fuse.

So here, to check whether a fsname is available, you could do:

has_fs() {
  [ -e "/sbin/mount.$1" ]        || # helper found in /sbin
    [ -e "/sbin/fs.d/mount.$1" ] || # helper found in /sbin/fs.d
    [ -e "/sbin/fs/mount.$1" ]   || # helper found in /sbin/fs
    < /proc/filesystems FS=$1 awk '
      $NF == ENVIRON["FS"] {found = 1; exit}
      END {if (!found) exit 1}'  || # currently available in kernel
    modprobe -c | FS=fs_$1 awk '
      $1 == "alias" && $2 == ENVIRON["FS"] {found = 1; exit}
      END {if (!found) exit 1}'     # available via a kernel module
}

The search path for the mount helper may be different on different systems. Note that the availability of the helper is a strong indication, but not a guarantee that the driver will be available (or that you'll be able to mount a FS of that type).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .