megacli - How to Locate Drive a drive

You can use the commands below to locate a drive.

We will first list the enclosures connected to our RAID card with the command below :

root@hv2:/opt/MegaRAID/MegaCli# megacli -EncInfo -aALL
                                     
    Number of enclosures on adapter 0 -- 2

    Enclosure 0:
    Device ID                     : 17
    Number of Slots               : 24
    Number of Power Supplies      : 0
    Number of Fans                : 3
    Number of Temperature Sensors : 1
    Number of Alarms              : 0
    Number of SIM Modules         : 0
    Number of Physical Drives     : 17
    Status                        : Normal
    Position                      : 1
    Connector Name                : Port 0 - 3
    
    ...
    
    Enclosure 1:
    Device ID                     : 252
    Number of Slots               : 8
    Number of Power Supplies      : 0
    Number of Fans                : 0
    Number of Temperature Sensors : 0
    Number of Alarms              : 0
    Number of SIM Modules         : 1
    Number of Physical Drives     : 0
    Status                        : Normal
    Position                      : 1
    Connector Name                : Unavailable
    
    ...
Exit Code: 0x00

We can now use the Device ID to activate the drive's LED, but first we need to find the drive slot number with the command below :

root@hv2:/opt/MegaRAID/MegaCli# megacli -pdlist -aALL | grep -i 'slot\|raw'
Slot Number: 0
Raw Size: 136.732 GB [0x11177330 Sectors]
Slot Number: 1
Raw Size: 136.732 GB [0x11177330 Sectors]
Slot Number: 2
Raw Size: 558.792 GB [0x45d964b8 Sectors]
Slot Number: 3
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 4
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 5
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 6
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 7
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 8
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 9
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 10
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 11
Raw Size: 558.911 GB [0x45dd2fb0 Sectors]
Slot Number: 18
Raw Size: 279.396 GB [0x22ecb25c Sectors]
Slot Number: 20
Raw Size: 931.512 GB [0x74706db0 Sectors]
Slot Number: 21
Raw Size: 68.366 GB [0x88bb992 Sectors]
Slot Number: 23
Raw Size: 279.396 GB [0x22ecb25c Sectors]

We are using grep to return just the slot number and size lines because the command returns a lot of information. You can save the results into a TXT file and parse to get more information.

With the drives numbers we can now turn the LED on the enclosure :

root@hv2:/opt/MegaRAID/MegaCli# megacli -PdLocate -start -physdrv[17:9] -a0
                                     
Adapter: 0: Device at EnclId-17 SlotId-9  -- PD Locate Start Command was successfully sent to Firmware 

Exit Code: 0x00

a0 - adapter number.

And to turn off the LED we can use the same command but and instead of the flag -start we will use stop:

root@hv2:/opt/MegaRAID/MegaCli# megacli -PdLocate -stop -physdrv[17:9] -a0
                                     
Adapter: 0: Device at EnclId-17 SlotId-9  -- PD Locate Stop Command was successfully sent to Firmware 

Exit Code: 0x00


Share Tweet Send
0 Comments
Loading...
You've successfully subscribed to Infoitech - [B]logging
Great! Next, complete checkout for full access to Infoitech - [B]logging
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.