How to permanently mount a Nextcloud Webdav folder using terminal. 0

I was looking for a way to achieve this for several Virtual Machines: VirtualPrivateServer and local VirtualBox, in order to replace Dropbox and Rsync. These servers run backups creating  tar.gz files from directories, sqldatabase dumps, and copy configuration and installation files, triggered by crontab. Space is limited so these files do not change name, they are overwritten and just their size and/or timestamp are changed. I used to manage versions on a local machine running BackInTime.

With a NextCloudPi folder mounted permanently, I address all of the requirement in a single solution. Here is how I did it.

  •  Install davfs2

sudo apt-get install davfs2

  • Add a line to your /etc/fstab /media/backups davfs defaults,uid=username,gid=groupname,_netdev,auto 0 0

  • Add your user to the correct group:

sudo usermod -a -G davfs2 <username>

  • Create mountpoint

sudo mkdir /media/backups

  • Add mountpoint, user and password to davfs2 configuration file

sudo echo “/media/backups/   username    password” >> /etc/dav2fs/secrets

  • Mount the webdav folder

sudo mount /media/backups

  • Check if mounted

df  -h

NextCloudPi WebDav folder mounted












I now have an additional 80GB of space available to my virtual machine, so I can backup to my hearts content. I can also revert to any version by restoring it to a an earlier version from Nextcloud file manager.



















Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

Deze website gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.