What About Directories?
Let's look at how directory reads and writes take place in LFS.
We'll cover the following
Thus far, we’ve simplified our discussion a bit by only considering inodes and data blocks. However, to access a file in a file system (such as /home/remzi/foo
, one of our favorite fake file names), some directories must be accessed too.
How does LFS store directory data
Fortunately, the directory structure is basically identical to classic UNIX file systems, in that a directory is just a collection of (name, inode number) mappings. For example, when creating a file on disk, LFS must both write a new inode, some data, as well as the directory data and its inode that refer to this file. Remember that LFS will do so sequentially on the disk (after buffering the updates for some time). Thus, creating a file foo
in a directory would lead to the following new structures on disk:
Get hands-on with 1400+ tech skills courses.