Pcornel
Linux · Disks & Block Devices

udev

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

Back to the Topic

Answer

udev is the device manager that creates /dev entries, names network interfaces and disks' /dev/disk/by-* links, sets permissions and runs rules (in /etc/udev/rules.d) when devices appear.

Remember

Write custom rules in /etc/udev/rules.d with a high number. Match on stable attributes (udevadm info -a). Test with udevadm test and apply with udevadm control --reload && udevadm trigger.

First checks

  • udevadm monitor — live device events
  • lsblk -f — disks, partitions, filesystems, UUIDs and mount points
  • blkid — UUIDs, labels and types
  • fdisk -l / parted -l — partition tables
  • udevadm info /dev/<dev> — device properties

Verify in this order

kernel uevent → udev rules matched → name/link/permissions set → device available

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=2753

Confirmation

Confirm action

Continue?