2009/03/17

Dokan: Filesystem in userspace (FUSE) for Windows

As Wikipedia explains, a filesystem is a method for storing and organizing computer files and the data they contain to make it easy to find and access them.

There are many different filesystems, like ext3 (Linux) or NTFS (Windows), only to name a few. These filesystems allow the usual and necessary file operations we do every day: creating, copying, moving or deleting files or directories, listing directories or showing the content of files. We usually do these operations with "real" files and directories of a hard disk or a USB device, but nothing prevents us from doing them on other kind of systems which have not been prepared from the beginning to be used as filesystems in an operating system. An example of this system would be an FTP server. It clearly organizes like a filesystem, with directories, files, attributes of files and so on. So it would be possible to access an FTP server like a hard disk using your favourite file explorer if you were able to mount a "virtual" filesystem which connects automagically to the FTP server and lists the root files and directories when you go to the root of the filesystem, it deletes a file in the FTP server when you delete it in the filesystem and so on.

In fact, this is not new at all. In Linux, there exist currently many different "virtual" filesystems you can mount to ease the access of different types of resources, be them local or remote. What is more, Linux has a package called FUSE (Filesystem in Userspace), which allows mounting your own filesystem without having to make a device driver and compile it. FUSE is based on callback functions you have to implement that will be called when the different operations are invoked from the operating system. There exist a lot of language bindings for FUSE, so you can write your filesystem in Java, C#, Haskell, TCL, Python and many more (besides C or C++, which would be the expected languages for such a low level based feature). With FUSE, writing your own filesystem for Linux can be a much easier task.

But what about Windows ? A Windows port of FUSE has not existed for a long time and, from what I know, nothing similar was available as open source. But on May 2008 a project called Dokan was released as open source (LGPL). This project is the equivalent of FUSE for the Windows platform. You can download it from here. It has bindings for Ruby and .NET. In Yukoba's blog you can find very interesting contributions that enhance this project, like a Java binding (JDokan), MemoryFS (a filesystem on memory) or JSFlickerFS (a filesystem for managing Flicker albums, written in Javascript).

So if you need to write your own virtual filesystem in Windows, you have no excuse...give Dokan a try!

8 comments:

Nelson said...

Reached to your blog by search dokan(FUSE) related projects on the net.
Nice writing.

Xavi Miró said...

Thank you, Nelson!

Xavi

Sailesh said...

Thank you! I was looking for a Fuse equivalent in windows and your article pointed me in the right direction.

Xavi Miró said...

Thank you for your feedback, Sailesh!

Xavi

Eugene Mayevski said...

Dokan is long dead. There exist several attempts to resurrect it, however all people trying to do this lack knowledge of kernel-mode programming, and Dokan itself has flawed design which requires severe rewriting.

Xavi Miró said...

Thank you for this information, Eugene!

Xavi

Maxhy said...

This article is a bit old but still actual.
I'm posting for Eugene here, as usual he revived old threads to indirectly promote his company products by criticizing Dokan... This time I'm going to be direct.
Btw, I'm a contributor of Dokany project, a Dokan fork.

Yes Dokan(y) need improvement and I agree we probably have less experience than your Eldos company on Windows kernel development. As a matter of fact, we forked it only one year ago.
Why? Because we trust open source and there is no alternative in this field in respect of open source ideas with a real open source license.
There is plenty space for both, Eldos product as a commercial offer for several companies and Dokan mainly focused on open source community.
Feel free to share your thoughts and improvement on Dokan architecture. I would be interested to know what is the flawed design you're talking about and be sure we are open for discussion.

Xavi Miró said...

Thank you for this information, Maxhy!

Xavi