Inode

Inode

In computing, an inode is a data structure on a traditional Unix-style file system such as UFS. An inode stores basic information about a regular file, directory, or other file system object.

Details

When a file system is created, data structures that contain information about files are created. Each file has an inode and is identified by an inode number (often referred to as an "i-number" or "inode") in the file system where it resides.

Inodes store information on files such as user and group ownership, access mode (read, write, execute permissions) and type of file. On many file system types the number of inodes available is fixed when the filesystem is created, giving a maximum number of files the file system can hold. Typically when a file system is created about 1% of it is devoted to inodes.

The term "inode" usually refers to inodes on block devices that manage regular files, directories, and possibly symbolic links. The concept is particularly important to the recovery of damaged file systems.
* The inode number indexes a table of inodes in a known location on the device; from the inode number, the kernel can access the contents of the inode, including the data pointers, and so the contents of the file.
* A file's inode number can be found using the ls -i command, while the ls -l command will retrieve inode information.
* Non-traditional Unix-style filesystems such as ReiserFS may avoid having a table of inodes, but must store equivalent data in order to provide equivalent function. The data may be called stat data, in reference to the stat system call that provides the data to programs.

File names and directory implications
* Inodes do not contain filenames, only file metadata.
* Unix directories are lists of "link" structures, each of which contains one filename and one inode number.
* The kernel must search a directory looking for a particular filename and then convert the filename to the correct corresponding inode number if the name is found.

The kernel's in-memory representation of this data is called struct inode in Linux. Systems derived from BSD use the term vnode, with the v of vnode referring to the kernel's virtual file system layer.

POSIX inode description

The POSIX standard mandates filesystem behavior that is strongly influenced by traditional UNIX filesystems. Regular files are required to have the following attributes:
* The length of the file in bytes.
* Device ID (this identifies the device containing the file).
* The User ID of the file's owner.
* The Group ID of the file.
* The file "mode", which determines what users can read, write, and execute the file.
* Timestamps telling when the inode itself was last changed (ctime, "change time"), the file content last modified (mtime, "modification time"), and last accessed (atime, "access time").
* A reference count telling how many hard links point to the inode.
* Pointers to the disk blocks that store the file's contents (see inode pointer structure).

The stat system call retrieves a file's inode number and some of the information in the inode.

Word origin

The exact reasoning for designating these as "i" nodes is unsure. When asked, Unix pioneer Dennis Ritchie replied:Fact|date=February 2008

Implications

The properties of a file system that makes use of inodes surprise many users who are not used to the concept:
* If multiple names link to the same inode (they are all hard links to it) then all of the names are equivalent. The first one to have been created has no special status. This is unlike the sometimes more familiar symbolic links, where all of the links depend on the original name.
* An inode can even have no links at all. Normally such a file would be removed from the disk and its resources freed for reallocation (the normal process of deleting a file) but if any processes are holding the file open, they may continue to access it, and the file will only be finally deleted when the last reference to it is closed. This includes executable images which are implicitly held open by the processes executing them. For this reason, when programs are updated, it is recommended to delete the old executable first and create a new inode for the updated version, so that any instances of the old version currently executing may continue to do so unbothered.
* Typically, it is not possible to map from an open file to the filename that was used to open it. The operating system would convert the filename to an inode number at the first possible chance, then forget the filename. This means that the getcwd() and getwd() library functions would need to search the parent directory to find a file with an inode matching the "." directory, then search the grandparent directory for that directory, and so on until reaching the "/" directory. SVR4 and Linux systems retain extra information to avoid this awkwardness.
* Historically, it was possible to hard link directories. This made the directory structure into an arbitrary directed graph as opposed to a directed acyclic graph (DAG), a connected graph with N-1 edges for N nodes. For example, it was possible for a directory to be its own parent. Modern systems generally prohibit this confusing state, except that the root directory is still its own parent.
* A file's inode number will stay the same when it is moved to another directory on the same device, or when the disk is defragmented. Therefore, moving either a file's directory entry or its data (or both) is not enough to prevent a running process from accessing it, if the process ever had a chance of finding out the inode number. This also implies that completely conforming behavior of inodes is impossible to implement with many non-Unix file systems, such as FAT and its descendants, which don't have a way of storing this lasting "sameness" when both a file's directory entry and its data are moved around.
* Installation of new libraries is simple with inode filesystems. Take the following example: A currently running process can have a library mapped, while another process replaces that file (creating a new inode), all new mapping of that library will be of the new file. This eliminates the need to reboot to replace currently mapped libraries.

Practical considerations

Many computer programs used by system administrators in UNIX operating systems often give inode numbers to designate a file. Popular disk integrity checking utility fsck or pfiles command may serve here as examples. Thus, the need naturally arises to translate inode numbers to file pathnames and vice versa. This can be accomplished using file-finding utility find with option -inum or ls command with proper option which on many platforms is -i.

It is possible to "run out" of inodes. When this happens, you cannot add data to the device, even though there may be free space available.

Y2038 problem

Some Inode file systems are Y2038 (aka Unix time) safe with respect to date overflow prevention -- but not all Inode file systems in use are protected from this problem. When setting up a server it will become more important over time to avoid the use of these non-POSIX compliant file systems. POSIX in its latest revision supports system time and date calls that are Y2038 safe.

External links

* [http://www.cse.unsw.edu.au/~neilb/oss/linux-commentary/vfs-7.html The Linux Virtual File-system Layer: Inodes and Operations] - I-nodes in Linux


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Inode — В информатике инодом (или индексным дескриптором) (произносится айнод или инод) называют структуру данных в традиционных файловых системах Unix, таких как UFS. Инод хранит основную информацию о постоянных файлах, каталогах или других объектах… …   Википедия

  • Inode — Ein Inode (auch I Node, Kurzwort aus: engl. index node) ist ein Eintrag in einem Unix Dateisystem, der Metadaten einer Datei enthält. In den meisten Unix Betriebssystemen werden Dateien nur über ihre Inodes verwaltet. Jeder Inode ist durch eine… …   Deutsch Wikipedia

  • Inode — Les inodes (contraction de « index » et « node »; en français : nœud d index) sont des structures de données contenant des informations concernant les fichiers stockés dans certains systèmes de fichiers (notamment de type …   Wikipédia en Français

  • inode — В информатике inode (произносится айнод или инод), индексный дескриптор это структура данных в традиционных для ОС UNIX файловых системах (ФС), таких как UFS. В этой структуре хранится метаинформация о стандартных файлах, каталогах или других… …   Википедия

  • Inode (Begriff) — Ein Inode (auch I Node, Kurzwort aus: engl. index node) ist ein Eintrag in einem Unix Dateisystem, der Metadaten einer Datei enthält. In den meisten Unix Betriebssystemen werden Dateien nur über ihre Inodes aufgerufen. Jeder Inode ist durch eine… …   Deutsch Wikipedia

  • Inode (Marke) — Logo der Marke inode inode ist eine Österreichische Marke im Besitz von UPC Austria. inode wurde von Michael Gredenberg und Peter Augustin im Jahr 1996 als eigenständiges Unternehmen gegründet. inode konzentriert sich hauptsächlich auf… …   Deutsch Wikipedia

  • Inode (Unternehmen) — Logo der Marke inode inode ist eine Österreichische Marke im Besitz von UPC Austria. inode wurde von Michael Gredenberg und Peter Augustin im Jahr 1996 als eigenständiges Unternehmen gegründet. inode konzentriert sich hauptsächlich auf… …   Deutsch Wikipedia

  • Inode pointer structure — The inode pointer structure is a structure adopted by the inode of a file in the Unix File System (UFS) or other related file systems to list the addresses of a file s data blocks. In the past, the structure may have consisted of eleven or… …   Wikipedia

  • inode — noun A data structure representing an object in a Unix (or similar) file system …   Wiktionary

  • inode — ● ►en n. m. ►UNIX Variante de l orthographe de i node …   Dictionnaire d'informatique francophone

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”