Inode

An inode ( index node english, pronounced " eye- node" ) is the basic data structure for managing file systems with UNIX-like operating systems. Each inode is identified clearly within a partition by its inode number and refers to exactly one file or directory. Conversely corresponds to each file or directory name exactly one inode, the assignment is so uniquely.

At the program level, no distinction between device drivers and the input from or output to a file. Through the inode concept applies to the Unix variants everything as a file ( "On UNIX systems it is reasonably safe to say did everything is a file: ...") Thus, these systems differ from other such as NTFS in Microsoft Windows, VMS or MVS.

Construction

Even when creating a file system on a partition, the maximum number of inodes and the size of the cluster managed by this is determined by the superblock. Before the file system can be used to find the operating system (or manually ) with fsck (8) ( file system check ) to check for any mistakes. When you start the operating system is at least the root partition in the root directory / (root directory) mounted. For programs and users of every file access through a hierarchical naming structure will take place from this point. Very many unix -like system are now following the Filesystem Hierarchy Standard (FHS) in the naming of basic directories. The assignment of programs such as / bin / ls or directories like / home / user / example / to the corresponding inodes will be held by the right for each file system kernel module. The df (1) program (display free disk space, display of disk usage ) can also display information about inodes.

Each individual of a slash / ( slash ) delimited name is assigned to exactly one inode. Accordingly, each inode stores the following metadata to the file, but not the actual name:

  • The numeric identifier of the owner ( UID, user id ) and group (GID, group id);
  • The permissions for the owner (user ), the group (group) and all other (others);
  • Different time points of the file: creation, access ( access time, atime) and last change ( modification time, mtime );
  • The time of the last status change inodes (status, ctime );
  • The size of the file;
  • The link count on this inode: Several, including different file names can point to the same inode. Only when you delete the last reference ( counter = 0 ) then use the file as deleted in fact, and the space is available for overwriting.
  • One or more links to the cluster in which the actual data is stored.

When viewing a directory in long form, for example, ls-l in the first column, a corresponding code letter appears.

Directories

The storage of the file name will be held in special files. These contain references to inodes in the form of a table that contains the file name and the corresponding inode number. Always exist, the entries for each directory. for the current and .. for the parent directory.

Files

  • Regular files
  • Symbolic link

Other types of inodes

  • Device files
  • Named pipes
  • Sockets, see Unix domain socket

Example using the ext2 filesystem

The ext2 filesystem default to up to 12 entries in the inode on a per cluster in which the content of the file is stored. Not enough these 12 clusters, an entry in the inode to a cluster, which then contains the references to the actual data clusters. Such a reference is referred to as simply an indirect block. Up to triple indirect blocks are possible, so that the maximum file size can range depending on the block size between 16 and 4 GiB TiB.

Example of an inode structure with 12 KiB in directly addressed data blocks and about 16 million KiB 65536 KiB 256 KiB in indirectly addressed data blocks / clusters, each with a KiB Size: The 256 entries in the blocks, referred to, result from this that a 1- KiB block just 256 addresses the length may contain 4-byte (32- bit address space ).

In the operating system a table exists with all current inodes. It is also possible to create lists of all unused inodes.

The inode number of a file can be displayed by the ls- i filename command.

405625
de