Authors Top

If you have a few years of experience in the Linux ecosystem, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

1. Overview

RAID information is usually written on the drive labels. However, that would require us to turn off the machine and physically pull the drives out.

In this tutorial, we’ll see how to detect the RAID information, such as the name and the model number, from the Linux command line. Afterward, we can Google these models for further specific details.

2. Detecting RAID Information

The process of finding out the RAID controller information is dependent on the RAID being used. So, there might be tools available on the manufacturer’s website for that specific controller.

However, we can find general information like manufacturer, model number, and interface using tools like lspci, lshw, hwinfo, and lsscsi.

Software RAID is implemented by the user, so the type of RAID is easily known to a user. On the other hand, discerning between a genuine hardware RAID and FakeRAID is difficult.

However, one solution to this problem would be to run the lspci command and inspect the output, which is what we’ll do next.

2.1. lspci

Generally, if we want to check whether we’re using a RAID controller on our server, lspci is the way to do it. By default, it displays entries for many devices. However, we’ll narrow it down to “RAID” using grep:

$ lspci | grep RAID
00:1f.2 RAID bus controller: Intel Corporation 82801 Mobile SATA Controller [RAID mode] (rev 04)

The information we’re looking for is Intel Corporation 82801 Mobile SATAController [RAID mode]. The hardware RAID information appears in the output. In contrast, the FakeRAID implementations don’t appear in the lspci list.

2.2. lshw

Similarly, we can also use lshw to display additional RAID storage information:

$ lshw -class storage
       description: RAID bus controller
       product: 82801 Mobile SATA Controller [RAID mode]
       vendor: Intel Corporation
       physical id: 1f.2
       bus info: [email protected]:00:1f.2
       logical name: scsi0
       version: 04
       width: 32 bits
       clock: 66MHz
       capabilities: raid msi pm bus_master cap_list emulated
       configuration: driver=ahci latency=0
       resources: irq:26 ioport:f0d0(size=8) ioport:f0c0(size=4) ioport:f0b0(size=8) ioport:f0a0(size=4) ioport:f060(size=32) memory:f7e36000-f7e367ff

We should note that the command should be run as root. Otherwise, we’d see a warning message with no relevant output.

2.3. smartctl

In addition to the above methods, we can also use the smartctl utility to find out our disk information from virtual devices. smartctl is used to generate various disk reports and error logs. We can install it from the official repositories.

Before running smartctl against our drives, we’ll parse the dmesg output for our SCSI disk first:

$ dmesg | grep -i scsi
[    0.210852] SCSI subsystem initialized
[    0.341280] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 243)
[    1.213299] scsi 0:0:0:0: Direct-Access     ATA      ST320LT012-9WS14 YAM1 PQ: 0 ANSI: 5
[    1.319886] sd 0:0:0:0: [sda] Attached SCSI disk
[   19.571008] sd 0:0:0:0: Attached scsi generic sg0 type 0

We can see that the SCSI disk is available under the sda virtual device. Now, we can generate various reports and run different tests against this device using smartctl.

For that purpose, we can use the –all option to print the entire relevant information about the disk:

$ smartctl --all /dev/sda
Model Family:     Seagate Laptop HDD
Device Model:     ST320LT012-9WS14C
Serial Number:    S0V3R9LL
LU WWN Device Id: 5 000c50 05be4653c
Firmware Version: 0001YAM1
User Capacity:    320,072,933,376 bytes [320 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    5400 rpm
Form Factor:      2.5 inches
Device is:        In smartctl database 7.3/5319
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 2.6, 3.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sat Nov 19 20:52:01 2022 PKT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

smartctl doesn’t necessarily print information about RAID controllers. However, it gives us enough details to search the web for additional information.

2.4. MegaCLI

We can check for array layout information like RAID type and spare disks using other utilities. One of the generic tools for this use case is the megacli utility.

Let’s check the whole array and RAID level:

$ megacli -LDInfo -Lall -aALL
Adapter 0 -- Virtual Drive Information:
Virtual Drive: 0 (Target Id: 0)
Name                : SEAGATE
RAID Level          : Primary-1, Secondary-0, RAID Level Qualifier-0
Size                : 320 GB
Sector Size         : 512
Mirror Data         : 320 GB
State               : Optimal

The output contains information about the disk(s) and the RAID being used. In our case, the RAID level is RAID0. The most common are RAID0, RAID1, RAID5, and RAID6.

2.5. lsscsi

Another helpful utility that we can use is lsscsi. Unfortunately, it’s not available on major distributions by default, so we’d need to install it from the official repositories.

Once installed, we can simply type in the lsscsi command:

$ lsscsi
[0:0:0:0]    disk    ATA      ST320LT012-9WS14 YAM1  /dev/sda

Here, we can see that we’re using ATA with the model number ST320LT012-9WS14.

With the manufacturer and model number in hand, we should be able to get the additional information and helper tools about the RAID controller from the Internet. A simple Google query will fetch the related results.

In our case, we can simply head over to the Seagate official website and download the required tools built for Linux.

2.6. Vendor-Specific Tools

The generic tools we’ve discussed so far can be used to generate quick information. However, when vendor-specific tools are available for the system, we should emphasize using them instead of generic utilities.

For instance, we can use the omreport utility that ships with the OpenManage CLI suite. The omreport utility generates system-specific information, including details about the virtual disks.

As an example, let’s extract information about the /dev/sda virtual device:

$ omreport storage vdisk
List of Virtual Disks in the System

Controller SEAGATE Laptop HDD
ID                                : 0
Status                            : Ok
Name                              : SEAGATE
State                             : Ready
Hot Spare Policy violated         : Not Assigned
Encrypted                         : No
Layout                            : RAID-0
Size                              : 320.00 GB (343597383680 bytes)
T10 Protection Information Status : No
Associated Fluid Cache State      : Not Applicable
Device Name                       : /dev/sda
Bus Protocol                      : ATA
Media                             : HDD
Read Policy                       : Adaptive Read Ahead
Write Policy                      : Write Back
Cache Policy                      : Not Applicable
Stripe Element Size               : 128 KB
Disk Cache Policy                 : Enabled

3. Conclusion

In this article, we learned how we can detect information about RAID controllers in Linux. We used different generic utilities to generate the disk and RAID controller reports.

Moreover, we also used the vendor-specific utility for the same purpose.

Authors Bottom

If you have a few years of experience in the Linux ecosystem, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

Comments are closed on this article!