sysfs Linux ( /sys )

This is where HAL (Hardware Abstraction Layer) keeps the database of devices that are connected to the computer, but HAL uses udev to show these devices in a user-friendly way under /dev/


Linux has two complimentary virtual filesystems – sysfs and configfs. A virtual filesystem is a filesystem on top of another filesystem

The mount point for sysfs is /sys/ or /sysfs/.

sysfs – At one point in kernel development, the kernel lacked a general hot-plug system and procfs contain information not relating to processes. As a result, sysfs (SYStem FileSystem) was created for kernel v2.5. This virtual filesystem contains device and driver information as well as various kernel data. sysfs provides an interface between kernelspace and userspace. Just like procfs, sysfs is highly organized and standardized, although some changes and tweaks exist between different kernel versions. Some of the directories are discussed below.

*/sys/block/ – This directory contains shortcuts to the sysfs files of the selected block device.

*/sys/bus/ – This directory contains the sysfs files and data for the different buses on the system.

*/sys/class/ – This directory contains folders named by device type like “printers”, “mem”, “leds”, “input”, etc. The subdirectories then contain shortcuts to the sysfs files pertaining to the selected device. This is useful for when a user is looking for a particular device. They can then go through this route.

*/sys/dev/ – Inside, there are two folders – “block” and “char” which direct users to the block and character devices respectively.

*/sys/devices/ – Most of the symbolic/soft links (shortcuts) in the sysfs system link to devices and files here.

*/sys/firmware/ – Files containing information and settings for the system’s firmware resides here.

*/sys/fs/ – Information and settings pertaining to each individual mounted filesystem is placed here by filesystem type. This means there is a folder titled “ext4” which holds the folders for each device/partition with ext4.

*/sys/hypervisor/ – Data pertaining to the hypervisor is stored here.

*/sys/kernel/ – Settings, information, and security policies reside in this folder.

*/sys/module/ – All of the loaded modules can be seen here. Each folder contains information and settings for that particular module.

*/sys/power/ – This directory contains files with information on the power state, the number of times the system hibernated/slept, etc.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: