Inode

From WikiMD's Food, Medicine & Wellness Encyclopedia

File table and inode table

Inode is a fundamental concept in file systems that store information about files and directories. An inode (index node) is a data structure on a filesystem used to keep information about a file or a directory. The information stored by an inode can include attributes and disk block location(s) of the file's data. Inodes play a critical role in filesystems by providing the essential information needed to retrieve a file from the disk.

Overview[edit | edit source]

In a Unix-like operating system, every file, directory, and symbolic link is represented by an inode. The inode contains metadata about the file, such as its size, permissions (file system permissions), modification time, and the locations of the disk blocks that contain the file's data. However, it does not contain the file name or directory name; these are stored in a separate structure called a directory entry, which links the file name to its inode.

Structure[edit | edit source]

The structure of an inode can vary between different filesystems, but it typically includes the following information:

  • File type (regular file, directory, symbolic link, etc.)
  • Permissions (read, write, execute for owner, group, and others)
  • Owner (UID) and group (GID)
  • File size
  • Time stamps (time of last access, time of last modification, time of last inode change)
  • Link count (number of hard links to the file)
  • Pointers to the disk blocks that store the file's content

Allocation[edit | edit source]

When a new file is created, the filesystem allocates an inode for the file and records its metadata within the inode. The number of inodes on a filesystem is determined when the filesystem is created. This means that a filesystem can run out of inodes even if there is still space available for storing data. When this happens, no new files can be created on the filesystem until inodes are freed up by deleting files or increasing the number of inodes.

Accessing Inodes[edit | edit source]

Users and programs do not directly interact with inodes; instead, they work with files and directories through their names. The operating system's kernel translates these names into the corresponding inodes to access the file's data and metadata. Tools like ls -i in Unix can display the inode number associated with each file, and the stat command can show the detailed information contained in an inode.

Inode Number[edit | edit source]

Each inode is identified by an inode number within the filesystem. This number is unique for each file within a filesystem but may be reused after a file is deleted. The inode number is used by the filesystem to index into an inode table to access the inode's data.

Limitations and Solutions[edit | edit source]

One limitation of inodes is the fixed number of inodes created when a filesystem is initialized, which can lead to inode exhaustion. Some modern filesystems, such as XFS and Btrfs, address this limitation by allowing the dynamic creation of inodes. Additionally, these filesystems introduce advanced features like snapshots and dynamic resizing, further enhancing the management and efficiency of inodes.

See Also[edit | edit source]

Wiki.png

Navigation: Wellness - Encyclopedia - Health topics - Disease Index‏‎ - Drugs - World Directory - Gray's Anatomy - Keto diet - Recipes

Search WikiMD


Ad.Tired of being Overweight? Try W8MD's physician weight loss program.
Semaglutide (Ozempic / Wegovy and Tirzepatide (Mounjaro) available.
Advertise on WikiMD

WikiMD is not a substitute for professional medical advice. See full disclaimer.

Credits:Most images are courtesy of Wikimedia commons, and templates Wikipedia, licensed under CC BY SA or similar.


Contributors: Prab R. Tumpati, MD