por | 26 agosto, 2008

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.

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 contents.
* 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.


Categoría: Nix