Sys File System (sysfs) in the Linux Kernel

The sysfs is a RAM based virtual file system and provides details on various kernel objects. It provides a means to export kernel data structures, attributes and their linkages between the kernel objects and the user space.

if “CONFIG_SYSFS” is enabled during build, “sysfs” is in-built into the linux image. The  file system can also be mounted by using the command below

mount -t sysfs sysfs /sys

The kernel documentation “https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt” provides information in great detail about sysfs. For every kernel object that is created, a directory is created in sysfs.  The below image shows the different folders that are present in “/sys” folder. It can be seen that most of the different Linux subsystems are placed in hierarchies and each has its own folder.

sysfs APIs and sample sysfs implementation in the Linux Kernel

Comments

  1. Pingback: Linux – Proc File system – Part 2 | Hitch Hiker's Guide to Learning

Leave a Reply

Your email address will not be published. Required fields are marked *