How are directory structures stored in UNIX filesystem?
I have read that each directories store their content (files and subdirectories) by using a list of filename and inode pairs. But none of the reference I got said something about how they are stored.
Are they stored on inode of their parent directory, using data blocks like a normal file, or maybe using other ways that I don't aware of?
Thanks for the clarification.
See file system internals which outlines in a rather simple way the internals of a typical Unix filesystem.
Most Unix filesystems contain
- A boot block
- A superblock (disk geometry, partition layout, inode count, etc)
- Inode blocks
- Data blocks
Modern filesystems contain additional structures.
One of the things in the superblock is the location of the inodes for the root directory.
A directory is a specially formatted file. As with all ordinary files, it has data blocks.
You can see this in The Linux Documentation Project: Filesystem
You can use debugfs
to explore these structures.