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"). udev acts on those devices, gets various informations and applies various rules to present them as recognizable names which are then mapped onto /dev(like "camera"). Is this the only reason? And then we mount the corresponding devices from the /dev fs (can't we do that from the /sys fs) into the /media fs.

I have read the answer at Difference between /dev and /sys/class?. But I cannot get the sys fs part where it states that

Sysfs contain the hierarchy of devices, as they are attached to the computer

Are the files in /sys not device node files? Then what type of files are they?


2 Answers 2


The /sys filesystem (sysfs) contains files that provide information about devices: whether it's powered on, the vendor name and model, what bus the device is plugged into, etc. It's of interest to applications that manage devices.

The /dev filesystem contains files that allow programs to access the devices themselves: write data to a serial port, read a hard disk, etc. It's of interest to applications that access devices.

A metaphor is that /sys provides access to the packaging, while /dev provides access to the content of the box.

The files in /sys are not device nodes, but symbolic links and regular files. Those regular files are special in that reading or writing to them invokes file-specific functions in the kernel, like device nodes. The difference is that files in /sys work this way because of the filesystem they are on, whereas device nodes work this way due to their device node characteristics (the file type indicating a (block or character) device, and the device major and minor number indicating which device it is).

The reason for /dev existing independently of /sys is partly historical: /dev dates back to the dawn of Unix, while /sys is a much more recent invention. If Linux was designed today with no historical background, /dev/sda might be /sys/block/sda/content.

  • 7
    See also: man hier.
    – HalosGhost
    Commented Dec 30, 2014 at 13:49
  • /dev directory allows access to the device via the device files (or device nodes)
  • /sys directory allows the viewing of the device information and details.

for instance: cat /sys/block/*/device/serial (with * replaced by nvme0n1 or sda or hda ... depending on your case) will print the serial number of the disk storage.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .