Questions tagged [sysfs]

Sysfs is a Linux filesystem, normally mounted on /sys, which provides information about hardware and kernel components.

The Linux sysfs filesystem, normally mounted on /sys, is a communication interface between applications and the kernel. It provides information about kernel components, and through the kernel about hardware. Some entries in /sys are writable, allowing configuration and software-initiated events such as shutting down some components. It was created as a companion to , which focuses on process-related information.

External links

146 questions
85
votes
4 answers

What is the difference between procfs and sysfs?

What is the difference between procfs and sysfs? Why are they made as file systems? As I understand it, proc is just something to store the immediate info regarding the processes running in the system.
Navaneeth Sen
  • 9,369
  • 17
  • 58
  • 65
42
votes
1 answer

Difference between /dev and /sys/class?

What is the difference between the device representation in /dev and the one in /sys/class? Is one preferred over the other? Is there something one offers and the other doesn't?
TheMeaningfulEngineer
  • 5,735
  • 15
  • 64
  • 113
36
votes
5 answers

Making Linux read swap back into memory

The Linux kernel swaps out most pages from memory when I run an application that uses most of the 16GB of physical memory. After the application finishes, every action (typing commands, switching workspaces, opening a new web page, etc.) takes very…
drrossum
  • 472
  • 4
  • 9
28
votes
2 answers

Difference between /dev and /sys

Exactly what is the difference between devfs and sysfs? Both seem to maintain a list of hardwares attached to the system. Then why the need for 2 separate fs even arose? As far as I can get /sys maintains somewhat "raw" list of devices(like "ser0").…
sounak
  • 461
  • 1
  • 5
  • 5
21
votes
3 answers

How to find the pci slot of an usb controller in Linux?

I have a nearly common Linux machine here. So, it has a PCI (*-X, etc) bus, on that some USB controllers, and I have USB devices on these USB controllers. Similar to this: $ lspci|grep USB 00:12.0 USB controller: Advanced Micro Devices, Inc.…
peterh
  • 9,488
  • 16
  • 59
  • 88
17
votes
4 answers

How does systemd-tmpfiles work?

I'm trying to change the value of /sys/bus/usb/devices/4-3/power/wakeup at every boot (4-3 according to my lsusb, it's the keyboard ID). The default value is: # cat /sys/bus/usb/devices/4-3/power/wakeup enabled The classic "online" editing works as…
eang
  • 565
  • 3
  • 6
  • 12
16
votes
1 answer

Usage difference between device files, ioctl, sysfs, netlink

I'm trying to clarify which is the most useful (in terms of functionality) method of interacting with devices in Linux. As I understand, device files expose only part of functionality (address blocks in block devices, streams in character devices,…
Constantine
  • 515
  • 1
  • 4
  • 11
15
votes
4 answers

How do I learn what I can do with /proc and /sys

I'd like to know more about the advanced uses of the /proc and /sys virtual filesystems, but I don't know where to begin. Can anyone suggest any good sources to learn from? Also, since I think sys has regular additions, what's the best way to keep…
xenoterracide
  • 57,918
  • 74
  • 184
  • 250
15
votes
1 answer

Is it possible to get network interface index not via /sys?

So what I'm looking for is an interface index (or name) but the real one. if_nametoindex(3) and ioctl(2) don't seem to help me here. Now the only way I found how to do this is via /sys. Let me demonstrate on example what I need: # cat…
UVV
  • 2,928
  • 3
  • 23
  • 36
14
votes
4 answers

Why does rsync fail to copy files from /sys in Linux?

I have a bash script which uses rsync to backup files in Archlinux. I noticed that rsync failed to copy a file from /sys, while cp worked just fine: # rsync /sys/class/net/enp3s1/address /tmp rsync: read errors mapping…
Eugene Yarmash
  • 14,675
  • 14
  • 50
  • 57
12
votes
3 answers

Which of proc, sys etc. should be bind-mounted (or not) when chrooting into a "replacement" distribution?

This answer to another question basically boils down to chrooting into another Linux distribution in order to mainly use that as a replacement to its too restricted (but irreplaceable) parent. The suggested actions before running chroot, which I…
Tobias Kienzler
  • 9,184
  • 13
  • 65
  • 106
11
votes
1 answer

What is securityfs?

While I am studying, I saw security file system which is mounted on /sys/kernel/security . It seems like to operate similar to sysfs or proc file system. Security file system keeps data on memory not in disk, so when write something into the file in…
JuHyung Son
  • 197
  • 3
  • 10
11
votes
3 answers

How to find out easily whether a block device (or a part of it) is mounted somehow

I want to know what the easiest way is to determine (without root privilege) whether a block device (say sdb) or any part of it is mounted (and which part of it). Checking /proc/mounts for sdb is not enough because sdb or one of its partitions may…
Hauke Laging
  • 88,146
  • 18
  • 125
  • 174
10
votes
1 answer

"cd" into /sys/kernel/debug/tracing causes permission change

I've faced a really strange issue today, and am totally helpless about it. Some of the servers I manage are monitored with Nagios. Recently I saw a disk usage probe failing with this error: DISK CRITICAL - /sys/kernel/debug/tracing is not…
zessx
  • 203
  • 2
  • 7
10
votes
1 answer

Debian: cannot remove symlink in /sys/: operation not permitted

I ran some commands without completely understanding them while trying to get screen brightness working and now I'm stuck with a nasty symlink in '/sys/class/backlight/asus_laptop' that I am trying to get rid of. I have tried sudo rm…
Jzuken
  • 203
  • 2
  • 4
1
2 3
9 10