Posts Tagged ‘megaraid’

Linux : Force megaraid consistency check

Wednesday, September 25th, 2013

The LSI megaraid cards are excellent. However there are times that you want to know you can sleep well at night. One of the ways to help that happen is to ensure that your consistency checks and patrol reads are happening regularly. Some people however disable them to stop the I/O overheads of doing such tasks. There is one big downside. Often if you disable either a consistency check or patrol read the trust in the data needs to be re-evaluated. The default configuration on the MegaRAID cards is to do both a patrol read and consistency check at least every 168 hours (7 days). But what If you want to run the consistency check manually at your own interval that suits your business needs? The simple answer is to use the MegaCli command (available via the LSI downloads page) and schedule the task to run via cron or some other business automation tool.

First make sure that the time is set correctly on your RAID card. Most Megaraid cards are set to GMT/UTC when they leave the factory (it seems). So make sure that your cards reflect your system’s time.

/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetTime `date +%Y%m%d` `date +%H:%M:%S` -aALL -NoLog

Now that you know the time is accurate the way to see when the next consistency check is scheduled is to run the following command.

/opt/MegaRAID/MegaCli/MegaCli64 -AdpCcSched -Info -aALL
 Adapter #0
 Operation Mode: Concurrent
 Execution Delay: 168
 Next start time: 09/25/2013, 18:00:00
 Current State: Stopped
 Number of iterations: 0
 Number of VD completed: 0
 Excluded VDs          : None
 Exit Code: 0x00

That command should run cleanly on Linux x64 there are 32bit versions also available from the download site named “MegaCli”

Now that you know when the scheduled task is set to run or not you can force one to start in the next hour by simple running the following.

/opt/MegaRAID/MegaCli/MegaCli64 -AdpCCSched -SetSTartTime 20130925 19 -aALL

Adapter 0: Scheduled CC start time is set.

Exit Code: 0x00

Now that it is scheduled you can then run the command again to confirm that the time is right.

/opt/MegaRAID/MegaCli/MegaCli64 -AdpCcSched -Info -aALL
 Adapter #0
 Operation Mode: Concurrent
 Execution Delay: 168
 Next start time: 09/25/2013, 19:00:00
 Current State: Stopped
 Number of iterations: 0
 Number of VD completed: 0
 Excluded VDs          : None
 Exit Code: 0x00

Hopefully you will now be able to see a successful consistency check run across all the data.

NOTE: It is possible that if you have not had a consistency check in some time that drives or data mail fail the check. If you do not have any hot spares allocated it is possible that your RAID state could go into a degraded state or lose data entirely. If you have any concerns raise a ticket with LSI.

References : LSI Command Reference