One of the nice things about the Unix philosophy that Linux inherited is that the filesystem is very modular. That’s good, too, because a typical system might want a choice of filesystems like ext4
, reiserfs
, btrfs
, and even network systems like nfs
. Besides that, there are fake file systems like /sys
and /dev
that help Linux make everything look like a file. The downside is that building a filesystem required changing the kernel or, at least, writing a loadable module. That’s not as hard as it sounds, but it is a little more difficult than writing a normal program. Then came FUSE — file system in user space. This is a single file system module that allows you to create new file systems by writing ordinary code.
My Favorite Fuses
There are several FUSE filesystems that are really useful. Here are some of my favorites:
- sshfs – Mount a remote filesystem using nothing more than ssh access
- rclone – Rclone can access and mount many remote file systems
- tagassistant – Store files with a unique tag access method
- fuse-zip – Mount zip files
- gitfs – Mount with git
There are many others. You can find systems to work with, for example, NTFS and a slew of cloud service providers.
What about Windows?
If this is such a great idea, is there a Windows equivalent? Yes, there is. Winfsp looks like a great way to get the same effect under Windows, although it isn’t just plug-and-play compatible with FUSE. There is a FUSE compatibility wrapper that lets you more easily port existing FUSE code. In fact, there are two FUSE wrappers, one for version 2.8 and another for version 3.2.
This is a newer project, but there is also Dokan which also claims to have a FUSE wrapper for their API. According to the Winfsp
-provided benchmarks, though, Winfsp
performs better.
And So?
If you have a favorite FUSE system, it is probably open source and you could try porting it to Windows, if you were so inclined. If you don’t use Windows, and you want to write your own FUSE system, these systems offer you a way to possibly easily move your work to Windows.
For example, you might have a data logger and want to expose its data as a file system. It isn’t that hard to do. There’s a data structure to fill in, and you don’t have to fill all of it in. You provide functions that the data structure points to that read and write things like directories and file data. Here’s an example in C. Or try a C++ wrapper that enables you to write one with even fewer lines of code. The example has just four simple functions.
I’d love to have unionfs-fuse on windows.
There is an endless list of of badly designed corporate tools that use hard coded path names
This has been bothering me for awhile, and I finally took the time to track it down. (This, and I’ve trained on these and knew the name, but not how to spell it. I’ve even got a book on it that spells it differently.)
The penguin is standing on mei hua zhuang poles (“plum blossom poles”), a martial arts tool to help train balance. Legend has it that temple combat was done in a court of these poles, with one end having low poles and the other end having very high poles, with a net to catch people falling off. For mortal combat (yes, they sometimes did this) the net was removed and possibly there were spears planted to impale any falling loser.
These are not hard to make. If you take martial arts and have trained up your stances and transitions, try setting some of these at the correct distance and angles (diamond pattern) and see if you can do your forms on them. The results can be an eye-opening experience.
(Start with really really low, and plant them in the ground so they can’t slide or tip over. They are very surprising at first.)
Unexpected learning! Now I’m really curious about doing forms on posts like that, it’s been ages since I did Tae Kwon Do.
That’s really cool, thanks :D
reiserfs, not riserfs.
Oops
I thought that was abandoned after the author killed his wife.
It was abandoned for a while, a community effort has been maintaining the v3.6 code base in the kernel, but that code has an expiration date (It suffers from the 2038 problem). And versions 4 and 5 are incompatible with v3, and require significant work before they can be merged into the kernel. ext3 and ext4 have supplanted it for OS usage, and XFS has supplanted its use in high-performance applications.
At this point, I wouldn’t recommend it for long-term file storage.
NTFS is good until 02.04.2137 so that’s what I use for long term storage.
I was very surprised to see it come up. Looks like he took the stand in his own defense, which isn’t a good idea https://www.wired.com/2008/04/reiser-guilty-o/ Also, at the time of that article it was “a murder case with no body, no crime scene, no reliable eyewitness and virtually no physical evidence”
Interesting read for breakfast.
FUSE and similar mechanisms really are a great technology that open up all sorts of novel possibilities. For example, I have created a FUSE filesystem for accessing ancient unix disk images (currently Unix v5 and v6) on modern linux and MacOS machines (https://github.com/jaylogue/retro-fuse). One of the novel features of my filesystem is that it incorporates some of the actual C code (suitably modernized) from original v6 Unix. (Among other things, this helps to ensure the fidelity of on-disk data structures). This would be difficult to achieve in a kernel-based implementation.
Unfortunately the licensing for winfsp is not obviously compatible with my project. In particular, the author has released the project under a personalized variant of GPLv3, which my code may or may not satisfy (certified legal advice on the topic welcomed, though). It would be nice if the authors would release winfsp under dual license with Apache 2.0.
On the topic of FUSE compatibility wrappers, I would strongly encourage developers to consider the security implications of a naïve adaptation of a FUSE filesystem to Windows. Many parts of the FUSE interface are highly Unix-centric, including those that relate to file access security. Because the Unix file security model does not map cleanly onto the Windows model, this opens the possibility that a simplistic FUSE adaptation could inadvertently introduce a security vulnerability under Windows.
Farting in the general vicinity of Windows code base can introduce security vulnerabilities.
I’ve been using winfsp for a couple years to mount over SSH. Looks like my version was about a year old, so I just upgraded, but at least in the past release, large file transfers with tons of files tend to cause it to become unstable. However, for just browsing and sshing it seems to work just fine. Hopefully the new version works better.
This article would have benefited from opening with a definition of “filesystem”. As my calculus teacher said to the genius who kept “ooo! ooo!” raising his hand, “I’m not teaching you, I’m teaching them.”
HelpABrothah
You just wish it were so easy! In Unix, Everything is a File™ — so a filesystem is…a collection of everythings?
More seriously, it’s the way that the bits on e.g. a hard drive are organized. Most filesystems let you give each “file” a name, find it as if it were in a directory, and read/write its data. (Of course, there are details, but that’s the gist of it.)
You probably take filesystems for granted — try to imagine other ways of organizing all the bytes on a harddrive. (There are database-based ones too, I guess, but the file/directory style is a pretty loose, but incredibly simple and helpful structure.) And, as this and a couple of Al’s other articles have reminded us, very hackable.
Also: https://en.wikipedia.org/wiki/File_system , but I like my definition better. :)