From: Phil Turmel <philip@turmel.org>
To: "Mathias Burén" <mathias.buren@gmail.com>
Cc: John Robinson <john.robinson@anonymous.org.uk>,
Linux-RAID <linux-raid@vger.kernel.org>,
Simon Mcnair <simonmcnair@gmail.com>
Subject: Re: Possible HDD error, how do I find which HDD it is?
Date: Sat, 19 Feb 2011 17:22:22 -0500 [thread overview]
Message-ID: <4D60429E.1090501@turmel.org> (raw)
In-Reply-To: <AANLkTinw8hSks5kopU9ju1cNCQu11kUgPzRbC8L2h_ed@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1550 bytes --]
On 02/19/2011 03:09 PM, Mathias Burén wrote:
> The script works for me:
>
> $ sudo ./lsdrv.sh
> Password:
> 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 }
>
> So ata3 is the same as host3 then? How come no errors are logged on the drive:
No, generally not. ATA numbering starts from #1. Host numbering starts from #0, but includes non-ATA SCSI devices.
I've attached a version of the script that shows the LUN in addition to the host number, and includes John's adjustment. It might be useful to people with port multipliers, and controllers that show all ports under a single host.
Simon, I'm very curious what this latest script shows for the Supermicro when one or more ports are empty, and whether those LUNs are consistently assigned to specific ports.
Phil
[-- Attachment #2: lsdrv --]
[-- Type: text/plain, Size: 1947 bytes --]
#! /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 " `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 () {
local empty=1
while read device ; do
empty=0
if [[ "$device" =~ ^(.+/[0-9]+:)([0-9]+:[0-9]+:[0-9]+)/block[/:](.+)$ ]] ; then
base="${BASH_REMATCH[1]}"
lun="${BASH_REMATCH[2]}"
bdev="${BASH_REMATCH[3]}"
vnd="$(< ${base}${lun}/vendor)"
mdl="$(< ${base}${lun}/model)"
sn="`sginfo -s /dev/$bdev | \
sed -rn -e \"/Serial Number/{s%^.+' *(.+) *'.*\\\$%\\\\1%;p;q}\"`" &>/dev/null
if [[ -n "$sn" ]] ; then
echo -e " $1 `echo $lun $bdev $vnd $mdl {SN: $sn}`"
else
echo -e " $1 `echo $lun $bdev $vnd $mdl`"
fi
else
echo -e " $1 Unknown $device"
fi
done
[[ $empty -eq 1 ]] && echo -e " $1 [Empty]"
}
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
find $host -regex '.+/target[0-9:]+/[0-9:]+/block[:/][^/]+' |describe_device "$bhost"
done
}
find /sys/devices/ -name 'scsi_host*' |check_host
next prev parent reply other threads:[~2011-02-19 22:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-19 11:52 Possible HDD error, how do I find which HDD it is? Mathias Burén
2011-02-19 14:09 ` Simon McNair
2011-02-19 15:37 ` John Robinson
2011-02-19 16:44 ` Phil Turmel
2011-02-19 17:25 ` John Robinson
[not found] ` <4D5FFCEC.9040207@anonymous.org.uk>
2011-02-19 18:02 ` Phil Turmel
2011-02-19 18:18 ` John Robinson
2011-02-19 20:09 ` Mathias Burén
2011-02-19 22:22 ` Phil Turmel [this message]
2011-02-19 22:30 ` Mathias Burén
2011-02-19 22:40 ` Phil Turmel
2011-02-19 23:26 ` Mathias Burén
2011-02-20 3:11 ` John Robinson
2011-02-20 3:44 ` Mathias Burén
2011-02-20 9:52 ` Simon Mcnair
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D60429E.1090501@turmel.org \
--to=philip@turmel.org \
--cc=john.robinson@anonymous.org.uk \
--cc=linux-raid@vger.kernel.org \
--cc=mathias.buren@gmail.com \
--cc=simonmcnair@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox