Home / Alt manpages / proc_sys_dev(5)

  • proc_sys_dev(5)
  • File format
  • linux

Inspect and Safely Tune Linux Device Settings under /proc/sys/dev

You will map the device-specific settings visible on this Linux host, read a value in two useful ways, and make one reversible runtime change without assuming that another machine has the same files. Allow about 10 minutes. You need a shell for inspection; use an account with sudo only for the optional write step.

Checkpoint: understand what this directory is

/proc/sys/dev/ is a directory in the proc filesystem for device-specific kernel information. The local proc_sys_dev(5) manpage gives dev/cdrom/info as an example and warns that the directory can be empty on some systems. It is not a universal inventory of every device, and it is not a directory of ordinary configuration files on disk.

The installed documentation is from Linux man-pages 6.7, package version 6.7-2. The kernel, drivers, hardware and boot configuration decide which entries actually appear. Treat the live filesystem as the authority for this host.

1. List the settings your host exposes

Start with a read-only listing. The command prints files only, so it is easier to spot individual values than with a long recursive directory listing.

find /proc/sys/dev -type f -print | sort

On one current host this includes entries under cdrom, hpet, mac_hid, raid, scsi and tty. Your result may be shorter, longer or empty. An empty result is a supported outcome, not proof that the kernel has no devices.

2. Read one value and its context

Choose a path from your own listing. For example, dev.cdrom.autoclose is exposed here. Read the proc file directly, then use sysctl if it is installed. The dots in the second command are the same path separators represented by slashes in the first.

cat /proc/sys/dev/cdrom/autoclose
sysctl dev.cdrom.autoclose

Expected output on this host is:

1
dev.cdrom.autoclose = 1

These values are live kernel state. They are not necessarily persistent, and they are not guaranteed to exist after a driver is removed or on a different kernel. If a path is absent, do not create a replacement file. Re-run the inventory and check the relevant driver documentation instead.

3. Inspect a group without changing it

sysctl can show the device namespace as key-value pairs. Suppress errors because some entries may disappear while drivers are changing, then keep the output for comparison before any tuning.

sysctl -a 2>/dev/null | grep '^dev\.'

This is still a read-only command. Avoid treating names found in an online example as portable. For instance, this host has dev.raid.speed_limit_min and dev.tty.ldisc_autoload, but a server without those kernel facilities may not.

Checkpoint: record the old value before writing

Changing a writable proc setting takes effect immediately and can alter device or kernel behaviour. Do not write a value merely because the file accepts it. Check the setting's kernel or driver documentation, note the current value, and plan how to restore it. A write may also require elevated privileges.

4. Make one reversible runtime change

The following example changes the CD-ROM driver's automatic tray-close setting on a host where that exact file exists. It is deliberately a small example, not a recommendation to change a production machine. It may affect the next tray operation, so run it only when that behaviour is acceptable.

setting=/proc/sys/dev/cdrom/autoclose
old=$(cat "$setting")
printf 'old value: %s\n' "$old"
printf '0\n' | sudo tee "$setting"
cat "$setting"

Expected output includes the value you saved, then 0, followed by 0. If the file is missing, stop and do not substitute another path. If the write fails, the value was not confirmed; read it again before deciding what happened.

Restore the saved value as soon as you finish testing. Replace OLD_VALUE_FROM_ABOVE with the value printed by your own command:

printf '%s\n' 'OLD_VALUE_FROM_ABOVE' | sudo tee /proc/sys/dev/cdrom/autoclose
cat /proc/sys/dev/cdrom/autoclose

The final command must print the original value. If you lost it, stop making changes and consult the driver documentation rather than guessing. A runtime write normally lasts only until the relevant setting is reinitialised or the system reboots; persistence, if required, belongs in the distribution's sysctl configuration and should be tested separately.

Common traps

  • Confusing absence with failure: /proc/sys/dev/ may be empty, and device-specific files vary by kernel and hardware.
  • Assuming every file is writable: some entries are information only. A successful read does not grant permission to write.
  • Mixing names and paths: /proc/sys/dev/raid/speed_limit_min maps to dev.raid.speed_limit_min for sysctl, but only when that file exists.
  • Expecting persistence: a value read from procfs describes the running system. Record deliberate persistent settings using the normal configuration process for your distribution, with a recovery plan.
  • Using a recursive write: never pipe a bulk listing into a write command. Each setting has its own meaning and safety boundary.

Done means

  • You listed the actual files under /proc/sys/dev on the target host.
  • You verified one value with a direct read and, where available, sysctl.
  • You checked that a setting exists before considering a write.
  • You recorded the old value, made only a deliberate runtime change, and restored it when testing ended.
  • You know that device-specific proc settings are host- and kernel-dependent rather than portable files to copy between systems.