Fixing slow Nextcloud WebDAV mount with rclone

Update 2026-08-25: Changed the systemd service to run as a normal user instead of at root level.

After Nextcloud broke the Linux desktop client for NTFS filesystems (see #7613), I tried to switch from syncing my folders to simply mounting them via WebDAV. On Linux, the official to accomplish this uses the davfs2 driver. Unfortunately, due to some long-lasting issue with that driver, directory listings are unbearably slow, though. Different mount options or driver parameters (like adapting caching- and locking behavior, etc.) didn’t help for me.

Eventually, I found a good solution, which uses rclone in place of the davfs2 FUSE driver for the mount. Apparently, their WebDAV implementation is more robust and has better performance (orders of magnitude faster in my case), at least in case of a Nextcloud remote. While rclone’s primary purpose is backups, it is well suitable for my very simple use case as well. Besides common storage services like S3, Google Cloud Storage, Dropbox and countless others, rclone has a WebDAV backend, which allows to create a local mount point from a WebDAV resource. Here is how:

Setup

  1. Install rclone

  2. Configure a new remote for Nextcloud WebDAV

  3. Mount it manually (to verify things are working)

    1
    2
    mkdir -p ~/mnt/nextcloud
    rclone mount nextcloud: ~/mnt/nextcloud --vfs-cache-mode full

    Note: Your mount point can vary from ~/mnt/nextcloud, of course.

  4. Create a systemd service for auto-mounting

    1. Create systemd user config folder if not existing

      1
      mkdir -p ~/.config/systemd/user
    2. Create a new file at ~/.config/systemd/user/rclone-nextcloud.service

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      [Unit]
      Description=RClone mount for Nextcloud
      Documentation=man:rclone(1)
      After=network-online.target
      Wants=network-online.target
      AssertPathIsDirectory=%h/mnt/nextcloud

      [Service]
      Type=simple
      ExecStart=/usr/bin/rclone mount nextcloud: %h/mnt/nextcloud \
      --config=%h/.config/rclone/rclone.conf \
      --vfs-cache-mode full \
      --vfs-cache-max-age 1h \
      --vfs-cache-max-size 1G \
      --buffer-size 16M \
      --dir-cache-time 72h \
      --umask 002 \
      --uid 1000 \
      --gid 1000 \
      --daemon-timeout 30s
      ExecStop=/bin/fusermount -u %h/mnt/nextcloud
      TimeoutStartSec=60
      TimeoutStopSec=20
      KillMode=process
      Restart=on-failure
      RestartSec=30
      StartLimitInterval=300
      StartLimitBurst=3

      [Install]
      WantedBy=default.target
    3. Start the service and enable it for being executed during startup

      systemctl --user daemon-reload && \
      systemctl --user start rclone-nextcloud.service && \
      systemctl --user enable rclone-nextcloud.service
      

Note that if you’re using a custom DNS resolver (like dnscrypt-proxy in my case) or anything else that must be running before your Nextcloud remote can be reached, you’ll have to adapt the After= and Wants= options.

Comments