Open In App

Inode vs Vnode

Improve
Improve
Like Article
Like
Save
Share
Report

Inode doesn’t contain files actual data but it contains the metadata about the file such as the file size, User Id, Protection information etc. It isn’t a kernel data structure and can be accessed quickly, They are always valid as they contain the information that is always needed. They are independent of the file names, even if the name of the file is changed the inode doesn’t change.

Features of Inode:

  • Stores Metadata: Inode stores metadata about a file, such as the file type, owner, group, permissions, and timestamps.
  • Contains Pointers: Inode contains pointers to the data blocks where the file’s contents are stored.
  • Stores File System State: Inode stores the state of the file system, such as the number of links to the file and the file’s size.
  • Used in Traditional File Systems: Inode is used in traditional Unix file systems, such as ext2, ext3, and ext4.
  • Provides Fast Access: Inode provides fast access to file metadata and is optimized for use with traditional file systems that are designed to be accessed locally.

Vnode is a kernel memory object that opens, reads writes, closes and does similar actions on the UNIX file interface. It can also be defined as an abstraction of the inode. It only exists when the file is opened. Being an object it has more access time compared to the inode. It contains data that does not change over the file’s lifetime.

Features of Vnode:

  • Stores Metadata: Vnode stores metadata about a file, such as the file type, owner, group, permissions, and timestamps.
  • Contains File System Specific Information: Vnode contains information that is specific to the particular file system, such as network addresses in the case of network file systems.
  • Provides Abstraction: Vnode provides an abstraction layer between the file system and the application, allowing the same file system code to be used on different types of storage media.
  • Used in Modern File Systems: Vnode is used in more modern file systems, such as the Berkeley Fast File System (FFS), the Network File System (NFS), and the ZFS file system.
  • Requires More Memory: Vnode requires more memory overhead than Inode since each vnode must be loaded into memory when a file is accessed.

Inode-vs-Vnode

Similarities between Inode and Vnode:

  • Store File Metadata: Both Inode and Vnode store metadata about a file, such as its owner, group, permissions, and timestamps.
  • Point to File Contents: Both Inode and Vnode contain pointers to the data blocks where the file’s contents are stored.
  • Used in File Systems: Inode and Vnode are both used in various types of file systems to represent files and directories.
  • Help Manage File System Resources: Both Inode and Vnode help manage file system resources by storing information about the files and directories on disk and in memory.
  • Allow File Access: Both Inode and Vnode provide a way for the operating system to access and manipulate files and directories.

Following is a table of Differences between Inode and Vnode:

 

Inode

Vnode

1. Inodes have metadata about the file which is not related to the content of the file Vnodes contain attributes that do not change over the file’s lifetime
2. Inode is an on-disk structure that explains the storage of a file in terms of disk Vnode is an in-memory structure abstraction of inode
3. Inode isn’t a data structure of the kernel   Vnode is an in-kernel representation of the inode.
4. It can be accessed quickly  It has more access time than Inode
5. Inodes are always valid  Vnode are not necessarily always valid
6. It contains information that is always needed (Ex. protection, admin power) Vnode only exists when a file is opened
7. Inode is associated with unique number within a partition Vnode doesn’t have a unique number within a partition
8. It is however a data structure in UNIX operating systems Vnode is an object in kernel memory that speaks for the UNIX file interface

Last Updated : 31 Mar, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads