DEV Community

Cover image for RAID Server commands | tw_cli | MegaCli | mdadm
HasOne
HasOne

Posted on • Updated on

RAID Server commands | tw_cli | MegaCli | mdadm

Basic terms

  • RAID: Redundant Array of Independent Disks. It's a data storage virtualization technology.
  • Controller: The hardware that manages the RAID array.
  • Unit: A virtual drive that consists of one or more physical drives.
  • Drive: A physical hard drive or SSD.
  • Rebuild: The process of recreating lost data on a new drive.
  • Parity: A mathematical method to recreate data lost from a disk in the array.
  • Striping: Data is split across multiple disks.
  • Mirroring: Data is duplicated on two or more disks.

Debugging

When debugging, it's important to check the status of your RAID controller and units regularly. If you see a status of DEGRADED, this means one or more drives have failed. If you see a status of REBUILDING, this means the RAID is currently rebuilding data on a new drive.

MegaCli Commands

  • View Adapter Information:

    MegaCli -AdpAllInfo -aALL
    
  • View the Configuration of the Controller:

    MegaCli -CfgDsply -aALL
    
  • List All Drives:

    MegaCli -PDList -aALL
    
  • View the Physical Disk Information:

    MegaCli -PDInfo -PhysDrv [Enclosure:Slot] -aALL
    
  • Check the Virtual Drive (Logical Drive) Information:

    Copy codeMegaCli -LDInfo -Lall -aALL
    
  • View the Battery Backup Unit (BBU) Status:

    MegaCli -AdpBbuCmd -aALL
    
  • Check for Consistency of RAID Configuration:

    MegaCli -LDCC -aALL
    
  • Rebuild a Drive:

    MegaCli -PDRbld -Start -PhysDrv [Enclosure:Slot] -aALL
    MegaCli -PDRbld -Stop -PhysDrv [Enclosure:Slot] -aALL
    MegaCli -PDRbld -ShowProg -PhysDrv [Enclosure:Slot] -aALL
    
  • Identify a Failed Drive:

    MegaCli -PDList -aALL | grep -E 'Slot Number|Firmware state'
    
    # OR
    MegaCli -CfgDsply -aALL | awk '/Physical Disk:/{print ""; print; next} /Slot Number|Firmware state|Enclosure Device ID:|Inquiry Data|Device Id/{print}'
    
    
  • Replace a Failed Drive:

    MegaCli -PDOffline -PhysDrv [Enclosure:Slot] -aALL
    MegaCli -PDMarkMissing -PhysDrv [Enclosure:Slot] -aALL
    MegaCli -PDPrpRmv -PhysDrv [Enclosure:Slot] -aALL
    
  • View Event Log:

    MegaCli -AdpEventLog -GetEvents -f events.log -aALL
    
  • Silence Alarm:

    MegaCli -AdpSetProp AlarmSilence -aALL
    
    

mdadm commands

  • To create a RAID 5 array:
mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sda1 /dev/sdb1 /dev/sdc1

Enter fullscreen mode Exit fullscreen mode
  • To view the status of the RAID:
cat /proc/mdstat

Enter fullscreen mode Exit fullscreen mode
  • To stop a raid array:
mdadm --stop /dev/md0

Enter fullscreen mode Exit fullscreen mode
  • To remove a failed disk:
mdadm --manage /dev/md0 --remove /dev/sda1

Enter fullscreen mode Exit fullscreen mode
  • To add a new disk to the array:
mdadm --manage /dev/md0 --add /dev/sdd1

Enter fullscreen mode Exit fullscreen mode

Please note these commands are general and your RAID setup and commands may differ.

tw_cli Commands

tw_cli is a command line tool for managing 3ware RAID controllers. Here are some basic commands:

  • To check the status of the RAID controller:
tw_cli info c0
Enter fullscreen mode Exit fullscreen mode
  • To check the status of a unit:
tw_cli /c0/u0 show
Enter fullscreen mode Exit fullscreen mode
  • To check the status of a drive:
tw_cli /c0/p0 show
Enter fullscreen mode Exit fullscreen mode
  • To silence an alarm:
tw_cli /c0 silence
Enter fullscreen mode Exit fullscreen mode
  • To rebuild a unit:
tw_cli /c0/u0 start rebuild disk=1
Enter fullscreen mode Exit fullscreen mode
  • To delete a unit:
tw_cli /c7/u2 del
Enter fullscreen mode Exit fullscreen mode
  • To disable a drive:
tw_cli /c0/p1 remove
Enter fullscreen mode Exit fullscreen mode
  • To enable a drive:
tw_cli /c0/p1 add
Enter fullscreen mode Exit fullscreen mode
  • To show events:
tw_cli /c0 show events
Enter fullscreen mode Exit fullscreen mode
  • To show all physical drives:
tw_cli /c0 show phy
Enter fullscreen mode Exit fullscreen mode

Conclusion

Understanding the RAID server and different command tools is important to manage, maintain, and monitor the RAID Server controllers and units to prevent data loss and smooth operation.

About me

I was recently hired as a System Administrator to handle a variety of RAID servers. My job involves a mix of analyzing and setting up these servers, keeping an eye on their performance, writing scripts to make things run smoother, and putting together dashboards to keep everything easy to track and manage.

My Email: hi@ericgit.me

Top comments (0)