Where are i-node tables stored?

6,072

Solution 1

My teacher said that each physical disk has a table of i-nodes, after which there is the files' data.

This is broadly correct. More precisely, there's a table of inodes on each filesystem, and there's a separate filesystem on each partition. (Things can get more complicated but we don't need to get into these complications here.)

A filesystem's inode table maps inode numbers to file metadata. It's typically a large array of fixed-size structures. For example, element number 1234 of this array is the inode number 1234. The inode contains information such as the file's permissions, its modification time, a file type, etc. as well as an indication of where the file's contents are located.

But, on the Internet, I found that each directory has its own table of the inodes and names associated to the files inside it.

That's a table that maps file names to inode numbers. That is, the directory is a list of entries (or some more sophisticated data structure), and each element of the list contains a file name and an inode number. To find the file's metadata and contents, the system reads the inode number from the directory, then reads the designated entry in the inode table. To find a file given its path, the system starts with the root inode, finds that it's a directory, finds the directory entry for the first element, reads its inode, and so on.

Note that this is a typical design for a filesystem, but not the only possible one. Most Unix-oriented filesystems are follow this design, but other designs exist.

Solution 2

One misconception is that inodes are not an attribute of physical disks, but rather of certain filesystems. FAT32, for example, does not have inodes. A simple summary of the hierarchy could be as follows:

Physical disks contain a number of sectors. These are physical locations on the disk onto which data are stored.

The physical drive is generally divided into partitions. These are logical separations of (logically) contiguous physical data storage area on the disk.

These partitions can be further divided into logical volumes (as with LVM), but this is not mandatory. If implemented, these logical volumes mostly work as partitions do, but allow for easier implementation of operations like (for instance) adding more capacity.

Partitions (or logical volumes) can contain filesystems (e. g. ext3fs, VFAT, hpfs). Each filesystem organizes itself in its own way with respect to keeping track of its organizational structure and whatnot. Many filesystems typically deployed onto Linux hosts (e. g. ext?fs) use inodes for this purpose or use an equivalent mechanism (e. g. reiserfs).

Share:
6,072

Related videos on Youtube

Admin
Author by

Admin

Updated on December 01, 2022

Comments

  • Admin
    Admin over 1 year

    I do not really understand where the tables which contain i-nodes are located. My teacher said that each physical disk has a table of i-nodes, after which there is the files' data. But, on the Internet, I found that each directory has its own table of the inodes and names associated to the files inside it.

    Are these two different tables(concepts) or is one of them wrong?

    Thank you.