sysfs is a
pseudo file system provided by the
Linux kernel that exports information about various kernel subsystems, hardware devices, and associated
device drivers from the kernel's device model to
user space through
virtual files.
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 the
sysctl mechanism found in
BSD operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s, 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 of
procfs
The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized meth ...
, not sysfs which is mounted at ''/sys/''.
History
During the 2.5 development cycle, the Linux driver model was introduced to fix the following shortcomings of version 2.4:
* No unified method of representing driver-device relationships existed.
* There was no generic
hotplug mechanism.
*
procfs
The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized meth ...
was cluttered with non-process information.
Sysfs was designed to export the information present in the
device tree which would then no longer clutter up procfs. It was written by Patrick Mochel.
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.
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 mount point. If it is not mounted during initialization, you can always mount it using the command: "mount -t sysfs sysfs /sys"
Supported buses
; ACPI
: Exports information about
ACPI devices.
; PCI
: Exports information about
PCI and
PCI Express devices.
; PCI Express
: Exports information about
PCI Express devices.
; USB
: Exports information about
USB devices.
; SCSI
: Exports information about
mass storage devices, including
USB,
SATA
SATA (Serial AT Attachment) is a computer bus interface that connects host adapter, host bus adapters to mass storage devices such as hard disk drives, optical drives, and solid-state drives. Serial ATA succeeded the earlier Parallel ATA (PATA) ...
and
NVMe interfaces.
; S/390 buses
: As the
S/390 architecture contains devices not found elsewhere, special buses have been created:
:* ''css'': Contains subchannels (currently the only driver provided is for I/O subchannels).
:* ''ccw'': Contains channel attached devices (driven by
CCWs).
:* ''ccwgroup'': Artificial devices, created by the user and consisting of ccw devices. Replaces some of the 2.4 chandev functionality.
:* ''iucv'': Artificial devices like netiucv devices which use VM's
IUCV Inter User Communication Vehicle (IUCV) is a data transfer mechanism in IBM VM line of operating systems. It was introduced with VM/SP Release 1 in 1980.
It allows establishment of point to point communication channels, either between two virtual ...
interface.
Sysfs and userspace
Sysfs is used by several utilities to access information about hardware and its driver (
kernel modules) such as
udev or
HAL
HAL may refer to:
Aviation
* Halali Airport (IATA airport code: HAL) Halali, Oshikoto, Namibia
* Hawaiian Airlines (ICAO airline code: HAL)
* HAL Airport, Bangalore, India
* Hindustan Aeronautics Limited an Indian aerospace manufacturer of fight ...
. Scripts have been written to access information previously obtained via
procfs
The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized meth ...
, and some scripts configure device drivers and devices via their attributes.
See also
*
procfs
The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized meth ...
*
configfs
*
tmpfs
tmpfs (short for Temporary File System) is a temporary file storage paradigm implemented in many Unix-like operating systems. It is intended to appear as a mounted file system, but data is stored in volatile memory instead of a persistent stora ...
*
sysctl, alternative way of exporting configuration used in BSD systems
References
External links
Driver model overview from the LWN porting to 2.6 serieskobjects and sysfs from the LWN porting to 2.6 seriesRamfsThe sysfs Filesystem, OLS'05Documentation/filesystems/sysfs.txtLinux kernel documentation for sysfs
{{File systems
Free special-purpose file systems
Interfaces of the Linux kernel
Linux kernel features
Pseudo file systems supported by the Linux kernel