1SYSFS(5) Linux Programmer's Manual SYSFS(5)
2
3
4
6 sysfs - a filesystem for exporting kernel objects
7
9 The sysfs filesystem is a pseudo-filesystem which provides an interface
10 to kernel data structures. (More precisely, the files and directories
11 in sysfs provide a view of the kobject structures defined internally
12 within the kernel.) The files under sysfs provide information about
13 devices, kernel modules, filesystems, and other kernel components.
14
15 The sysfs filesystem is commonly mounted at /sys. Typically, it is
16 mounted automatically by the system, but it can also be mounted manu‐
17 ally using a command such as:
18
19 mount -t sysfs sysfs /sys
20
21 Many of the files in the sysfs filesystem are read-only, but some files
22 are writable, allowing kernel variables to be changed. To avoid redun‐
23 dancy, symbolic links are heavily used to connect entries across the
24 filesystem tree.
25
26 Files and directories
27 The following list describes some of the files and directories under
28 the /sys hierarchy.
29
30 /sys/block
31 This subdirectory contains one symbolic link for each block de‐
32 vice that has been discovered on the system. The symbolic links
33 point to corresponding directories under /sys/devices.
34
35 /sys/bus
36 This directory contains one subdirectory for each of the bus
37 types in the kernel. Inside each of these directories are two
38 subdirectories:
39
40 devices
41 This subdirectory contains symbolic links to entries in
42 /sys/devices that correspond to the devices discovered on
43 this bus.
44
45 drivers
46 This subdirectory contains one subdirectory for each de‐
47 vice driver that is loaded on this bus.
48
49 /sys/class
50 This subdirectory contains a single layer of further subdirecto‐
51 ries for each of the device classes that have been registered on
52 the system (e.g., terminals, network devices, block devices,
53 graphics devices, sound devices, and so on). Inside each of
54 these subdirectories are symbolic links for each of the devices
55 in this class. These symbolic links refer to entries in the
56 /sys/devices directory.
57
58 /sys/class/net
59 Each of the entries in this directory is a symbolic link repre‐
60 senting one of the real or virtual networking devices that are
61 visible in the network namespace of the process that is access‐
62 ing the directory. Each of these symbolic links refers to en‐
63 tries in the /sys/devices directory.
64
65 /sys/dev
66 This directory contains two subdirectories block/ and char/,
67 corresponding, respectively, to the block and character devices
68 on the system. Inside each of these subdirectories are symbolic
69 links with names of the form major-ID:minor-ID, where the ID
70 values correspond to the major and minor ID of a specific de‐
71 vice. Each symbolic link points to the sysfs directory for a
72 device. The symbolic links inside /sys/dev thus provide an easy
73 way to look up the sysfs interface using the device IDs returned
74 by a call to stat(2) (or similar).
75
76 The following shell session shows an example from /sys/dev:
77
78 $ stat -c "%t %T" /dev/null
79 1 3
80 $ readlink /sys/dev/char/1\:3
81 ../../devices/virtual/mem/null
82 $ ls -Fd /sys/devices/virtual/mem/null
83 /sys/devices/virtual/mem/null/
84 $ ls -d1 /sys/devices/virtual/mem/null/*
85 /sys/devices/virtual/mem/null/dev
86 /sys/devices/virtual/mem/null/power/
87 /sys/devices/virtual/mem/null/subsystem@
88 /sys/devices/virtual/mem/null/uevent
89
90 /sys/devices
91 This is a directory that contains a filesystem representation of
92 the kernel device tree, which is a hierarchy of device struc‐
93 tures within the kernel.
94
95 /sys/firmware
96 This subdirectory contains interfaces for viewing and manipulat‐
97 ing firmware-specific objects and attributes.
98
99 /sys/fs
100 This directory contains subdirectories for some filesystems. A
101 filesystem will have a subdirectory here only if it chose to ex‐
102 plicitly create the subdirectory.
103
104 /sys/fs/cgroup
105 This directory conventionally is used as a mount point for a
106 tmpfs(5) filesystem containing mount points for cgroups(7)
107 filesystems.
108
109 /sys/fs/smackfs
110 The directory contains configuration files for the SMACK LSM.
111 See the kernel source file Documentation/ad‐
112 min-guide/LSM/Smack.rst.
113
114 /sys/hypervisor
115 [To be documented]
116
117 /sys/kernel
118 This subdirectory contains various files and subdirectories that
119 provide information about the running kernel.
120
121 /sys/kernel/cgroup/
122 For information about the files in this directory, see
123 cgroups(7).
124
125 /sys/kernel/debug/tracing
126 Mount point for the tracefs filesystem used by the kernel's
127 ftrace facility. (For information on ftrace, see the kernel
128 source file Documentation/trace/ftrace.txt.)
129
130 /sys/kernel/mm
131 This subdirectory contains various files and subdirectories that
132 provide information about the kernel's memory management subsys‐
133 tem.
134
135 /sys/kernel/mm/hugepages
136 This subdirectory contains one subdirectory for each of the huge
137 page sizes that the system supports. The subdirectory name in‐
138 dicates the huge page size (e.g., hugepages-2048kB). Within
139 each of these subdirectories is a set of files that can be used
140 to view and (in some cases) change settings associated with that
141 huge page size. For further information, see the kernel source
142 file Documentation/admin-guide/mm/hugetlbpage.rst.
143
144 /sys/module
145 This subdirectory contains one subdirectory for each module that
146 is loaded into the kernel. The name of each directory is the
147 name of the module. In each of the subdirectories, there may be
148 following files:
149
150 coresize
151 [to be documented]
152
153 initsize
154 [to be documented]
155
156 initstate
157 [to be documented]
158
159 refcnt [to be documented]
160
161 srcversion
162 [to be documented]
163
164 taint [to be documented]
165
166 uevent [to be documented]
167
168 version
169 [to be documented]
170
171 In each of the subdirectories, there may be following subdirec‐
172 tories:
173
174 drivers
175 [To be documented]
176
177 holders
178 [To be documented]
179
180 notes [To be documented]
181
182 parameters
183 This directory contains one file for each module parame‐
184 ter, with each file containing the value of the corre‐
185 sponding parameter. Some of these files are writable,
186 allowing the
187
188 sections
189 This subdirectories contains files with information about
190 module sections. This information is mainly used for de‐
191 bugging.
192
193 [To be documented]
194
195 /sys/power
196 [To be documented]
197
199 The sysfs filesystem first appeared in Linux 2.6.0.
200
202 The sysfs filesystem is Linux-specific.
203
205 This manual page is incomplete, possibly inaccurate, and is the kind of
206 thing that needs to be updated very often.
207
209 proc(5), udev(7)
210
211 P. Mochel. (2005). The sysfs filesystem. Proceedings of the 2005 Ot‐
212 tawa Linux Symposium.
213
214 The kernel source file Documentation/filesystems/sysfs.txt and various
215 other files in Documentation/ABI and Documentation/*/sysfs.txt
216
218 This page is part of release 5.13 of the Linux man-pages project. A
219 description of the project, information about reporting bugs, and the
220 latest version of this page, can be found at
221 https://www.kernel.org/doc/man-pages/.
222
223
224
225Linux 2021-03-22 SYSFS(5)