使用udev管理asmdisk執行/sbin/scsi_id不顯示UUID

kingsql發表於2015-06-10
不知道啥原因,死活顯示不了UUID,執行結果是啥也不顯示:
[root@udev ~]# /sbin/scsi_id -g -u -s /block/sdc
[root@udev ~]#
[root@udev ~]#
vmware的版本是:VMware-server-2.0.2-203138,有人說需要在虛擬機器的vmx檔案里加入:disk.EnableUUID="TRUE",我也嘗試加入了,還是不起作用,不過建議加入disk.EnableUUID="TRUE"的貌似他們使用的vmware是workstation,不知道是不是和這個有關.
os的版本是:oracle linux 5u10
--=============================
沒有uuid貌似沒法配置udev rules檔案,不過在一個哥們的幫助下最後透過這樣的方式實現的,透過udevinfo命令獲取分割槽的資訊,可以利用分割槽中的這2項資訊    SYSFS{start}=="63"和SYSFS{size}=="16771797"來代替uuid唯一標識這個裝置:

[root@udev ~]#  udevinfo -a -p /sys/block/sdc/sdc1

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/sdc/sdc1':
    KERNEL=="sdc1"
    SUBSYSTEM=="block"
    SYSFS{dev}=="8:33"
    SYSFS{partition}=="1"
    SYSFS{start}=="63"
    SYSFS{size}=="16771797"
    SYSFS{ro}=="0"
    SYSFS{alignment_offset}=="0"
    SYSFS{discard_alignment}=="0"
    SYSFS{stat}=="     795     3743     9646     1252      518     1275   133113    15477        0     2601    16726"
    SYSFS{inflight}=="       0        0"

  looking at parent device '/block/sdc':
    ID=="sdc"
    BUS=="block"
    DRIVER==""
    SYSFS{dev}=="8:32"
    SYSFS{range}=="16"
    SYSFS{ext_range}=="256"
    SYSFS{removable}=="0"
    SYSFS{ro}=="0"
    SYSFS{size}=="16777216"
    SYSFS{alignment_offset}=="0"
    SYSFS{discard_alignment}=="0"
    SYSFS{capability}=="50"
    SYSFS{stat}=="     852     3876    11166     1262      518     1275   133113    15477        0     2611    16736"
    SYSFS{inflight}=="       0        0"
    SYSFS{events}==""
    SYSFS{events_async}==""
    SYSFS{events_poll_msecs}=="-1"

  looking at parent device '/devices/pci0000:00/0000:00:10.0/host0/target0:0:2/0:0:2:0':
    ID=="0:0:2:0"
    BUS=="scsi"
    DRIVER=="sd"
    SYSFS{device_blocked}=="0"
    SYSFS{type}=="0"
    SYSFS{scsi_level}=="3"
    SYSFS{vendor}=="VMware, "
    SYSFS{model}=="VMware Virtual S"
    SYSFS{rev}=="1.0 "
    SYSFS{state}=="running"
    SYSFS{timeout}=="60"
    SYSFS{iocounterbits}=="32"
    SYSFS{iorequest_cnt}=="0x580"
    SYSFS{iodone_cnt}=="0x580"
    SYSFS{ioerr_cnt}=="0xd"
    SYSFS{modalias}=="scsi:t-0x00"
    SYSFS{evt_media_change}=="0"
    SYSFS{dh_state}=="detached"
    SYSFS{queue_depth}=="32"
    SYSFS{queue_ramp_up_period}=="120000"
    SYSFS{queue_type}=="simple"

  looking at parent device '/devices/pci0000:00/0000:00:10.0/host0/target0:0:2':
    ID=="target0:0:2"
    BUS=="scsi"
    DRIVER==""
    SYSFS{uevent}=="DEVTYPE=scsi_target"

  looking at parent device '/devices/pci0000:00/0000:00:10.0/host0':
    ID=="host0"
    BUS=="scsi"
    DRIVER==""
    SYSFS{uevent}=="DEVTYPE=scsi_host"

  looking at parent device '/devices/pci0000:00/0000:00:10.0':
    ID=="0000:00:10.0"
    BUS=="pci"
    DRIVER=="mptspi"
    SYSFS{vendor}=="0x1000"
    SYSFS{device}=="0x0030"
    SYSFS{subsystem_vendor}=="0x15ad"
    SYSFS{subsystem_device}=="0x1976"
    SYSFS{class}=="0x010000"
    SYSFS{irq}=="17"
    SYSFS{local_cpus}=="3"
    SYSFS{local_cpulist}=="0-1"
    SYSFS{modalias}=="pci:v00001000d00000030sv000015ADsd00001976bc01sc00i00"
    SYSFS{numa_node}=="-1"
    SYSFS{dma_mask_bits}=="64"
    SYSFS{consistent_dma_mask_bits}=="64"
    SYSFS{enable}=="1"
    SYSFS{broken_parity_status}=="0"
    SYSFS{msi_bus}==""
    SYSFS{msi_irqs}==""

  looking at parent device '/devices/pci0000:00':
    ID=="pci0000:00"
    BUS==""
    DRIVER==""
    SYSFS{uevent}==""

[root@udev ~]#

--=======================================
於是我建立的udev rules檔案內容如下:
[root@udev rules.d]# pwd
/etc/udev/rules.d
[root@udev rules.d]# more 99-oracle-asmdevices.rules
KERNEL=="sdc1", SUBSYSTEM=="block", SYSFS{size}=="16771797", SYSFS{start}=="63", NAME="asmdisk1-crs", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdd1", SUBSYSTEM=="block", SYSFS{size}=="16771797", SYSFS{start}=="63", NAME="asmdisk2-data", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sde1", SUBSYSTEM=="block", SYSFS{size}=="16771797", SYSFS{start}=="63", NAME="asmdisk3-fra", OWNER="grid", GROUP="asmadmin", MODE="0660"


其他的都好辦了,正常安裝就可以了.


百度了一下發現也有人這麼用過:

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28389881/viewspace-1694789/,如需轉載,請註明出處,否則將追究法律責任。

相關文章