# Sysfs

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Sysfs
> Markdown URL: https://mediated.wiki/source/Sysfs.md
> Source: https://en.wikipedia.org/wiki/Sysfs
> Source revision: 1330806174
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Pseudo file system provided by the Linux kernel}}
{{Lowercase title}}
'''sysfs''' is a [pseudo file system](/source/pseudo_file_system) provided by the [Linux kernel](/source/Linux_kernel) that exports information about various kernel subsystems, hardware devices, and associated [device driver](/source/device_driver)s from the kernel's device model to [user space](/source/user_space) through [virtual file](/source/virtual_file)s.<ref name="sysfs-kernel-doc" >{{cite web|url=https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt|title=sysfs - _The_ filesystem for exporting kernel objects|author=Patrick Mochel and Mike Murphy|publisher=[kernel.org](/source/kernel.org)}}</ref>  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](/source/sysctl) mechanism found in [BSD](/source/BSD) [operating system](/source/operating_system)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](/source/procfs), not sysfs which is mounted at ''/sys/''.<ref name="freebsd">{{cite web|quote=sysctl  is  used to modify kernel parameters at runtime.  The parameters available are those listed under /proc/sys/.  Procfs is required for  sysctl support in Linux.  You can use sysctl to both read and write sysctl data.|url=https://www.freebsd.org/cgi/man.cgi?query=sysctl&sektion=8&manpath=SuSE+Linux%2fi386+11.3|publisher=FreeBSD|author=SUSE|title=sysctl man page}}</ref>

== 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](/source/Hot_swapping) mechanism.
* [procfs](/source/procfs) was cluttered with non-process information.

Sysfs was designed to export the information present in the [device tree](/source/device_tree) which would then no longer clutter up procfs. It was written by Patrick Mochel.<ref name="linux-v2.5.44">{{cite web |first=Linus |last=Torvalds |title=Linux v2.5.44 - and offline for a week |date=18 October 2002 |url=https://lkml.org/lkml/2002/10/19/8}}</ref><ref name="linux-v2.5.46">{{cite web |first=Linus |last=Torvalds |title=Linux v2.5.46 |date=4 November 2002 |url=https://lkml.org/lkml/2002/11/4/213}}</ref> 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.<ref name="new-driver-model">{{cite web |first=Patrick |last=Mochel |title=[RFC] New Driver Model for 2.5 |date=17 October 2001 |url=https://lkml.org/lkml/2001/10/17/147}}</ref><ref name="proposal-replacement">{{cite web |first=Tim |last=Jansen |title=Re: [PATCH] 2.5 PROPOSAL: Replacement for current /proc of shit. |date=1 November 2001 |url=https://lkml.org/lkml/2001/11/1/38}}</ref> [kobjects](/source/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 {{mono|/sys}} mount point. If it is not mounted automatically during initialization, it can be mounted manually using the <code>[mount](/source/mount_(Unix))</code> command: <code>mount -t sysfs sysfs /sys</code>.<ref name="sysfs-kernel-doc" />

== Supported buses ==
{{Incomplete list|date=January 2026}}
; ACPI
: Exports information about [ACPI](/source/Advanced_Configuration_and_Power_Interface) devices.

; PCI
: Exports information about [PCI](/source/Peripheral_Component_Interconnect) and [PCI Express](/source/PCI_Express) devices.

; PCI Express
: Exports information about [PCI Express](/source/PCI_Express) devices.

; USB
: Exports information about [USB](/source/Universal_Serial_Bus) devices.

; SCSI
: Exports information about [mass storage](/source/mass_storage) devices, including [USB](/source/USB), [SATA](/source/Serial_ATA) and [NVMe](/source/NVMe) interfaces.<ref>{{Cite web|title=SCSI Interfaces Guide — The Linux Kernel documentation|url=https://www.kernel.org/doc/html/latest/driver-api/scsi.html|access-date=2020-11-13|website=www.kernel.org}}</ref>

; S/390 buses
: As the [S/390](/source/S%2F390) 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 [CCW](/source/Channel_command_word)s).
:* ''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](/source/IUCV) interface.

== Sysfs and userspace ==
Sysfs is used by several utilities to access information about hardware and its driver ([kernel modules](/source/Module_(Linux))) such as [udev](/source/udev) or [HAL](/source/HAL_(software)). Scripts have been written to access information previously obtained via [procfs](/source/procfs), and some scripts configure device drivers and devices via their attributes.

==See also==
{{Portal|Linux}}

* [procfs](/source/procfs)
* [configfs](/source/configfs)
* [tmpfs](/source/tmpfs)
* [sysctl](/source/sysctl), alternative way of exporting configuration used in BSD systems

==References==
{{reflist}}

==External links==
*[https://lwn.net/Articles/31185/ Driver model overview from the LWN porting to 2.6 series]
*[https://lwn.net/Articles/54651/ kobjects and sysfs from the LWN porting to 2.6 series]
*[http://wiki.debian.org/ramfs Ramfs]
*[https://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf The sysfs Filesystem, OLS'05]
*[http://kernel.org/doc/Documentation/filesystems/sysfs.txt Documentation/filesystems/sysfs.txt] Linux kernel documentation for sysfs

{{Linux kernel}}
{{File systems}}

Category:Free special-purpose file systems
Category:Interfaces of the Linux kernel
Category:Linux kernel features
Category:Pseudo file systems supported by the Linux kernel

---
Adapted from the Wikipedia article [Sysfs](https://en.wikipedia.org/wiki/Sysfs) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Sysfs?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
