Linux System Administration

0 of 85 lessons complete (0%)

Managing Unix File Systems

inode block

You don’t have access to this lesson

Please register or sign in to access the course content.

Inodes (Index Nodes) store metadata for individual files and directories on the filesystem. Unlike superblocks, which contain information about the entire filesystem, inodes are responsible for individual files.

Key Information Stored in an Inode:

  • File type: Indicates if the inode refers to a regular file, directory, symbolic link, etc.
  • File permissions: Owner, group, and other permissions (read, write, execute).
  • Owner (UID) and group (GID): User and group IDs associated with the file.
  • File size: The size of the file in bytes.
  • Timestamps: Includes the last access time, last modification time, and inode change time.
  • Link count: The number of hard links pointing to the file.
  • Pointers to data blocks: The inode contains pointers to the actual data blocks on disk that store the file contents.
    • Direct pointers: Point directly to blocks.
    • Indirect pointers: Can point to blocks that further point to other blocks, allowing larger files to be managed.

Inodes do not store the file name. Instead, filenames are stored in directories, which map the filenames to corresponding inode numbers.

Example:

When you create a new file, an inode is allocated for it. The inode will store all the file’s metadata (like permissions, size, etc.), while the actual file content is stored in disk blocks, and the inode contains pointers to those blocks.

Viewing Inode Information:

You can view information about a file’s inode with the ls command using the -i flag:

This will show the inode number of the file.

To inspect the inode table:

Practical Lab Exercise on Inodes:

Inode Information:

List the inode numbers of files in a directory:

View detailed inode information of a specific file:


Summary of Superblock vs Inode:

AspectSuperblockInode
ScopeDescribes the entire filesystemDescribes individual files and directories
PurposeStores global filesystem metadataStores metadata specific to a file or directory
InformationFilesystem size, block size, free blocks, inodes, etc.File permissions, ownership, timestamps, pointers to data
LocationStored at specific locations on disk (with backups)Inodes are scattered throughout the filesystem
ContainsFilesystem-wide informationFile-specific information (but not the filename)