ubuntu
热插拔挂载
编辑 /etc/udev/99-xxx.rules
KERNEL=="mmcblk1p1", SUBSYSTEMS=="block",ACTION=="add", RUN{program}+="/usr/bin/systemd-mount --no-block --collect /dev/%k /opt/userdata/"
KERNEL=="mmcblk1p1", SUBSYSTEMS=="block",ACTION=="remove", RUN+="/usr/bin/systemd-umount.sh /dev/%k"
完成编辑sudo systemctl restart udev
rules中不能用mount,否则会导致只挂载到systemd-udevd空间,默认空间访问不到
也不能用systemd-mount --automount=yes 否则会导致只挂载到systemd的挂载空间。
直接systemd-mount即可