Sysfs is a virtual file system provided by Linux. It is a ram-based file-system initially based on ramfs. It provides a means to export kernel data structures, their attributes, and the linkages between them to userspace.
Sysfs exports information about devices and drivers from the kernel device model to user space, and is also used for configuration. The Linux 2.6 kernel introduced this. It is similar to the sysctl mechanism found in BSD systems, but implemented as a file system instead of a separate mechanism.
It provides a view of the kobject object hierarchy. It enables users to view the device topology of their system as a simple filesystem.
The sysfs file system is mounted at /sys/ and contains directories that organize the devices attached to the system in several different ways. The /sysfs/ subdirectories include:
- The /devices/ directory - represent all the subchannels detected by the Linux kernel and configuration options for the device
- The /bus/ directory - contains contains a symbolic link to the device directories and for each device driver currently loaded on the system.
- The /class/ directory - contains directories that group together similar devices such as ttys, SCSI tape drives, network devices, and other miscellaneous devices.
- The /block/ directory - contains directories for each of the block devices on the system.