File system
Also called Filesystem, FS
A file system is the layer of an operating system that organizes the blocks of a disk into named files and directories. It tracks where the data of each file lives, along with metadata such as its owner and permissions. This bookkeeping lives on the disk itself, in structures such as inodes that point to the blocks of each file. Directories are files too, mapping names to those structures.
Programs work with paths and files instead of block numbers, and the file system turns each read or write into operations on the disk. It also keeps the disk consistent when a machine loses power in the middle of a write. Most modern file systems do this with a journal, a log where each change is written before it is applied. After a crash, they replay or discard the unfinished entries instead of scanning the whole disk.
Each file system trades speed against safety in its own way. Linux servers mostly use ext4 or XFS. Desktop systems have their own, such as APFS on macOS and NTFS on Windows. Some, such as Btrfs and ZFS, add checksums that catch data the drive has silently corrupted. Those extras cost memory and processor time that a simpler file system does not spend.
Overlay file systems
Overlay file systems are file systems that stack several read-only layers under one writable layer and show the result as a single tree. On Linux, OverlayFS is the common implementation and ships with the kernel. The lower layers are ordinary directories, and the overlay only changes how lookups pass through them. Nothing is merged on disk, so taking the overlay down leaves each layer as it was.
A read finds the topmost layer that holds the file, and a write first copies the file up into the writable layer. This copy-on-write step leaves the lower layers untouched, so many machines can share them. A deletion leaves a marker in the writable layer that hides the file below without removing it. Renaming a directory is awkward for the same reason, since its contents may sit in a layer that cannot change.
Container images are built this way, with each build step adding a layer on top of the last. Two images that start from the same base store that base once, which saves disk space and download time. A registry stores each layer under a hash of its contents, so a host fetches only the layers it lacks. The order of steps matters as a result: a change near the base forces every layer above it to be rebuilt.
Shared host directories
Shared host directories are directories on a host that a virtual machine mounts as part of its own file system. The guest reads and writes the host's files directly, without copying them onto a virtual disk. Changes show up on both sides at once, which suits source code edited on the host and built in the guest. The guest sees an ordinary mount, while the host keeps ownership of the files.
The 9p protocol was an early way to do this, passing each file operation from guest to host as a message. Virtio-fs replaces it with a FUSE-based design that shares memory with the host and runs much faster. A process on the host serves the requests and applies them to the real directory. Through the shared memory window, file contents can be mapped straight into the guest instead of copied through messages.
Sharing a directory crosses the boundary between guest and host, so it weakens isolation. A host that runs untrusted guests shares only the directories it means to expose, often read-only. A flaw in the host process that serves the files becomes a path out of the guest. Hosts limit the damage by running that process with few privileges and access to nothing but the shared directory.
Network file systems
Network file systems are file systems whose files live on another machine and travel over the network on each access. NFS and SMB are the common protocols, and many machines can mount the same share at once. A server owns the real file system and answers requests from its clients. Clients cache data and metadata to avoid a round trip on every access, at the cost of sometimes seeing stale files.
FUSE lets a program outside the kernel implement a file system, which makes it possible to mount object storage as a directory. Tools such as s3fs and Mountpoint for Amazon S3 present each object as a file. The kernel passes each file operation to that program, which answers it however it likes. Every call crosses between the kernel and the program, a cost that a file system inside the kernel does not pay.
These mounts look like a local disk but do not behave like one. Every access pays network latency, and object storage cannot change part of an object, so small edits rewrite whole files. Operations that are cheap on a local disk, such as renaming a directory or listing a large one, can turn into many slow requests. File locks and other guarantees that programs take for granted may be weaker or missing.