1.在/etc/udev/rules.d/目录下添加一个诸如99.udisk2.rules
2.其中的内容诸如:
# This file contains udev rules for udisks 2.x## Do not edit this file, it will be overwritten on updates#KERNEL=="mmcblk0" , SUBSYSTEMS=="block", ENV{DEVTYPE}=="disk", ENV{UDISKS_IGNORE}="1"KERNEL=="mmcblk0p[0-31]", SUBSYSTEMS=="block", ENV{DEVTYPE}=="partition", ENV{UDISKS_IGNORE}="1"
3.测试时先需要执行一下重新加载规则:
udevadm control --reload-rules
4.安装了gvfs后,gvfs也会多事的自动来mount一些分区,调用的也是udisk2的东西,
可以修改/usr/share/gvfs/remote-volume-monitors/udisk2.monitor,比如将IsNative修改为false