Which fs is a good example for learning ?
Hello,
I'd like to learn how file systems work on Linux and I don't know which file system driver I should look at to get a good picture of how a contemporary file system is designed.
The choice has to be made according some criterias: the fs shouldn't be too hard since I'm pretty new in this area. Also not too old/obsolete since I'd like to learn from current technology.
Could anybody give me some suggestions ?
Thanks
Signature · 1 line
Francis
Quoted 7 lines · Francis Moreau
I'd like to learn how file systems work on Linux and I don't know which file system driver I should look at to get a good picture of how a contemporary file system is designed.
The choice has to be made according some criterias: the fs shouldn't be too hard since I'm pretty new in this area. Also not too old/obsolete since I'd like to learn from current technology.
You're giving some contradictory criteria. ext2 is probably the best example to learn the basics, then you can move on to whichever filesystem catches your fancy.
Signature · 4 lines
Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Quoted 6 lines · Matthew Wilcox
Quoted 4 lines · Francis Moreau
I'd like to learn how file systems work on Linux and I don't know which file system driver I should look at to get a good picture of how a contemporary file system is designed.
Quoted 7 lines
Quoted 3 lines
The choice has to be made according some criterias: the fs shouldn't be too hard since I'm pretty new in this area. Also not too old/obsolete since I'd like to learn from current technology.
You're giving some contradictory criteria. ext2 is probably the best example to learn the basics, then you can move on to whichever filesystem catches your fancy.
This is all a matter of opinion obviously, but I would personally start with ramfs - it's only a couple hundred lines of code, and is very simple since everything resides only in memory. This is useful for looking at the API and code flow. Then you can go to a disk-based file system like ext2 which is a bit more complex but closer to what you're probably looking for.
Avishay
Hello,
Quoted 5 lines · Matthew Wilcox
Quoted 4 lines · Francis Moreau
I'd like to learn how file systems work on Linux and I don't know which file system driver I should look at to get a good picture of how a contemporary file system is designed.
Quoted 8 lines
Quoted 3 lines
The choice has to be made according some criterias: the fs shouldn't be too hard since I'm pretty new in this area. Also not too old/obsolete since I'd like to learn from current technology.
You're giving some contradictory criteria. ext2 is probably the best example to learn the basics, then you can move on to whichever filesystem catches your fancy.
OK.
That's what I think too but wasn't sure ext2 is still a good choice since it's pretty old and it looks like some younger fs seems to make ext2 obsolete. Also, it doesn't have a journal.
thanks.
Signature · 1 line
Francis
Quoted 15 lines · Avishay Traeger
Quoted 6 lines · Matthew Wilcox
Quoted 4 lines · Francis Moreau
I'd like to learn how file systems work on Linux and I don't know which file system driver I should look at to get a good picture of how a contemporary file system is designed.
Quoted 7 lines
Quoted 3 lines
The choice has to be made according some criterias: the fs shouldn't be too hard since I'm pretty new in this area. Also not too old/obsolete since I'd like to learn from current technology.
You're giving some contradictory criteria. ext2 is probably the best example to learn the basics, then you can move on to whichever filesystem catches your fancy.
Quoted 6 lines
This is all a matter of opinion obviously, but I would personally start with ramfs - it's only a couple hundred lines of code, and is very simple since everything resides only in memory. This is useful for looking at the API and code flow. Then you can go to a disk-based file system like ext2 which is a bit more complex but closer to what you're probably looking for.
ramfs seems a good example for learning the page cache. But since it's not a disk based filesystem, it doesn't cover the block dev layer (bio, elevator...) and more important all data structures used on the disk.
thanks
Signature · 1 line
Francis
Quoted 4 lines · Francis Moreau
ramfs seems a good example for learning the page cache. But since it's not a disk based filesystem, it doesn't cover the block dev layer (bio, elevator...) and more important all data structures used on the disk.
Fair enough, that's good stuff to understand.
Btw, only about half the filesystems in linux/fs use the block dev layer and work with block based disks.
The others are virtual, userspace, network, flash or (being submitted) object-storage.
-- Jamie
Quoted 3 lines · Francis Moreau
That's what I think too but wasn't sure ext2 is still a good choice since it's pretty old and it looks like some younger fs seems to make ext2 obsolete. Also, it doesn't have a journal.
This is all true. It depends what your real goal is here. If you want to learn the fundamentals of what a filesystem has to do to get blocks from disc and turn them into files, ext2 is perfect for your needs since it _doesn't_ have a journal or btrees or any of that fancy stuff. You can learn that later once you have the principles down.
If your goal is to learn how an advanced filesystem works, you might want to consider looking at JFS which has journals, extents, acls, xattrs and so on. It's around 4x as big as ext2, but then it's also about 1/3 the size of XFS (just in terms of wc -l). It's also been properly ported to Linux, unlike XFS which is still full of IRIXisms.
Signature · 4 lines
Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Quoted 11 lines · Matthew Wilcox
Quoted 3 lines · Francis Moreau
That's what I think too but wasn't sure ext2 is still a good choice since it's pretty old and it looks like some younger fs seems to make ext2 obsolete. Also, it doesn't have a journal.
This is all true. It depends what your real goal is here. If you want to learn the fundamentals of what a filesystem has to do to get blocks from disc and turn them into files, ext2 is perfect for your needs since it _doesn't_ have a journal or btrees or any of that fancy stuff. You can learn that later once you have the principles down.
If most of the fs use the same techniques as ext2 to get blocks from disk then indeed ext2 is still a good candidate.
Quoted 5 lines
If your goal is to learn how an advanced filesystem works, you might want to consider looking at JFS which has journals, extents, acls, xattrs and so on. It's around 4x as big as ext2, but then it's also about 1/3 the size of XFS (just in terms of wc -l). It's also been properly ported to Linux, unlike XFS which is still full of IRIXisms.
OK. I'll look at JFS if I'm still motivated after looking at ext2.
Thanks for the tips.
Signature · 1 line
Francis