Let's say I know the drive I want is on Adapter 8, Virtual Drive 0, is there a way to get the Linux device name (e.g. /dev/sdt
)? I am on RHEL 6.2.
-pdlist
displays a WWN value for each physical drive, but that doesn't help much. -ldinfo
doesn't print a WWN or any other identifying value.
# ./MegaCli64 -pdlist -a8 | grep WWN
WWN: 500051610003776C
WWN: 5000516100037BFC
WWN: 5000516100038090
WWN: 50005161000284F4
WWN: 5000516100037C0C
WWN: 5000516100037C5C
WWN: 50005161000310C8
WWN: 5000516100037F4C
# ls -1dt /dev/disk/by-id/wwn*
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd142c12c84d
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd142c0973e6
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd132c002573
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd122bf6e2f6
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd122beda52a
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd112be46f10
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd112bdb3ffb
/dev/disk/by-id/wwn-0x600605b0043e52d01721fd102bd20f14
# ./MegaCli64 -v
MegaCLI SAS RAID Management Tool Ver 8.03.08 Mar 15, 2012
You should be able to compare the disk serial number from
-pdlist
with the output fromlshw
.Then search the output of
lshw
for the serial number. The device name will be in thelogical name
field.I can't verify this because all of my disks are in a volume.
Identifying Logical Drives
Compare the
Target Id
from MegaCLI with the scsi bus target for the device. Inlshw
it isbus info
.From lshw:
I just added some support to my fork of megaclisas-status for matching the logical drive to an OS Native device. Here's an example output:
The tool itself is available at: http://step.polymtl.ca/~coyote/dist/megaclisas-status/megaclisas-status
I hope this helps,
Vincent
For anyone stumbling on this question and using
storcli
(successor ofMegaCLI
), you can map a virtual drive to the disk seen by the operating system with the following:Tested with
storcli-1.21.06
download at: https://docs.broadcom.com/docs/1.21.06_StorCLIInstead of using
lshw
, I think you can just use/dev/disk/by-path
to get the relationship between the scsi target id and the logical device name(sdX).I have been dealing with this across a number of new servers recently and I've come up with a solution! We are not using RAID on the "RAID" card, just using the SAS drives as JBOD. The
/dev/disk/by-id
mappings are off by one (or a few) from theSAS Address
. This seems bizarre, but it works across dozens of servers I've tested it on. I have also received independent confirmation that this works for others.megamap is a short Perl script that implements the discovery above. It produces a map of Linux drive
sd*
to MegaRaid drive ID and also displays the WWN from Linux. After using this in production for a while I also addedmegablink
andmegaunblink
for controlling the "come fix me" blinking LED. That feature has saved me from pulling the wrong drive out of the server. Please submit bug reports on github.[ image thanks to Scott Vrable ]
Harry's command was very helpful, but I needed to go a step further and determine the pci device because I have multiple SAS adapters in my configuration. Figured I should share:
There is an alternate tool called
lsiutil
that has been discontinued. If it works for your card, it may be easier to use: http://www.lsi.com/downloads/Public/Obsolete/Obsolete%20Common%20Files/LSIUtil_1.62.zipOnce you select your controller card, option 42 is supposed to display the OS names. I use this on Solaris, and the disks are in real JBOD mode instead of a bunch of single disk RAID 0 logical drives.
I was researching for the same thing and found this post - http://sysadm.pp.ua/linux/monitoring-systems/python-lsi-megaraid-monitoring.html . You can use python and bash script which give you all needed info:
Currently it is very easy with StorCLI: