Coding a Linux file system

Red Squirrel

No Lifer
May 24, 2003
68,024
12,414
126
www.anyf.ca
I've been thinking it would be a cool project to code a Linux file system. It would have a better permission system and also have a network component to it that also deals better with permissions, basically I'd make it like NTFS where there's more granular options. Perhaps even encryption and various other options. I guess the network share option would be a separate program but essentially they'd probably be tied together. Maybe even add some kind of clustering like Windows DFS.

I want to do it as a learning thing but depending on how far I go I may even make it something that I use and release. I don't think there's much out there for Linux. Basically, a better NFS. NFS is old, crappy, and it could use a full blown revamp.

What is some good reading material to get me going on how to do something like this? In fact I'm not even sure what's happening under the hood of a file system as far as how the mount command works and what happens etc... so resources on that would probably be a good start. What would be some good reading material, either a book, or online. Or heck, maybe I just need to look at source code of various implimentations to see the system calls and what not, though some actual reading material would probably be a good start.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,295
3,920
75
Ugh, making a filesystem was one of my projects for Operating Systems in college. I didn't particularly enjoy it, and it was more like FAT-16 than anything.

There are lots of Linux filesystems - way more than for Windows. As far as I know, though, NFS isn't a filesystem per se - it's a protocol to connect to another machine's filesystem which is stored in a standard Linux filesystem such as ext[234], or btrfs. Other recent similar protocols include Samba (an implementation of Windows' protocol) and the Hadoop distributed file system.
 

Red Squirrel

No Lifer
May 24, 2003
68,024
12,414
126
www.anyf.ca
Yeah the NFS part is more than a fs but it still sorta act as one in the sense it can be mounted so that part I'd like to know how to do. Probably start with a real local fs first though.
 

tfinch2

Lifer
Feb 3, 2004
22,114
1
0
You can start simple by using FUSE and Python bindings to get a taste of what goes into a project like this.
 

mrjminer

Platinum Member
Dec 2, 2005
2,739
16
76
Sounds like fun. Wish I had the time to do this. You could try checking the MS-DOS source code. That *might* have some useful tidbits of information. Probably in assembly, however.

http://www.computerhistory.org/press/ms-source-code.html

Don't know jack about Linux beyond some filesystem stuff I've done in PHP, and maybe Puttying into a server or two. Just figured this was better than nothing
 
Last edited:

Fallen Kell

Diamond Member
Oct 9, 1999
6,071
441
126
It would have a better permission system and also have a network component to it that also deals better with permissions, basically I'd make it like NTFS where there's more granular options.

What kind of better permission system do you need? I ask this because I know for a fact that you have better granular control of permissions on Unix/Linux filesystems than exists on NTFS already, you just probably have never used the features beyond the user/group/other permissions. There are complete access control list available letting you specify permissions to individual users, or groups, etc.

Lookup "setfacl" for more information.
 

Red Squirrel

No Lifer
May 24, 2003
68,024
12,414
126
www.anyf.ca
Sounds like fun. Wish I had the time to do this. You could try checking the MS-DOS source code. That *might* have some useful tidbits of information. Probably in assembly, however.

http://www.computerhistory.org/press/ms-source-code.html

Don't know jack about Linux beyond some filesystem stuff I've done in PHP, and maybe Puttying into a server or two. Just figured this was better than nothing

That's cool, did not realize MS made that open source.

As for ACLs, that is more an add-on and is not really standard. I don't even know if it has inheritance, which is probably my #1 grippe with the existing system. If I create/move/copy a file as 1 user to another folder, instead of taking permissions of that folder like any other sane system would do, it changes them.

Though, I recently discovered the all_squash, anonuid and onongid options in NFS, this changes everything. I can now have uniform permissions across shares instead of having them change on me all the time depending on what user put a file there, forcing me to have to log in as root and changing it so another user can access it. Ex: something as simple as downloading an ISO and putting it in my ISO folder, then the vm user can't access it till I login as root to change the ownership. It's retarded, I should not have to do that.

Come to think of it, it's not really so much a file system I'd like to code, probably do that too just for sake of messing around, but the part I'd actually like to use is an NFS replacement that has full blown ACL and actual security (not host based). Something easy to use. You can secure NFS but it requires a whole bunch of separate systems to be setup. (LDAP and kerberos). Pain in the rear. Lot of stuff in Linux is like that, too many systems just to make 1 thing work.
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
I've always been interesting in building a virtual file system, similar to how /sys works. I think a virtual file system would be an interesting interface for a program.