Virtual le system
A virtual le system (VFS) or virtual lesystem switch
is an abstraction layer on top of a more concrete le system. The purpose of a VFS is to allow client applications
to access dierent types of concrete le systems in a uniform way. A VFS can, for example, be used to access
local and network storage devices transparently without
the client application noticing the dierence. It can be
used to bridge the dierences in Windows, Mac OS and
Unix lesystems, so that applications can access les on
local le systems of those types without having to know
what type of le system they are accessing.
malloc
...
stat(2)
chmod(2)
open(2)
read(2)
write(2)
USB
Virtual Host
FireWire
tcm_usb_gadget
sbp_target
vfs_writev, vfs_readv, ...
VFS
Block-based FS
ext2 ext3 ext4 xfs
Direct I/O
(O_DIRECT)
target_core_mod
target_core_le
btrfs
ifs
gfs
ocfs
Pseudo FS
Network FS
NFS
coda
...
smbfs
iso9660
...
proc
Special
purpose FS
sysfs
pipefs futexfs
...
ceph
usbfs
Page
cache
tmpfs ramfs
devtmpfs
Stackable FS
target_core_iblock
target_core_pscsi
ecryptfs
overlayfs
FUSE
unionfs
userspace (e.g. sshfs)
network
target_core_user
(optional)
stackable
struct bio
Devices on top of normal
block devices
LVM
drbd
device mapper mdraid
dm-crypt
dm-mirror
...
dm-cache dm-thin
bcache
BIOs (block I/Os)
dm-raid
userspace
- sector on disk
- sector cnt
- bio_vec cnt
- bio_vec index
- bio_vec list
BIOs (block I/Os)
dm-delay
BIOs
BIOs
BIOs
Block Layer
I/O scheduler
blkmq
Maps BIOs to requests
multi queue
noop
...
cfq
A VFS species an interface (or a contract) between
the kernel and a concrete le system. Therefore, it is easy
to add support for new le system types to the kernel
simply by fullling the contract. The terms of the contract might change incompatibly from release to release,
which would require that concrete le system support be
recompiled, and possibly modied 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 le system support built for a given release of the operating system would work with future versions of the operating system.
mmap
(anonymous pages)
Applications (processes)
LIO
tcm_vhost
ISCSI
Fibre Channel
version 4.0, 2015-06-01
outlines the Linux storage stack as of Kernel version 4.0
tcm_qla2xxx
iscsi_target_mod
tcm_fc
Fibre Channel
over Ethernet
The Linux Storage Stack Diagram
hooked in device drivers
(they hook in like stacked
devices do)
Software
queues
deadline
Hardware
dispatch
queue
...
Request
based drivers
Hardware
dispatch
queues
BIO
based drivers
Request
based drivers
Request-based
device mapper targets
dm-multipath
SCSI mid layer
/dev/zram* /dev/rbd*
scsi-mq
SCSI upper level drivers
...
/dev/sda /dev/sd*
sysfs
(transport attributes)
Transport classes
scsi_transport_fc
/dev/sr*
/dev/skd*
/dev/mmcblk*p*
/dev/nullb*
/dev/vd*
/dev/rssd*
mmc
null_blk
virtio_blk
mtip32xx nvme
/dev/nvme*n*
/dev/st*
zram
scsi_transport_sas
rbd
/dev/rsxx*
skd
rsxx
network
scsi_transport_...
memory
SCSI low level drivers
libata
megaraid_sas
ahci ata_piix ...
qla2xxx
pm8001
iscsi_tcp virtio_scsi
mpt3sas
lpfc
aacraid
ufs
...
vmw_pvscsi
network
HDD
SSD
DVD
drive
Physical devices
LSI
RAID
Qlogic
HBA
Adaptec
RAID
PMC-Sierra
HBA
Emulex
HBA
LSI 12Gbs
SAS HBA
para-virtualized
SCSI
virtio_pci
VMware's
para-virtualized
SCSI
mobile device
ash memory
Micron
PCIe card
SD-/MMC-Card
nvme
device
stec
device
IBM ash
adapter
The Linux Storage Stack Diagram
http://www.thomas-krenn.com/en/wiki/Linux_Storage_Stack_Diagram
Created by Werner Fischer and Georg Schnberger
License: CC-BY-SA 3.0, see http://creativecommons.org/licenses/by-sa/3.0/
The position of the VFS layer within various parts of the Linux
kernel's storage stack.[1]
Implementations
One of the rst virtual le system mechanisms on Unixlike systems was introduced by Sun Microsystems in
SunOS 2.0 in 1985. It allowed Unix system calls to access local UFS le systems and remote NFS le systems
transparently. For this reason, Unix vendors who licensed
the NFS code from Sun often copied the design of Suns
VFS. Other le systems could be plugged into it also:
there was an implementation of the MS-DOS FAT le
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 in System V Release 4.
including Mac OS X.
Other Unix virtual le systems include the File System
Switch in System V Release 3, the Generic File System
in Ultrix, and the VFS in Linux. In OS/2 and Microsoft
Windows, the virtual le system mechanism is called the
Installable File System.
The Filesystem in Userspace (FUSE) mechanism allows
userland code to plug into the virtual le system mechanism in Linux, NetBSD, FreeBSD, OpenSolaris, and
Mac OS X.
In Microsoft Windows, virtual lesystems can also be implemented through userland Shell namespace extensions;
however, they do not support the lowest-level le system
access application programming interfaces in Windows,
so not all applications will be able to access le systems
that are implemented as namespace extensions. KIO and
GVFS/GIO provide similar mechanisms in the KDE and
GNOME desktop environments (respectively), with similar limitations, although they can be made to use FUSE
techniques and therefore integrate smoothly into the sys-
John Heidemann developed a stacking VFS under SunOS
4.0 for the experimental Ficus le system. This design provided for code reuse among le system types
with diering but similar semantics (e.g., an encrypting
le system could reuse all of the naming and storagemanagement code of a non-encrypting le system). Heidemann adapted this work for use in 4.4BSD as a part of
his thesis research; descendants of this code underpin the
le system implementations in modern BSD derivatives
1
3 See also
tem.
Single-le virtual le systems
Sometimes Virtual File System refers to a le or a group
of les (not necessarily inside a concrete le system) that
acts as a manageable container which should provide the
functionality of a concrete le system through the usage
of software. Examples of such containers are SolFS or a
single-le virtual le system in an emulator like PCTask
or so-called WinUAE, Oracles VirtualBox, Microsofts
Virtual PC, VMware.
The primary benet for this type of le system is that it
is centralized and easy to remove. A single-le virtual
le system may include all the basic features expected of
any le system (virtual or otherwise), but access to the
internal structure of these le systems is often limited to
programs specically written to make use of the singlele virtual le system (instead of implementation through
a driver allowing universal access). Another major drawback is that performance is relatively low when compared
to other virtual le systems. Low performance is mostly
due to the cost of shuing virtual les when data is written or deleted from the virtual le system.
2.1
Implementation of single-le virtual
lesystems
Direct examples of single-le virtual le systems include
emulators, such as PCTask and WinUAE, which encapsulate not only the lesystem data but also emulated disk
layout. This makes it easy to treat an OS installation like
any other piece of softwaretransferring it with removable media or over the network.
2.1.1
PCTask
The Amiga emulator PCTask emulated an Intel PC
8088 based machine clocked at 4.77MHz (and later an
80486SX clocked at 25 MHz). Users of PCTask could
create a le of large size on the Amiga lesystem, and
this le would be virtually accessed from the emulator as
if it were a real PC Hard Disk. The le could be formatted with the FAT16 lesystem to store normal MS-DOS
or Windows les.[1][2]
2.1.2
REFERENCES
WinUAE
The UAE for Windows, WinUAE, allows for large single
les on Windows to be treated as Amiga le systems. In
WinUAE this le is called a hardle.[3]
UAE could also treat a directory on the host lesystem
-- (Windows, Linux, Mac OS, AmigaOS) -- as an Amiga
lesystem.[4]
9P (protocol) a distributed le system protocol that
maps directly to the VFS layer of Plan 9, making all
le system access network-transparent
4 Notes
1. ^ Emulation on Amiga Comparison between PCX
and PCTask, Amiga PC emulators.
2. ^ See also This article explaining how it works PCTask.
3. ^ Help About WinUAE (See Hardle section).
4. ^ Help About WinUAE (See Add Directory section)
5 References
[1] Werner Fischer; Georg Schnberger (2015-06-01).
Linux Storage Stack Diagram. Thomas-Krenn.AG. Retrieved 2015-06-08.
Vnodes: An Architecture for Multiple File System
Types in Sun UNIX
Linux kernels Virtual File System
Rodriguez, R.; M. Koehler; R. Hyde (June 1986).
The Generic File System. Proceedings of the
USENIX Summer Technical Conference. Atlanta,
Georgia: USENIX Association. pp. 260269.
Karels, M.; M. K. McKusick (September 1986).
Towards a Compatible File System Interface.
Proceedings of the European UNIX Users Group
Meeting. Manchester, England: EUUG. pp. 481
496.
Heidemann, John (1995). Stackable Design of File
Systems (Technical report). UCLA. CSD-950032.
The Linux VFS, Chapter 4 of Linux File Systems
by Moshe Bar (McGraw-Hill, 2001). ISBN 0-07212955-7
Chapter 12 of Understanding the Linux Kernel by
Daniel P. Bovet, Marco Cesati (O'Reilly Media,
2005). ISBN 0-596-00565-2
The Linux VFS Model: Naming structure
External links
AVFS - A Virtual File System for mounting compressed or remote les
fs-driver Ext2 Installable File System for Microsoft
Windows
Anatomy of the Linux le system by M. Tim Jones
Solid File System - (SolFS) cross-platform singlele virtual le system with encryption and compression
Callback File System - SDK that lets developers create virtual le systems for Windows in user mode
FUSE - Filesystem in Userspace - virtual lesystem
for Linux.
LUFS - Linux Userland Filesystem - virtual lesystem with support of localfs, sshfs, ftpfs, gnutellafs,
locasefs, gvfs, cardfs, cefs and more. Latest le release: 2003-10-29
TrueVFS - Virtual File System for Java, with threadsafe read/write access to ZIP, ZIP.RAES, TAR,
TAR.BZ2, TAR.GZ, TAR.XZ, ODF, HTTP(S) etc.
Commons VFS - virtual lesystem for Java, with
support for Cifs, ftp, http, Zip (le format), Tar (le
format), gzip, bzip2, and more.
MillScript VFS - virtual lesystem for Java, inuenced by the KIO subsystem in KDE, Steve Leachs
work on a VFS in JSpice and to a limited extent the
Apache Commons VFS.
KIO - (KDE IO) - a network-enabled le management system
ipcode - Programming a Virtual File System
Dokan - A free and open source virtual lesystem for
Windows (includes C, .NET, and Ruby bindings).
JPfm - a cross-platform virtual lesystem in user
space library written in java.
7 TEXT AND IMAGE SOURCES, CONTRIBUTORS, AND LICENSES
Text and image sources, contributors, and licenses
7.1
Text
Virtual le system Source: https://en.wikipedia.org/wiki/Virtual_file_system?oldid=678497966 Contributors: Kku, Dcljr, Error, Furrykef, Itai, Phil Boswell, David Gerard, AlistairMcMillan, Eric B. and Rakim, Hellisp, John Vandenberg, LeonardoGregianin, Falsian,
Elifarley, Guy Harris, Fritz Saalfeld, Smoothy, Suruena, Voxadam, Lost.goblin, Toussaint, Reisio, Pdelong, Etamura, Raaele Megabyte,
NorkNork, Chobot, 121a0012, YurikBot, Mipadi, Jsnx, SmackBot, Pbb, Mre5765, Bluebot, Frap, Mwtoews, TPO-bot, Harryboyles,
EdC~enwiki, TerryE, Stuartkonen, A876, PKT, Widefox, Tedickey, MoazReyad, Aphthong, Kyle the bot, OlavN, Matt.s.wise, ToePeu.bot,
Jerryobject, Mayevski, 05, Lightmouse, Martarius, LukeShu, Jurasik~enwiki, Andy16666, Shashaanktulsyan, Dsimic, Addbot,
Ghettoblaster, Debresser, Fiftyquid, Luckas-bot, Yobot, Gamebouille, Roseatefairy, Wscher, Xiaoshuang, MastiBot, ZxPezz, Trappist
the monk, Nelsonlombardo, CherryX, Hundblue, ChrisGualtieri, Monkbot, Mattyjtcx and Anonymous: 64
7.2
Images
File:Edit-clear.svg Source: https://upload.wikimedia.org/wikipedia/en/f/f2/Edit-clear.svg License: Public domain Contributors: The
Tango! Desktop Project. Original artist:
The people from the Tango! project. And according to the meta-data in the le, specically: Andreas Nilsson, and Jakub Steiner (although
minimally).
File:IO_stack_of_the_Linux_kernel.svg Source: https://upload.wikimedia.org/wikipedia/commons/3/30/IO_stack_of_the_Linux_
kernel.svg License: CC BY-SA 3.0 Contributors: https://www.thomas-krenn.com/en/wiki/Linux_Storage_Stack_Diagram (created by
Werner Fischer and Georg Schnberger) Original artist: wscher (<a href='//commons.wikimedia.org/wiki/User_talk:Wfischer' title='User
talk:Wfischer'>talk</a>)
File:Text_document_with_red_question_mark.svg Source: https://upload.wikimedia.org/wikipedia/commons/a/a4/Text_document_
with_red_question_mark.svg License: Public domain Contributors: Created by bdesham with Inkscape; based upon Text-x-generic.svg
from the Tango project. Original artist: Benjamin D. Esham (bdesham)
7.3
Content license
Creative Commons Attribution-Share Alike 3.0