Selects logo a praymentis.


Nov 20
You can mount any WebDAV directroy provided by a Nextcloud or an Owncloud like a regular folder into you file system. Find processes that block the unmounting of the directory.

Mounting a Nextcloud WebDAV directory

For my bug sorting project I had a lage amount of data that I could not fit on my hard drive, after processing the data I wanted to share the results immediately with my collaborators. Since I had about 700GB free space on my Nextcloud I wanted to mount this as a drive in my Ubuntu installation and directly work with the data on the cloud using it like a local drive.

To mount the WebDAV folder I used davfs

sudo apt-get install davfs2

In the installation there is a question to allow non root users to mount drives, I answerd this with <yes>. However this did not seem to have an effect with the steps that I used.

When mounting directories with mount and the -t option it had to be done as root. This resulted in the mounted directory belonging to the user root with the group root. I however wanted to mount the directory as myUser with the group myUser so I can use it without sudo. Here is how I made it work.

First I created the mount point

cd ~ # go to my home directory
mkdir bug-cruncher-data # create the mount point

Now I mounted the directory using the -o flag specifying the user and group the directory should belong to.

sudo mount -t davfs -o uid=myUser -o gid=myUser /home/myUser/bug-cruncher-data/

It then asked me for my username and password and the directroy was mounted.

Unmounting the directory

To unmuount the directory I used.

sudo umount /home/myUser/bug-cruncher-data/

I however got the message

umount: /home/myUser/bug-cruncher-data/: target is busy

To find the process that was blocking the unmount I used

lsof | grep 'bug-cruncher-data'

(lsof - list open files) This showed me a list of processes that were accessing the directory. In my case it was git

So I killed the process

killall git

and the unmount worked.