【发布时间】:2014-05-31 08:44:01
【问题描述】:
我正在尝试找出一种方法来在安装特定远程 fs(如 cifs 或 nfs)时以及即将卸载时运行脚本。我的 fstab 中有条目,因此安装图标会自动在我的桌面上创建。但是我需要在安装某些特定的远程 fs 时安装覆盖 fs 并在远程 fs 卸载之前卸载它。使用 udev 监视器,我看到添加/删除通知,但属性非常无用:
~$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[41113.912505] add /devices/virtual/bdi/cifs-2 (bdi)
UDEV [41113.913868] add /devices/virtual/bdi/cifs-2 (bdi)
^
~$ udevadm info -a -p /devices/virtual/bdi/cifs-2
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/virtual/bdi/cifs-2':
KERNEL=="cifs-2"
SUBSYSTEM=="bdi"
DRIVER==""
ATTR{min_ratio}=="0"
ATTR{stable_pages_required}=="0"
ATTR{read_ahead_kb}=="1024"
ATTR{max_ratio}=="100"
那有什么我可以用的吗? 谢谢
【问题讨论】:
-
如果我不清楚:问题是 udev 没有提供足够的信息来创建规则。在上面的示例中,我无法确定安装了哪些远程 fs。因为显然我可以在 fstab 中定义多个 cifs 挂载点