3ware mapping to disk devices in Linux

  • Thread starter linuxnewbie1234
  • Start date
L

linuxnewbie1234

Hi there
I am trying to map device files to drive serial numbers in Linux.

The reason I am trying to do this is mainly because Linux can swap all
drive letters at every boot. Yes I know that I can use filesystem
labels, mdadm array disk numbers etc, but if a disk fails I want to know
exactly and reliably WHICH disk I have to replace (we are speaking about
a big disk server here), and I can do that if I can get to the serial
number. From the OS just the device name is given to me, not the
physical slot (and disk member number in the mdadm array but I would
prefer to go the serial number way if possible).
Also at RAID array creation (mdadm), in order to do the things well, I
need to know a reliable mapping of disk device file to physical slot.
With this server I cannot count on drive activity leds being present or
functional.

Most controllers are good, and with them I can use
smartctl -i /dev/sdX...

However I have various controllers, and one of them is a 3ware (possibly
more than one 3ware in the future)
3ware doesn't work with the command line above, nor with hdparm.

With 3ware the only way to make it work is:
smartctl -i -d 3ware,PORTNUMBER /dev/twaCONTROLLERNUMBER

The problem is that I don't know a way to map the /dev/sdX device to its
PORTNUMBER and CONTROLLERNUMBER in the 3ware, so I am stuck again.

Please help
Thank you
 
L

linuxnewbie1234

David said:
/sbin/udevadm info -q env -p /block/sda|grep SERIAL_SHORT

Oh My Goodness
Thank you! This works on 3ware.
The serial number is slightly tweaked by 3ware but the numeric part does
contain the correct HD serial number.
The command does not get a proper serial number on the mobo-integrated
SAS controller (LSI 1068E)
On 3ware without |grep I seem to be able to also get the PCI slot and
the scsi-id hence probably I could determine the 3ware controller ID.

Now I have 5 commands, each one works on something but no-one works on
everything:

Works on integrated SAS and integrated SATA, not on 3ware:
hdparm -I /dev/sdX | grep -i serial

Works on integrated SATA only:
hdparm -i /dev/sdX | grep -i serial

Works on integrated SATA only:
smartctl -a /dev/sdX | grep -i serial

Works on integrated SATA and on 3ware:
/sbin/udevadm info -q all -p /block/sdX | grep ID_SERIAL_SHORT

Works on integrated SATA only:
/lib/udev/ata_id /dev/sdX
or
/lib/udev/ata_id /dev/sda

This one works on integrated SATA only, doesn't work on 3ware nor on
integrated SAS.


Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top