sysfs is apseudo file system provided by theLinux kernel that exports information about various kernel subsystems, hardware devices, and associateddevice drivers from the kernel's device model touser space throughvirtual files.[1] In addition to providing information about various devices and kernel subsystems, exported virtual files are also used for their configuration.
sysfs provides functionality similar to thesysctl mechanism found inBSDoperating systems, with the difference that sysfs is implemented as a virtual file system instead of being a purpose-built kernel mechanism, and that, in Linux,sysctl configuration parameters are made available at/proc/sys/ as part ofprocfs, not sysfs which is mounted at/sys/.[2]
During the 2.5 development cycle, the Linux driver model was introduced to fix the following shortcomings of version 2.4:
Sysfs was designed to export the information present in thedevice tree which would then no longer clutter up procfs. It was written by Patrick Mochel.[3][4] Maneesh Soni later wrote the sysfs backing store patch to reduce memory usage on large systems.
During the next year of 2.5 development the infrastructural capabilities of the driver model and driverfs began to prove useful to other subsystems.[5][6]kobjects were developed to provide a central object management mechanism and driverfs was renamed to sysfs to represent its subsystem agnosticism.
Sysfs is mounted under the/sys mount point. If it is not mounted automatically during initialization, it can be mounted manually using themount
command:mount -t sysfs sysfs /sys
.[1]
Sysfs is used by several utilities to access information about hardware and its driver (kernel modules) such asudev orHAL. Scripts have been written to access information previously obtained viaprocfs, and some scripts configure device drivers and devices via their attributes.
sysctl is used to modify kernel parameters at runtime. The parameters available are those listed under /proc/sys/. Procfs is required for sysctl support in Linux. You can use sysctl to both read and write sysctl data.