7.2. 工作原理

devlabel restart 命令在系统引导时被 /etc/rc.sysinit 脚本以及 /etc/hotplug/ 目录中的其它脚本调用。

devlabelrestart 选项读取配置文件(/etc/sysconfig/devlabel)中的设备列表,并追随符号链接来判定该设备是否在它以前的位置上存在,如 /dev/hdb1。如果这个符号链接无效,它就会试图根据磁盘的 UUID 来选择该磁盘的新位置。如果找到了 UUID 相同的磁盘,符号链接就会被更新以反映该驱动器的新位置。配置文件也会用这个新位置更新,并显示一条和以下相似的消息:

Device name incorrectly detected for symlink /dev/work!
The device /dev/hdb1 is now /dev/hdd1.
The symlink /dev/work will now point to the new device name.

如果带有同样 UUID 的磁盘没有被找到(例如,磁盘被拆除),以下信息会被显示:

The device /dev/hdb1 no longer seems to exist. Because of this, the
symlink /dev/work -> /dev/hdb1 will not be available. The reference
to this symlink in /etc/sysconfig/devlabel will be ignored.

该设备的项目没有从配置文件中被删除;它只在此次中被忽略了。