Jump to content

Virtual file system

From Wikipedia, the free encyclopedia

Avirtual file system(VFS) orvirtual filesystem switchis an abstract layer on top of a more concretefile system.The purpose of a VFS is to allow client applications to access different types of concrete file systems in a uniform way. A VFS can, for example, be used to accesslocaland network storage devices transparently without the client application noticing the difference. It can be used to bridge the differences inWindows,classic Mac OS/macOSandUnixfilesystems, so that applications can access files on local file systems of those types without having to know what type of file system they are accessing.

A VFS specifies aninterface(or a "contract" ) between thekerneland a concrete file system. Therefore, it is easy to add support for new file system types to the kernel simply by fulfilling the contract. The terms of the contract might change incompatibly from release to release, which would require that concrete file system support be recompiled, and possibly modified before recompilation, to allow it to work with a new release of the operating system; or the supplier of the operating system might make only backward-compatible changes to the contract, so that concrete file system support built for a given release of the operating system would work with future versions of the operating system.

Implementations

[edit]
The position of the VFS layer within various parts of theLinux kernel's storage stack.[1]

One of the first virtual file system mechanisms onUnix-likesystems was introduced bySun MicrosystemsinSunOS2.0 in 1985.[2]It allowed Unix system calls to access localUFSfile systems and remoteNFSfile systems transparently. For this reason, Unix vendors who licensed the NFS code from Sun often copied the design of Sun's VFS. Other file systems could be plugged into it also: there was an implementation of theMS-DOSFATfile system developed at Sun that plugged into the SunOS VFS, although it wasn't shipped as a product until SunOS 4.1. The SunOS implementation was the basis of the VFS mechanism inSystem V Release 4.

John Heidemanndeveloped astackingVFS under SunOS 4.0 for the experimentalFicus file system.This design provided forcode reuseamong file system types with differing but similar semantics (e.g.,an encrypting file system could reuse all of the naming and storage-management code of a non-encrypting file system). Heidemann adapted this work for use in4.4BSDas a part of histhesisresearch; descendants of this code underpin the file system implementations in modern BSD derivatives includingmacOS.

Other Unix virtual file systems include the File System Switch inSystem V Release 3,the Generic File System inUltrix,and the VFS inLinux.InOS/2andMicrosoft Windows,the virtual file system mechanism is called theInstallable File System.

TheFilesystem in Userspace(FUSE) mechanism allowsuserlandcode to plug into the virtual file system mechanism in Linux,NetBSD,FreeBSD,OpenSolaris,and macOS.

In Microsoft Windows, virtual filesystems can also be implemented through userlandShell namespace extensions;however, they do not support the lowest-level file system accessapplication programming interfacesin Windows, so not all applications will be able to access file systems that are implemented as namespace extensions.KIOandGVfs/GIOprovide similar mechanisms in theKDEandGNOMEdesktop environments (respectively), with similar limitations, although they can be made to use FUSE techniques and therefore integrate smoothly into the system.

Single-file virtual file systems

[edit]

Sometimes Virtual File System refers to a file or a group of files (not necessarily inside a concrete file system) that acts as a manageable container which should provide the functionality of a concrete file system through the usage of software. Examples of such containers are CBFS Storage or asingle-file virtual file systemin an emulator likePCTaskor so-calledWinUAE,Oracle'sVirtualBox,Microsoft'sVirtual PC,VMware.

The primary benefit for this type of file system is that it is centralized and easy to remove. A single-file virtual file system may include all the basic features expected of any file system (virtual or otherwise), but access to the internal structure of these file systems is often limited to programs specifically written to make use of the single-file virtual file system (instead of implementation through a driver allowing universal access). Another major drawback is that performance is relatively low when compared to other virtual file systems. Low performance is mostly due to the cost of shuffling virtual files when data is written or deleted from the virtual file system.

Implementation of single-file virtual filesystems

[edit]

Direct examples of single-file virtual file systems include emulators, such as PCTask and WinUAE, which encapsulate not only the filesystem data but also emulated disk layout. This makes it easy to treat an OS installation like any other piece of software—transferring it with removable media or over the network.

PCTask

[edit]

TheAmigaemulatorPCTaskemulated anIntelPC8088based machine clocked at 4.77MHz(and later an80486SX clocked at 25 MHz). Users of PCTask could create a file of large size on the Amiga filesystem, and this file would be virtually accessed from the emulator as if it were a real PC Hard Disk. The file could be formatted with the FAT16 filesystem to store normal MS-DOS or Windows files.[1][2]

WinUAE

[edit]

TheUAEforWindows,WinUAE,allows for large single files on Windows to be treated as Amiga file systems. In WinUAE this file is called ahardfile.[3]

UAE could also treat a directory on the host filesystem (Windows,Linux,macOS,AmigaOS) as an Amiga filesystem.[4]

See also

[edit]
  • 9P (protocol)– a distributed file system protocol that maps directly to the VFS layer of Plan 9, making all file system access network-transparent
  • Synthetic file system– a hierarchical interface to non-file objects that appear as if they were regular files in the tree of a disk-based file system

Notes

[edit]
  1. ^Emulation on AmigaComparison between PCX and PCTask, Amiga PC emulators.
  2. ^See alsoThis articleexplaining how it works PCTask.
  3. ^Help About WinUAE(See Hardfile section).
  4. ^Help About WinUAE(See Add Directory section)

References

[edit]
  1. ^Werner Fischer; Georg Schönberger (2015-06-01)."Linux Storage Stack Diagram".Thomas-Krenn.AG.Retrieved2015-06-08.
  2. ^Kleiman, Steve R. (June 1986)."Vnodes: An Architecture for Multiple File System Types in Sun UNIX"(PDF).USENIX Summer.86:238–247. Archived fromthe original(PDF)on 2014-06-29.Retrieved31 December2016.
[edit]