我在/etc/udev/rules.d/81-external-disk.rules中包含以下内容:
ENV{ID_FS_UUID}=="6826692e-79f4-4423-8467-cef4d5e840c5", RUN{program}+="/bin/mount -o nofail,x-systemd.device-timeout=1 -t ext4 -U 6826692e-79f4-4423-8467-cef4d5e840c5 /backup/external"
运行后:
udevadm control --reload ; udevadm trigger /dev/sdb1
它什么都不做。但是,如果II将挂载命令更改为/ bin / touch / tmp / xyz之类的命令,它将起作用。
版本:
[root@helsinki rules.d]# rpm -qa | grep udev
libgudev1-219-19.el7_2.12.x86_64
python-pyudev-0.15-7.el7_2.1.noarch
[root@helsinki rules.d]# rpm -qa | grep systemd
systemd-libs-219-19.el7_2.12.x86_64
systemd-219-19.el7_2.12.x86_64
systemd-sysv-219-19.el7_2.12.x86_64
[root@helsinki rules.d]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)