Pcornel
Linux · Filesystem

/sys

Cheat sheet · https://pcornel.dk/topic.php?topic=2670

Back to the Topic

Answer

/sys is a virtual filesystem (sysfs) that exposes the kernel's view of devices, drivers, buses and kernel settings as files.

Remember

Changes in /sys are lost at reboot — persist them with udev rules or tmpfiles. Tools such as lsblk, ip and udevadm read /sys for you.

First checks

  • ls -ld <path> — owner, permissions and type
  • stat <path> — inode, links, size and timestamps
  • df -h <path> — filesystem and free space
  • findmnt <path> — which mount the path is on

Verify in this order

/sys mounted (or virtual) → correct owner and permissions → enough space → services read and write as intended

Where it usually breaks

First mismatch in hardware/block device → kernel driver/mapper/RAID/LVM → filesystem → mount namespace/options → path permissions/MAC → consumer I/O; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2670

Confirmation

Confirm action

Continue?