Installing and configuring Davfs2
One of the cool things about today Internet is how we can use several computers in different locations as if we were our single home computer. Some time ago, I reviewed a desktop wiki called zim, which I still use. It has seen a lot of improvements but I’ll leave that for another post.
Personal wikis are great for organizing all our stuff. And if we want to use that wiki often, then it should be available on every computer we log in. Of course, the most obvious solution would a be an online wiki. The problem is I really don’t like online wikis that much. They’re great for some purposes, but using them as a post-it notes application (like I do) is not very convenient. A desktop application can have a better UI, like zim has. At least I don’t know of any wiki out there as productive and easy to use as zim.
However, now I have a problem: how do I make zim files available from everywhere ?
The solution I recently found was to create a free account at hasfiles.com. They give you 100Mb for free and let you access those files via webdav. Using davfs2, I can mount it as a partition on my system. I then have zim configured to fetch the files from the mount point path.
The process is pretty simple, but I found a few problems along the way.
First, I needed to find a way to connect to a webdav server. Hasfiles.com have a nice help page that explains how you can use nautilus for that. But I didn’t want to use Nautilus, so I searched for a more independent solution.
I found fusedav and davfs2. I couldn’t get fusedav to work behind a proxy, but davfs2 worked fine.
Here’s how you can configure davfs2 to mount a webdav server.
- First, install davfs2 the normal way. If you use debian-like systems, do apt-get install davfs2
- Next, create the directory that will serve as mount point (eg: /mnt/remote)
- Then, as root, do mount -t davfs2 http://<youraccount>.hasfiles.com/storage /mnt/remote
- It will probably ask you for a username and password. But if you don’t want to enter an username and password, edit the file /etc/davfs2/secrets and enter the line "/mnt/remote <account> <password>"
- You can also add a line to fstab, so that you can use only "sudo mount /mnt/remote" to mount the partition. Here’s an example:
http://account.hasfiles.com/storage /mnt/remote davfs noauto,user,rw 0 0
I had an issue with proxies, though. Everytime I tried to write some file it got truncated. A quick look into the log files revealed a strange HTTP error (409 – conflict). I found the solution in davfs2 forums, by adding the property "use_expect100 0" to the config file (/etc/davfs2/davfs2.conf).
Of course, you can now use that partition for anything you like. I just used zim as an example. I don’t know if I can trust their service in a long term. As with every other online service, one never knows if they’ll be up forever. So, you should always make a backup from time to time.