SVNFS: a Versioned File System

Working with version control systems can be a pain in the butt. I notice that most frequently when I do a find in an SVN directory and find all the administrative files that go with it. It’s factors more files in there than in the actual directory.

At the same time, there are times when you would want every access to a file recorded, so as to be able to undo things. Restore the status as of last Monday, or see the difference in that file that just got changed a minute ago.

Versioned file systems have been around for a long while. On Linux, apparently, the default is copyfs – which also apparently hasn’t seen much of an update in a long while. 

Here I used a different approach than that used by most. Instead of creating a file system that does its own versioning, I used an existing versioning tool, subversion, and made its use transparent. The advantage is that this file system doesn’t require you to learn a new tool, if you know subversion; if you don’t know or care about versioning, you don’t have to worry, either: this file system will be perfectly transparent to you.

You (or your admin) start out by creating a directory under version control. You don’t have to place anything in it, although it doesn’t matter if you did.

Next, you have to connect this directory to the mount point. That’s the name of the directory you are actually going to use. For instance, let’s say we created the directory /home/marco/svnfiles and placed it under version control (I’ll explain how later, if you don’t already know that). You also have a second directory called /home/marco/myfiles that is empty.

Now you start the versioning file system by invoking the script attached:

python svnfs.py -o svnroot=/home/marco/svnfiles /home/marco/myfiles

Once everything is fine, you should be able to get a listing of both directories and see that the contents are the same.

Now, if you create (almost) any file in either directory, it will show up on the other side of the fence, as well. The big difference is that if you create a file in the myfiles directory, it will automatically be placed under version control (the opposite is not true).

The script is currently in its infant stages – it is full of debug statements that will be removed once we get somewhere, and its functionality is anything but guaranteed. (Use at your own risk!)

For what it’s worth, you can download the latest version here.

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.