Can I detect hardware RAID infromation from inside Linux?

Solution 1:

How to get the RAID information is going to depend entirely on the RAID controller you are using. Often, manufacturers will have tools that can be downloaded from their website which can be used to query the RAID controller and get this information.

In order to find which RAID controller you are using, try one of the following commands:

lspci

# lspci -knn | grep 'RAID bus controller'
08:00.0 RAID bus controller [0104]: 3ware Inc 9690SA SAS/SATA-II RAID PCIe [13c1:1005] (rev 01)

Here, the information we are looking for is "3ware Inc 9690SA SAS/SATA-II RAID PCIe".

lsscsi

The command is not available on Debian and Ubuntu, but a quick sudo apt-get install lsscsi will fetch it from the repos. Note, if you are not using a RAID controller, the manufacturer and model number of your harddrive will show up here instead.

# lsscsi
[2:0:0:0]    disk    AMCC     9690SA-8I  DISK  4.08  /dev/sda 
[2:0:1:0]    disk    AMCC     9690SA-8I  DISK  4.08  /dev/sdb 

Here we see the manufacturer is "AMCC" and the model number of the RAID card is "9690SA-8I". A quick Google search shows that this card is also known as "AMCC 3Ware 9690SA-8I".

lshw

A third method (which gives quite a bit of output data) is to use the lshw command. Run lshw -class disk as root to only display the details about harddrives (which includes RAID information).

Finding the RAID controller tools

Now that we have the manufacturer and model number, it should be possible to find the tools on their website, or at least be able to Google details on how to find and use the tools for that specific controller.

If the manufacturer shows up in this list, see these answers for more details on how to get the RAID information for your card:

  • AMCC - 3ware controllers
  • LSI Logic / Symbios Logic
  • Adaptec (some devices)

Solution 2:

Run something like lspci -knn | grep 'RAID bus controller'.

Using that output, Google (for example) for LSI Logic / Symbios Logic MegaRAID SAS 2208.

Find it uses the storcli utility to interrogate the RAID controller.

Download it and install it.

storcli64 show gives you the model of controller specifically, and the controller index, number of drive groups, and virtual drives.

storcli64 /c0/d0 show shows you first controller, first drive group. Tells you raid levels, including nesting.

storcli64 /c0/eall/sall show all shows you all the information on all the disks.

Further reference data for those commands can be found here:

http://mycusthelp.info/LSI/_cs/AnswerPreview.aspx?sSessionID=&inc=8275

Should be all you have to do. Just use the normal hardware introspection in Linux, then Google, then download and install the utilities that go with it.

@Gene's suggestions and comments are absolutely spot-on.

This answer is entirely specific to the output you get from the lspci command, and the ability for your Google search to identify the manufacturer and to grab the correct command line tool.

But it does show that you can get all of this from a server, on a command line, without halting the machine, opening the case, and pulling drives, which I hope is helpful.


Solution 3:

This isn't a one-size-fits-all answer and doesn't give you all the information you need, but on one Adaptec hardware RAID controller we've used it. It gave some access to the drives themselves via special devices /dev/sg1, /dev/sg2, etc.

We could run smartctl -a /dev/sg1 to get a lot of info on that physical drive including manufacturer, model number, interface, serial number, size, and other data.

As far as figuring out which controller is being used, I agree with Gene's comment about dmidecode, dmesg, and lspci - those would be my ones to try first as well.