linux下udev规则做asm设备时,无法识别uuid处理方式
–发现利用/sbin/scsi_id -g -u -s /block/sd%i无法获取uuid来标识设备,导致udev规则绑定失败
[root@trsen dev]# for i in 5 6 7;
> do
> echo “KERNEL==\”sda*\”, BUS==\”scsi\”, PROGRAM==\”/sbin/scsi_id -g -u -s %p\”, RESULT==\”`scsi_id -g -u -s /block/sda$i`\”, NAME=\”asm-disk$i\”, OWNER=\”grid\”, GROUP=\”asmadmin\”, MODE=\”0660\””
> done
KERNEL==”sda*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==””, NAME=”asm-disk5″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
KERNEL==”sda*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==””, NAME=”asm-disk6″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
KERNEL==”sda*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==””, NAME=”asm-disk7″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
[root@trsen sda5]# /sbin/scsi_id -g -u -s /sys/block/sda/sda5/
–通过udevinfo命令获取分区的信息,可以利用分区中的这2项信息 SYSFS{start} 和SYSFS{size}来代替uuid唯一标识这个设备
[root@trsen sda5]# udevinfo -a -p /sys/block/sda/sda5/
Udevinfo 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 ‘/block/sda/sda5’:
KERNEL==”sda5″
SUBSYSTEM==”block”
SYSFS{stat}==” 54 1185 1246 3845 3879 446017 449896 533518 0 9057 537363″
SYSFS{size}==”11727387″
SYSFS{start}==”49560588″
SYSFS{dev}==”8:5″
looking at parent device ‘/block/sda’:
ID==”sda”
BUS==”block”
DRIVER==””
SYSFS{stat}==” 7679 34095 850942 314546 17205 1332176 1443554 5106028 0 169066 5420582″
SYSFS{size}==”83886080″
SYSFS{removable}==”0″
SYSFS{range}==”16″
SYSFS{dev}==”8:0″
looking at parent device ‘/devices/pci0000:00/0000:00:0d.0/host0/target0:0:0/0:0:0:0’:
ID==”0:0:0:0″
BUS==”scsi”
DRIVER==”sd”
SYSFS{dh_state}==”detached”
SYSFS{ioerr_cnt}==”0x0″
SYSFS{iodone_cnt}==”0x6195″
SYSFS{iorequest_cnt}==”0x6195″
SYSFS{iocounterbits}==”32″
SYSFS{timeout}==”60″
SYSFS{state}==”running”
SYSFS{rev}==”1.0 ”
SYSFS{model}==”VBOX HARDDISK ”
SYSFS{vendor}==”ATA ”
SYSFS{scsi_level}==”6″
SYSFS{type}==”0″
SYSFS{queue_type}==”simple”
SYSFS{queue_depth}==”31″
SYSFS{device_blocked}==”0″
looking at parent device ‘/devices/pci0000:00/0000:00:0d.0/host0/target0:0:0’:
ID==”target0:0:0″
BUS==””
DRIVER==””
looking at parent device ‘/devices/pci0000:00/0000:00:0d.0/host0’:
ID==”host0″
BUS==””
DRIVER==””
looking at parent device ‘/devices/pci0000:00/0000:00:0d.0’:
ID==”0000:00:0d.0″
BUS==”pci”
DRIVER==”ahci”
SYSFS{broken_parity_status}==”0″
SYSFS{enable}==”1″
SYSFS{modalias}==”pci:v00008086d00002829sv00000000sd00000000bc01sc06i01″
SYSFS{local_cpus}==”ffffffff”
SYSFS{irq}==”11″
SYSFS{class}==”0x010601″
SYSFS{subsystem_device}==”0x0000″
SYSFS{subsystem_vendor}==”0x0000″
SYSFS{device}==”0x2829″
SYSFS{vendor}==”0x8086″
looking at parent device ‘/devices/pci0000:00’:
ID==”pci0000:00″
BUS==””
DRIVER==””
–配置如下结果,可以利用udev进行asm磁盘的规则处理
KERNEL==”sda5″, SUBSYSTEM==”block”, SYSFS{size}==”11727387″, SYSFS{start}==”49560588″, NAME=”asmdisk1″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
KERNEL==”sda6″, SUBSYSTEM==”block”, SYSFS{size}==”11727387″, SYSFS{start}==”61288038″, NAME=”asmdisk2″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
KERNEL==”sda7″, SUBSYSTEM==”block”, SYSFS{size}==”10859877″, SYSFS{start}==”73015488″, NAME=”asmdisk3″, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″