Picture a computer with an SSD for the OS and programs, a Hard Drive for user files and a thumb drive plugged in. Each of these storage devices has its own filesystem with its own contents, but the OS must be able to access contents on each one.
Linux handles this situation using what it calls the Virtual Filesystem (or VFS, for short). The Virtual Filesystem is a “fake” filesystem for the system to use, which is built using the real filesystems on storage devices and a few pseudo filesystems used by the OS.
Everything is a file™
Maybe you’ve heard that in Linux everything is a file. This refers to the fact that Linux handles physical devices as files in the VFS. To interact with a device, such as a storage device, a printer or a usb device, the path to the file represents the device itself.
For instance, the first storage device to be detected will be represented by the file in /dev/sda
, the second device will appear as /dev/sdb
, the first partition in the first device will be /dev/sda1
and so on.

In Unix terminology, storage devices are classified as block devices, since they can transfer large blocks of data at a time. Devices that are limited to transfer one character at a time are called character devices.
And the Virtual Filesystem does contain some folders and files which aren’t really there, in the sense that they don’t exist in any mounted storage device. /dev/sda
and /dev/sdb
, from our previous example, aren’t stored as bits in any disk, but were created by the OS on the go as the devices were detected. Same happens with the contents of the /dev
, /proc
and /sys
directories. They are all pseudo-filesystems which perform different functions for the OS (but for now we only care about /dev
, which contains the device nodes, as these files are properly called).
Mounting
A physical device plugged into a Linux machine must be mounted to be used. Mounting is the process of inserting the actual contents of a filesystem into the VFS. The directory where the device is mounted (called mountpoint) will seem to contain the device contents. For instance, on my personal machine I use different partitions for storing my files and the system files, but as the partition with my files is mounted on /home
(where files for all users are stored under the Unix standard), its seems (and works) just as if everything was in the same partition.

/etc
and the ones in /home/santiago
behave as if they were on the same device. They’re actually in different partitions (sda5
and sda6
), but thanks to mounting the transition between devices is seamlessThe main storage device on the computer (where the programs and libraries are stored) must be mounted on /
(the root of the VFS), and extra devices can be mounted in any subfolder.
To mount a device, you can use the program mount on the terminal. You need to specify the device (using its path in /dev
) and its desired mountpoint, alongside some mounting options if neccesary. To unmount it, you can use the umount command. You can find more details on their man
pages.
Automatic Mounting with fstab
There are some devices that you expect to be plugged in, and that you don’t want to mount every time. The /etc/fstab
(short for filesystems table) file contains the devices that should be automatically mounted on boot, alongside their mountpoints, one per line. If you’re using different partitions or drives for say, your user files (something that I highly recommend), they should be specified in this file.
When you install a GNU+Linux system, the fstab is generated automatically with the partition arrangement specified, but you can modify it manually if you change your arrangement.
After modifying the fstab, its recommended to run mount -a
, which will try to mount all devices listed in the file. If there’s an error, you’ll get told, so you can fix the mistake on the spot, without restarting the computer. An error on the fstab can (and probably will) cause the computer to crash while booting.
A typical fstab entry contains:
- The device to mount, indicated with a path (such as
/dev/sda
), the device’s label or its UUID. Its recommended to use either the UUID or the label, since the path may change when the computer is restarted. You can list this information for all plugged devices withsudo blkid
. - The mountpoint
- The device’s filesystem
- The mount parameters
- The dumping parameter, usually 1
- The file checking order, usually 1 for the main storage device, 2 for the rest

/etc/fstab
file. This machine has a root partition, a home partition and a EFI partition which will be mounted at bootReferences
Kili, A. (2023, 26 abril). Everything Is a File and Types of Files in Linux. Explanation Of “Everything Is A File” And Types Of Files In Linux. https://www.tecmint.com/everything-is-file-and-types-of-files-linux/
Featured image by benjamin lehman on Unsplash
Leave a Reply