Linux Administration
medium

Pregunta de Linux Administration #019e3987

Enunciado de la Pregunta
Linux Administration
#udev
#tmpfs
#mknod
#/etc/udev/rules.d
Medio

What of the following statements are true regarding /dev/ when using udev? (Choose TWO correct answers.)

A

Entries for all possible devices get created on boot even if those devices are not connected.

B

Additional rules for udev can be created by adding them to /etc/udev/rules.d/.

Correcto
C

When using udev, it is not possible to create block or character devices in /dev/ using mknod.

D

The /dev/ directory is a filesystem of type tmpfs and is mounted by udev during system startup.

Correcto
E

The content of /dev/ is stored in /etc/udev/dev and is restored during system startup.

Explicación Oficial / Explicaciones de la Comunidad

Summary

This question tests your understanding of how udev manages the /dev/ directory in modern Linux systems. Udev is the device manager that dynamically creates and removes device nodes in /dev/ based on device events. The correct answers highlight that udev uses a tmpfs filesystem for /dev/ and allows custom rules via /etc/udev/rules.d/.

How it Works

Udev runs as a daemon (systemd-udevd) and listens to kernel uevents (e.g., device addition/removal). When a device is connected, udev processes rules (from /lib/udev/rules.d/ and /etc/udev/rules.d/) to determine the device node name, permissions, and symlinks. The /dev/ directory is mounted as a tmpfs (a RAM-based filesystem) early in the boot process, typically by the initramfs or systemd. This ensures that /dev/ is volatile and only contains nodes for currently connected devices.

Why the correct answer is right

  • Option B: Additional rules for udev can be created by adding them to /etc/udev/rules.d/. This is correct because /etc/udev/rules.d/ is the standard location for custom user-defined rules. Files in this directory override or supplement the default rules in /lib/udev/rules.d/.
  • Option D: The /dev/ directory is a filesystem of type tmpfs and is mounted by udev during system startup. This is correct. Udev (or systemd) mounts a tmpfs on /dev/ to provide a dynamic, in-memory device directory. This is essential for hotplug support.

Why incorrect options are wrong

  • Option A: Entries for all possible devices get created on boot even if those devices are not connected. This is false. Udev creates device nodes only for devices that are actually present or connected. It does not pre-create nodes for all possible devices.
  • Option C: When using udev, it is not possible to create block or character devices in /dev/ using mknod. This is false. While udev manages /dev/ dynamically, you can still use mknod to manually create device nodes. However, such nodes may be overwritten or removed by udev if the corresponding device is hotplugged.
  • Option E: The content of /dev/ is stored in /etc/udev/dev and is restored during system startup. This is false. There is no such directory /etc/udev/dev. Udev does not persist device nodes; they are recreated dynamically on each boot based on detected hardware.