Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to write my own custom file system in Linux. Can I share it over standard NFS without making any changes to the local NFS server? If so what VFS APIs are required to be implemented by my file system? Any other guidelines / gotchas for such an approach?

share|improve this question
Are there some APIs you are hoping to not have to implement? Without going through the NFS server code you won't know and won't know what the next version of NFS will need either. You may be able to get some guidance from searching how to write a POSIX compliant file system driver - that should probably be the minimum feature/functionality set. – Johan Mar 8 '13 at 8:36
Why would the NFS server need any knowledge of your particular file system implementation? – Michael Kjörling Mar 8 '13 at 8:50
It doesn't need, doesn't know, and doesn't give a flying damn. If it mounts, it can be bound. – Shadur Mar 8 '13 at 8:58

Yes. Once linux recognizes it as a filesystem and mounts it, it can be shared over NFS like any other filesystem, whether it's a hard drive, CD, USB stick, or even another NFS filesystem shared from somewhere else.

That's what abstraction layers are for.

share|improve this answer
Thanks everyone for your responses. I implemented a simple kernel land file system as outlined in: lwn.net/Articles/57369 with some modifications for my specific kernel version and protecting against multiple mounts in the get_sb / mount implementation. I am able to mount this file system sucessfully on the local machine. However while trying to nfs mount it from a remote machine I get permission denied error. When I check the /var/log/messages on my machine running the NFS server I see: mountd[14755]: Cannot export /lwnfs, possibly unsupported filesystem or fsid= required – Sameer Mahajan Mar 8 '13 at 9:27

That are two separate tasks:

  1. Write a local filesystem for Linux
  2. Export it via NFS

The second one is really (mostly) independent of the first one (if the kernel can mount it, it can be exported). The hard work is in the first point. And as lots of experiences with remote file systems have shown, full POSIX compliance is possible only at the price of totally unacceptable performance. Look around NFS (various versions), Remote File System, Andrew File System, and there sure are others I forget right now, for the tradeoffs considered (and mostly discarded, it if for a reason that NFS is still the remote filesystem for Unix). Also look at CIFS, the remote filesystem from the Windows world.

The first one is a major undertaking. Look at the massive amount of work poured into BTRFS by Oracle, and it is still few years away from non-experimental status. Consider the failed ReiserFS and others. The current ext4 filesystem is a relatively straightforward development of the ext filesystem, one of the first native filesystems for Linux.

I'd suggest you attach yourself to work within one of the current filesystem development groups to learn the ropes before starting on such a project.

share|improve this answer
thanks for your feedback and comments. How about wrapfs.filesytems.org for such NFS exporting purpose? – Sameer Mahajan Mar 11 '13 at 5:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.