What is Dentry Linux

What is a superblock, inode, dentry and a file?

I read from the article Anatomy of the Linux file system by M. Tim Jones that Linux looks at all file systems from the perspective of a common set of objects, and those objects Superblock , Inode , Dentry and File are . While the rest of the section explains what was said above, I wasn't so happy with that explanation.

Could someone explain these terms to me?


First and foremost, and I realize it wasn't one of the terms in your question, you must Metadata understand . In short, and stolen from Wikipedia, metadata is data about data. That is, metadata contains information about a data item. For example, if I own a car, I have a lot of information about the car that is not part of the car itself. Information such as registration number, make, model, year of manufacture, insurance information, etc. All of this information is collectively known as metadata. In Linux and UNIX file systems, metadata resides at multiple levels of organization, as you will see.

The Superblock consists essentially of file system metadata and defines the file system type, size, status and information on other metadata structures (metadata of metadata). The superblock is very critical to the file system and is therefore stored in multiple redundant copies for each file system. The superblock is a very "high-level" metadata structure for the file system. For example, if a partition's superblock, / var, becomes corrupted, the operating system cannot mount that file system (/ var). In this case, you usually have to runThis will automatically select an alternate backup of the superblock and attempt to restore the file system. The backup copies themselves are stored in block groups that are distributed across the file system. The first copies are saved 1 block from the beginning of the partition. This is important in the event that manual recovery is required. You can view information about superblock backups with the command that is useful in the event of a manual restore attempt. Let's assume the dumpe2fs command prints the line. We can use this information, and additional knowledge of the filesystem structure, to attempt this super backup:. Please note that I have assumed a block size of 1024 bytes for this example.

A Inode exists in or on a file system and represents metadata about a file. For the sake of clarity, all objects in a Linux or UNIX system are files. actual files, directories, devices, etc. Please note that among the metadata contained in an inode there is no filename as people think it is. This will be important later. An inode essentially contains information about ownership (user, group), access mode (read, write, execute permissions) and the file type.

A Dentry is the glue that holds inodes and files together by adding inode numbers with filenames linked . Entries also play a role in the caching of directories, which ideally hold the most frequently used files ready for faster access. Traversing file systems is another aspect of the entry because it maintains a relationship between directories and their files.

A file is not only what people normally think of when presented with the word, but it is just a block of logically related arbitrary data. Comparatively boring considering how much work (above) has been done to keep track of things.

I am fully aware that some sentences do not provide a complete explanation for any of these concepts. If necessary, please request further details.


A file just means a series of bytes arranged in a certain order. It's what ordinary people call the contents of a file. When Linux opens a file, it also creates a file object that contains data about where the file is stored and what processes are using it. The file object (but not the file data itself) is discarded when the file is closed.


An inode (short for "index node") is a set of attributes to a file that Linux stores. There is an inode for each file (however, with some file systems, Linux has to create its own inodes because the information is distributed across the file system). The inode stores information such as who owns the file, how big the file is and who can open the file. Each inode also contains a number that is unique to the file system partition. It's like a serial number for the file that this inode describes.


An entry (short for "directory entry") is what the Linux kernel uses to keep track of the hierarchy of files in directories. Each entry assigns an inode number to a file name and a higher-level directory.


The superblock is a unique data structure in a file system (although there are multiple copies to protect against damage). The superblock contains metadata about the file system, e.g. B. Inode is the top-level directory and the type of filesystem used.

Superblock , the index node (or inode ), the directory entry (or dentry ) and finally the file - Object are a part virtual file system (VFS) or a virtual file system switch . The purpose of a VFS is to give client applications uniform access to different types of specific file systems.

Relationships of the main objects in the VFS

A Inode is a data structure in a Unix / Linux file system. An inode stores metadata about a regular file, directory, or other file system object. Inode acts as an interface between files and data. An inode can refer to a file or directory or a symbolic link to another object. It contains a unique number (the i-number), the attributes of the file, including name, date, size, and read / write permissions, and a pointer to the location of the file. It is the counterpart to the FAT table in the DOS / Windows world.

Programs, services, texts, images, etc. are everything Files . Input and output devices, and generally all devices, are called Files considered.

The Superblock is the container for high-level metadata about a file system. The superblock is a structure that exists on the hard disk (actually several places on the hard disk for redundancy reasons) and also in memory. It provides the basis for dealing with the file system on the hard disk, since it defines the management parameters of the file system (e.g. total number of blocks, free blocks, root index nodes).

Dentry is the interface between files and inodes. Entries also play a role in the caching of directories, which ideally hold the most frequently used files ready for faster access.


For the sake of simplicity, Dentry and Inode are the same thing, an abstraction from a file or directory. The difference between Dentry and Inode is that Dentry is used to facilitate directory-specific operations. Inode is just a collection of metadata about files or directories. Superblock is the file system abstraction.

is incorrectly referred to as "many others" in the Linux kernel (e.g.) and is not an abstraction of a real "file" (e.g. / etc / passwd). It stands for an open "file" or directory. is created by in the kernel, so a process can have many s for the same file.

Why do we need a guardian? It is used to speed up the translation from the path name (e.g. / etc / passwd) to the inode. Linux kernels use inode to manipulate "file" or directory, not their name.

Note that these terms are file system specific rather than Linux specific. Most of the file systems used by current Unix and Unix-like systems are either derived from or inspired by the original Unix file system that defined the superblock and inode idioms. Linux can also mount multiple filesystems that have no concept of superblock and / or inode, the most common being FAT. Another, ZFS, doesn't use super blocks, but rather super blocks.

We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.