Virtual File System (VFS)

 

Virtual File System (VFS) — Brief Explanation

🧠 What is VFS?

The Virtual File System (VFS) is an abstraction layer in UNIX that provides a uniform interface to different types of file systems.

👉 It allows the OS to handle:

  • Local file systems (like disk-based)

  • Network file systems (like NFS)

  • Other special file systems


🎯 Purpose of VFS

  • Provide a common API for file operations (open, read, write, close)

  • Hide differences between file system implementations

  • Enable multiple file systems to coexist

👉 Key idea:
User programs don’t need to know which file system they are using.


🧩 Key Components of VFS

1. Vnode (Virtual Node)

  • Represents a file in a file-system-independent way

  • Similar to an inode, but generic

📌 Contains:

  • File type

  • Pointer to actual file system data

  • Operations (read, write, etc.)


2. File Object

  • Represents an open file

  • Stores:

    • File offset (current position)

    • Access mode (read/write)


3. Mount Table

  • Keeps track of all mounted file systems

  • Links directories to file systems


4. File System Switch (FSS)

  • Table of function pointers

  • Chooses correct implementation for each file system


⚙️ How VFS Works (Flow)

  1. User calls:

    open("/home/file.txt")
  2. VFS:

    • Parses pathname

    • Locates corresponding vnode

  3. VFS uses:

    • File System Switch → selects correct file system

  4. Actual file system performs operation


🔄 Mounting in VFS

  • VFS combines multiple file systems into one tree

  • Uses mount points to attach file systems

👉 Example:

/home → local disk /net → network file system

📌 Advantages of VFS

  • ✔ Uniform interface

  • ✔ Extensibility (new file systems easily added)

  • ✔ Transparency to users

  • ✔ Supports distributed systems


Summary

👉 VFS acts as a bridge between user programs and multiple file systems, providing a single unified interface while internally handling different implementations.



👉 VFS is an abstraction layer in UNIX that provides a uniform interface to access different file systems using common operations like open, read, and write.

Comments

Popular posts from this blog

Operating Systems OS PCCST403 Semester 4 BTech KTU CS 2024 Scheme

Introduction to Operating System -Virtualization, Concurrency, and Persistence

Operating Systems PCCST403 Scheme and Syllabus