我写这个规则是为了测试目的:
SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Kingston", ATTRS{serial}=="001CC0EC34A2BB318709004B", ATTRS{idVendor}=="0951", ATTRS{idProduct}=="1642", SYMLINK+="pen", NAME="pendrak"
Run Code Online (Sandbox Code Playgroud)
基于以下信息:
# udevadm info --name=/dev/sdb --attribute-walk
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/pci0000:00/0000:00:1d.7/usb2/2-5/2-5:1.0/host2/target2:0:0/2:0:0:0/block/sdb':
KERNEL=="sdb"
SUBSYSTEM=="block"
DRIVER==""
ATTR{ro}=="0"
ATTR{size}=="30299520"
ATTR{stat}==" 419 …Run Code Online (Sandbox Code Playgroud) 我观察到在同一系统的重复启动之间,设备名称/dev/sda、/dev/sdb/...和物理硬盘驱动器之间的映射保持不变。
但是,如果我将硬盘驱动器插入主板上的不同插槽或添加/删除驱动器,我不确定它是否保持不变。
Linux 对设备名称到物理硬盘驱动器的映射做出了哪些保证?
它使用哪些规则将物理硬盘驱动器映射到 /dev/ 中的文件?