Homepage › Forums › Articles › Filesystems › SysFS and ConfigFS
Tagged: configfs, filesystem, pseudo-filesystem, sysfs, virtual-filesystem
This topic was published by DevynCJohnson and viewed 1743 times since "". The last page revision was "".
- Topics - 437
Linux has two complimentary virtual filesystems - sysfs and configfs. A virtual filesystem is a filesystem on top of another filesystem. sysfs and configfs exist on the memory. The mount point for sysfs is /sys/ or /sysfs/. However, configfs may be mounted in /config/ or /sys/kernel/config/, but not always. configfs is not required to be mounted, so it may not have a mount point.
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.
configfs is also a virtual filesystem on memory. While sysfs displays information and kernel objects, configfs is used to change, make, and delete kernel objects and data. configfs is a kernel manager in the form of a filesystem. If configfs is not mounted, then use the following command to mount configfs in /config/.
mount -t configfs none /config
With root privileges, files on configfs can be changed as follows or by using your preferred file editor like vi, emacs, pico, etc.
echo "STRING" > /config/FILE/PATH
- DebugFS, SecurityFS, PipeFS, and SockFS - http://dcjtech.info/topic/debugfs-securityfs-pipefs-and-sockfs/
- ProcFS - http://dcjtech.info/topic/procfs/
- SpecFS, DevFS, and Other Pseudo-Filesystems - http://dcjtech.info/topic/specfs-devfs-tmpfs-and-other-pseudofilesystems/
- USBdev, usbfs, subfs, and Others - http://dcjtech.info/topic/usbdev-usbfs-subfs-and-others/
- FUSE - http://dcjtech.info/topic/fuse/
- Overview of FUSE Filesystems - http://dcjtech.info/topic/overview-of-fuse-filesystems/
- More Virtual Filesystems for Linux - http://dcjtech.info/topic/more-virtual-filesystems-for-linux/
- More Filesystem Topics - http://dcjtech.info/topic/filesystems/