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/.
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.
E. The content of /dev/ is stored in /etc/udev/dev and is restored during system startup.

题解

选项 A,设备要连接上电脑才会被创建在 /dev/ 中。

选项 B,正确。

选项 C,mknod 可以创建 block、character、FIFO 的特殊文件。虽然 Kernel 都会替设备自动创建出特殊文件,但在少数部份情况下,Kernel 创建的文件可能无法被进程(process)访问到,这时就需要利用 mknod,来产生新的且能被访问到的特殊文件,并指定特殊文件对应到设备的哪个主要设备代码 (Major) 和次要设备代码 (Minor)。

选项 D,更准确来说,文件系统是使用「devtmpfs」。

选项 E,没有「/etc/udev/dev」这个文件或是目录,/dev 的内容是由 udev 动态控制的。