Traditionally, filesystems are used to store data persistently on block devices. However, it is also possible to use filesystems to organize, present, and exchange information that is not stored on block devices, but dynamically generated by the kernel. This chapter examines some of them:
The proc filesystem enables the kernel to generate information on the state and configuration of the system. This information can be read from normal files by users and system programs without the need for special tools for communication with the kernel; in some cases, a simple
cat is sufficient. Data can not only be read from the kernel, but also sent to it by writing character strings to a file of the
echo "value">/proc/file—there's no easier way of transferring information from userspace to the kernel.
This approach makes use of a virtual filesystem that generates file information "on the fly," in other words, only when requested to do by read operations. A dedicated hard disk partition or some other block storage device is not needed with filesystems of this type.
In addition to the
proc filesystem, the kernel provides many other virtual filesystems for various purposes, for example, for the management of all devices and system resources cataloged in the form of files in hierarchically structured directories. Even device drivers can make status information available in virtual filesystems, the USB subsystem being one such example. ...