Re: Determining which spindle is out of order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7 November 2010 14:43, Phil Turmel <philip@xxxxxxxxxx> wrote:
> On 11/07/2010 08:43 AM, John Robinson wrote:
>> On 07/11/2010 13:21, Phil Turmel wrote:
>>> On 11/07/2010 07:53 AM, John Robinson wrote:
>>>> On 06/11/2010 16:02, Phil Turmel wrote:
>>>>> On 11/06/2010 11:46 AM, John Robinson wrote:
>>>> [...]
>>>>>> Now I need to find udevadm I guess. It must have been introduced since the udev version that comes with RHEL/CentOS 5, which is udev-095-14.21.el5_5.1. rpmfind.net suggests it's only been in since version 118 or so. Never mind :-)
>>>>>
>>>>> Heh. ÂAnyone know the equivalent command in earlier versions of udev?
>>>>
>>>> I think it's `udevinfo` instead of `udevadm info` - the comment in the ChangeLog for udev-117 is "udevadm: merge all udev tools into a single binary". But it doesn't work terribly well:
>>>>
>>>> [root@beast describe_scsi]# udevinfo -q all -p /devices/pci0000\:00/0000\:00\:1f.2/
>>>> no record for '/devices/pci0000:00/0000:00:1f.2/' in database
>>>>
>>>> That's unfortunate. But it does know about that device if asked differently:
>>>>
>>>> [root@beast describe_scsi]# udevinfo -a -p /devices/pci0000\:00/0000\:00\:1f.2/
>>>
>>> Hmmm. ÂCan you try both of the above without the trailing slash?
>>
>> Just the same output, however I ask the question:
>>
>> [root@beast ~]# udevinfo -q all -p /devices/pci0000\:00/0000\:00\:1f.2
>> no record for '/devices/pci0000:00/0000:00:1f.2' in database
>> [root@beast ~]# udevinfo -q all -p /devices/pci0000:00/0000:00:1f.2
>> no record for '/devices/pci0000:00/0000:00:1f.2' in database
>> [root@beast ~]# udevinfo -q all -p /sys/devices/pci0000:00/0000:00:1f.2
>> no record for '/devices/pci0000:00/0000:00:1f.2' in database
>> [root@beast ~]#
>>
>> And all with "-a" instead of "-q all" produce the output I posted before.
>
> The modern udevadm gives me that with --attribute-walk. ÂIt's purpose is to report
> the conditions one might want to use in an udev rule. ÂIt doesn't provide the human
> descriptions I'm looking for.
>
>> Please don't feel you have to turn this into a project, though.
>
> Too late. ÂHere's a version that doesn't use udevadm at all...
>
> #! /bin/bash
> #
> # Examine specific system host devices to identify the drives attached
> #
>
> function describe_controller () {
> Â Â Â Âlocal device driver modprefix serial slotname
> Â Â Â Âdriver="`readlink -f \"$1/driver\"`"
> Â Â Â Âdriver="`basename $driver`"
> Â Â Â Âmodprefix="`cut -d: -f1 <\"$1/modalias\"`"
> Â Â Â Âecho "Controller device @ ${1##/sys/devices/} [$driver]"
> Â Â Â Âif [[ "$modprefix" == "pci" ]] ; then
> Â Â Â Â Â Â Â Âslotname="`basename \"$1\"`"
> Â Â Â Â Â Â Â Âecho -n " Â`lspci -s $slotname |cut -d\ Â-f2-`"
> Â Â Â Â Â Â Â Âreturn
> Â Â Â Âfi
> Â Â Â Âif [[ "$modprefix" == "usb" ]] ; then
> Â Â Â Â Â Â Â Âif [[ -f "$1/busnum" ]] ; then
> Â Â Â Â Â Â Â Â Â Â Â Âdevice="`cat \"$1/busnum\"`:`cat \"$1/devnum\"`"
> Â Â Â Â Â Â Â Â Â Â Â Âserial="`cat \"$1/serial\"`"
> Â Â Â Â Â Â Â Âelse
> Â Â Â Â Â Â Â Â Â Â Â Âdevice="`cat \"$1/../busnum\"`:`cat \"$1/../devnum\"`"
> Â Â Â Â Â Â Â Â Â Â Â Âserial="`cat \"$1/../serial\"`"
> Â Â Â Â Â Â Â Âfi
> Â Â Â Â Â Â Â Âecho " Â`lsusb -s $device` {SN: $serial}"
> Â Â Â Â Â Â Â Âreturn
> Â Â Â Âfi
> Â Â Â Âecho -e " Â`cat \"$1/modalias\"`"
> }
>
> function describe_device () {
> Â Â Â Âtarg=${1%/block/*}
> Â Â Â Âvnd="`cat $targ/vendor`"
> Â Â Â Âmdl=`cat $targ/model`
> Â Â Â Ârdev=`readlink -f "$1"`
> Â Â Â Âif [[ -d $rdev ]] ; then
> Â Â Â Â Â Â Â Âbdev="`basename $rdev`"
> Â Â Â Â Â Â Â Âsn="`sginfo -s /dev/$bdev | \
> Â Â Â Â Â Â Â Â Â Â Â Âsed -rn -e \"/Serial Number/{s%^.+' *(.+) *'.*\\\$%\\\\1%;p;q}\"`" &>/dev/null
> Â Â Â Â Â Â Â Âif [[ -n "$sn" ]] ; then
> Â Â Â Â Â Â Â Â Â Â Â Âecho -e " Â Â$bhost: `echo /dev/$bdev $vnd $mdl {SN: $sn}`"
> Â Â Â Â Â Â Â Âelse
> Â Â Â Â Â Â Â Â Â Â Â Âecho -e " Â Â$bhost: `echo /dev/$bdev $vnd $mdl`"
> Â Â Â Â Â Â Â Âfi
> Â Â Â Âelse
> Â Â Â Â Â Â Â Âecho -e " Â Â$bhost: Unknown $rdev"
> Â Â Â Âfi
> }
>
> function check_host () {
> Â Â Â Âlocal found=0
> Â Â Â Âlocal pController=
> Â Â Â Âwhile read shost ; do
> Â Â Â Â Â Â Â Âhost=`dirname "$shost"`
> Â Â Â Â Â Â Â Âcontroller=`dirname "$host"`
> Â Â Â Â Â Â Â Âbhost=`basename "$host"`
> Â Â Â Â Â Â Â Âif [[ "$controller" != "$pController" ]] ; then
> Â Â Â Â Â Â Â Â Â Â Â ÂpController="$controller"
> Â Â Â Â Â Â Â Â Â Â Â Âdescribe_controller "$controller"
> Â Â Â Â Â Â Â Âfi
> Â Â Â Â Â Â Â Âfor dev in $host/target*/*/block/* ; do
> Â Â Â Â Â Â Â Â Â Â Â Âif [[ "${dev: -1}" == '*' ]] ; then
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âecho -e " Â Â$bhost: [Empty]"
> Â Â Â Â Â Â Â Â Â Â Â Âelse
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âdescribe_device "$dev"
> Â Â Â Â Â Â Â Â Â Â Â Âfi
> Â Â Â Â Â Â Â Âdone
> Â Â Â Âdone
> }
>
> find /sys/devices/ -name scsi_host |check_host
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
>

Nice, now it shows the S/N of the devices in my system:


Controller device @ pci0000:00/0000:00:0b.0 [ahci]
  SATA controller: nVidia Corporation MCP79 AHCI Controller (rev b1)
 host0: /dev/sda ATA Corsair CSSD-F60 {SN: 10326505580009990027}
    host1: /dev/sdb ATA WDC WD20EARS-00M {SN: WD-WCAZA1022443}
    host2: /dev/sdc ATA WDC WD20EARS-00M {SN: WD-WMAZ20152590}
    host3: /dev/sdd ATA WDC WD20EARS-00M {SN: WD-WMAZ20188479}
    host4: [Empty]
    host5: [Empty]
Controller device @ pci0000:00/0000:00:16.0/0000:05:00.0 [sata_mv]
  SCSI storage controller: HighPoint Technologies, Inc. RocketRAID
230x 4 Port SATA-II Controller (rev 02)    host6: [Empty]
    host7: /dev/sde ATA SAMSUNG HD204UI {SN: S2HGJ1RZ800964 }
    host8: /dev/sdf ATA WDC WD20EARS-00M {SN: WD-WCAZA1000331}
    host9: /dev/sdg ATA SAMSUNG HD204UI {SN: S2HGJ1RZ800850 }

// Mathias
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux