Version of 2018-02-04
One of the real contributions of Unix has been the view that "everything is a file". A tremendous number of radically different sorts of objects, from data storage to file format conversions to internal operating system data structures, have been mapped to the file abstraction.
One of the more recent directions this view has taken has been
Filesystems in User Space, or FUSE (no, the acronym really doesn't
work. Oh well). The idea here is that if you can envision
your interaction with an object in terms of a directory structure
and filesystem operations, you can write a FUSE file system to
provide that interaction. You just write code that implements
file operations like
write(); when your filesystem is mounted, programs
are able to access the data using the standard file operation
system calls, which call your code.
FUSE filesystems have been written to do everything from providing remote access to files on a different host without using NFS or CIFS (see SSHFS at https://github.com/libfuse/sshfs) to implementing a filesystem to talk to devices using the Media Transfer protocol (see jmtpfs at https://github.com/kiorky/jmtpfs) to organizing a music collection with directories based on MP3 tags (see id3fs at http://erislabs.net/ianb/projects/id3fs/id3fsd.html) to, really, almost anything. The possibilities are only limited by your imagination!
There are many documents on the web describing how FUSE works and how to install and use a FUSE filesystem, but I haven't come across any that try to describe how to go about actually writing one. The goal of this tutorial is to meet what I see as a need for such a document.
This tutorial introduces FUSE using a filesystem I call the "Big Brother File System" (the reason for the name is that "Big Brother is watching"). The filesystem simply passes every operation down to an underlying directory, but logs the operation.
This tutorial, together with its associated example filesystem, is
available as a tarball at
Audience: This tutorial is aimed at developers who have some familiarity with general programming in Linux (and Unix-like operating systems in general), so you know how to untar a tarball, how Makefiles work, and so forth. I won't be going through the details of how to perform those tasks; I'll be focussing on what you need to know that's specific to using FUSE filesystems.
I am not affiliated with the FUSE project in any way, except as a user. My descriptions of the interface to fuse, and of techniques to work with it, are a distillation of my reading of the existing documentation, and my experience working with it. Consequently, any errors are mine (and corrections are welcome!).
You will find three subdirectories under this one:
htmlcontains the tutorial itself, in html format. I suggest you click here to start reading the tutorial.
srccontains the code for the BBFS filesystem itself.
examplecontains a couple of directories for use in exploring BBFS.
I'm happy to answer any questions you may have regarding BBFS or FUSE
in general. Also, I am available for consulting on FUSE or other
Linux system, or PIC microprocessor, development. If you're interested, send me an email at
The code found in
src/bbfs.c is derived from the
function prototypes found in
which is licensed under the LGPLv2. My code is being released under
the GPLv3. See the file