|
- ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mkdir -p /mnt/usb%n"
- ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN{program}+="/usr/bin/systemd-mount --no-block --automount=yes --collect /dev/%k /mnt/usb%n"
- ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN{program}+="/usr/bin/systemd-umount /mnt/usb%n"
- ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/rmdir /mnt/usb%n"
复制代码
这样应该可以,因为udev是不允许直接使用mount的,详细参考
https://wiki.archlinux.org/title/Udev#Mounting_drives_in_rules |
|