0

In an interview, I came across this question. He asked me "Design a linux file system." He asked to give what all things I would need, Data structures and all. Can anyone help me in this that how I can tackle this kind of problem? Just give me necessary links which I can read and refer. I have read on wikipedia but I am not still clear how to tackle this question perfectly. What he might be expecting? I want basic details which linux file system uses. How can I think of file system if I want to design one.

Thanks in advance.

closed as off-topic by mikewhatever, g_p, Eric Carvalho, Seth Jan 15 '15 at 2:23

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This is not about Ubuntu. Questions about other Linux distributions can be asked on Unix & Linux, those about Windows on Super User, those about Apple products on Ask Different and generic programming questions on Stack Overflow." – mikewhatever, g_p, Eric Carvalho, Seth
If this question can be reworded to fit the rules in the help center, please edit the question.

3

It's a huge topic and it sounds like you're starting at the bottom. You need to understand what a filesystem is before you can hope to design one.

To the Kernel, a file or directory is just an inode tied to a superblock. The inode stores data location information as well as attributes about ownership, permissions, etc. That scopes out the data. Parallel to all this is a tree structure of dentries. These give filenames (hardlinks) and positions to inodes. Together links and nodes give you the filesystem that transforms from a path to naughts-and-ones.

That's a brutally quick skim but those are the elements you'd have to design. You can see from real examples (The Linux Kernel source is famously free) but there are some pretty decent documents out there:


In practice though, if you needed to write a filesystem, you'd probably turn to something like fuse-python and write one in an an afternoon. Not as performant as proper filesystems, but quick to write for many tasks.

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