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動態控制的。