LSI
Contents
- 1 LSI Overview
- 2 LSI Firmware and MegaCLI Downloads
- 3 How to show all LSI RAID info with MegaCLI
- 4 How to show physical drive info for an LSI RAID
- 5 LSI Write Caching Configuration
- 6 LSI Read Caching Configuration
- 7 LSI Direct and Cached I/O Modes
- 8 How to Enable Drive Caches with MegaCLI
- 9 How to Disable Drive Caches with MegaCLI
- 10 How check for NCQ and disable or enable with MegaCLI
- 11 View MegaCLI BBU Information
- 12 Configure LSI Card for SSD RAID
LSI Overview
LSI is now owned by Avago Technologies. The models and cards remain the same, however the names may change down the road. This wiki and the commands below are all based on the LSI-9260 4/8/16i models, and the commands should also work for the LSI 9266 line, as well as the 9270/9271 line.
If you have a newer model than what is mentioned above, please use caution before you run any commands as the syntax and options have changed.
LSI Firmware and MegaCLI Downloads
If you have an LSI 9260 model card that uses a single RoC (Raid on Chip), you can find the latest firmware at the link below. I strongly suggest upgrading all RAID cards to the latest firmware versions and I also suggest making sure the OS driver is also updated to the latest version. As of March 2015 the latest firmware can be found below
You can also find the latest version of LSI's MegaCLI utility.
Once you have unzipped the firmware, navigate to the directory where the rom is located and run the command below to begin the firmware update process. You may need to reboot the server so be careful about updating firmware on a production server unless you are aware of the possible downtime involved with a reboot.
/opt/MegaRAID/MegaCli/MegaCli64 -adpfwflash -f mr2108fw.rom -a0
How to show all LSI RAID info with MegaCLI
To display all LSI RAID card details such as arrays, drives and the basic configuration of the card run the command below to query logical device info.
/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aAll
For more detailed information on the RAID card settings run the command below.
/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -a0
How to show physical drive info for an LSI RAID
If you want to get a list of all the physical drives that are hooked up to the LSI card, you can use the pdlist option to view all the disks.
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -a0
LSI Write Caching Configuration
Configure Forced Write Back Cache with MegaCLI
If you want to enable Forced Write-Back mode on an LSI card you can run the command below which will immediately apply the new settings. Changing settings on the fly usually doesn't cause issues, but if the server is already under a lot of I/O you might not want to add the -Immediate option and reboot the server later. I do not suggest using Forced Write Back mode unless you have to. Using Write Back caching with SSDs is almost always going to result in slower performance, and if you don't have a BBU and you force write back caching you can lose data if the server hangs up or power is lost, so be careful with this setting.
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -ForcedWB -Immediate -Lall -aAll
Configure Normal Write Back Cache mode with MegaCLI
If you must use Write Back Mode, use this method instead of the one above since this command does not FORCE write back. This means that if the BBU is missing / failing the LSI card will revert the cache mode to write through to make sure data is safely written to disk. If you want to use Write Back caching but do not have a BBU then you have to use the command above to force write back caching.
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -WB -Immediate -Lall -aAll
Configure LSI to use cache even with bad BBU with MegaCLI
If you want to force write cache even if the LSI card knows it has a bad or missing BBU, then use this command. I have no idea why you would but I'm including this option anyway.
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -CachedBadBBU -Immediate -Lall -aAll
Configure LSI to disable cache with a bad BBU with MegaCLI
Disable write cache if no or bad BBU
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -NoCachedBadBBU -Immediate -Lall -aAll
Configure LSI to use Write Through Caching with MegaCLI
If you are using SSDs and want the best IO performance and want to make sure your data gets sent to disk asap, then you should be using Write Through caching, which is basically no cache at all.
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -WT -Immediate -Lall -aAll
LSI Read Caching Configuration
How to Enable or Disable LSI RAID Read Caching with MegaCLI
To disable Read Ahead caching with an LSI card you can use the -NORA (no read ahead) option. If you use SSDs, I suggest disabling read ahead caching on all LSI cards.
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -NORA -Immediate -Lall -aAll
If you still live in the early 2000's and use spinning HDDs and want better performance then you should enable Read Ahead caching.
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -RA -Immediate -Lall -aAll
LSI Direct and Cached I/O Modes
How to Enable Cached I/O mode with MegaCLI
If you are using Write Back mode, or have slow HDDs in a RAID you may get better performance by using the RAID card cache on the controller. To utilize this cache whenever possible, select the cached mode.
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Cached -Immediate -Lall -aAll
How to Enable Direct I/O mode with MegaCLI
If you have an all SSD RAID and you want the best I/O performance with your LSI card, you should enable Direct I/O mode which reads and writes directly to the SSDs and avoids the RAID cache. The SSDs usually have caches of their own so having to check the RAID card cache every time a request is made can actually reduce performance, to set Direct mode:
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Direct -Immediate -Lall -aAll
How to Enable Drive Caches with MegaCLI
Just like I mentioned above, you can utilize the individual drive caches in addition to the RAID card cache. If you are using SSDs and decide to not use the RAID cache I would at least make sure the SSD drive caches are enabled.
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -EnDskCache -Immediate -Lall -aAll
How to Disable Drive Caches with MegaCLI
If you must ensure that no data is ever cached and that data is written to disk immediately, then you will want to disable the RAID card cache, and the drive caches (unless they have an on board capacitor to flush writes to disk in the event of power loss).
/opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -DisDskCache -Immediate -Lall -aAll
How check for NCQ and disable or enable with MegaCLI
Check if NCQ is enabled with MegaCLI, you can use the commands below to enable or disable NCQ with LSI cards
/opt/MegaRAID/MegaCli/MegaCli64 -AdpGetProp -NCQDsply -aALL
Enable NCQ
/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp -NCQEnbl -aALL
Disable NCQ
/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp -NCQDsbl -aALL
View MegaCLI BBU Information
Displays BBU Details
/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -aAll
Configure LSI Card for SSD RAID
According to LSI, to get the best performance with SSDs, you should be using the following settings:
Read Cache: DISABLED Write Cache: WriteThrough IO: DIRECT
I've found that these settings provide the best random read and write performance. Typically enabling any type of cache reduces performance.
##Set to WriteThrough. Can be done live /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -WT -Immediate -Lall -aAll ##Disable ReadAhead / Read Caching /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -NORA -Immediate -Lall -aAll ##Set IO to Direct since we are not using any type of caching /opt/MegaRAID/MegaCli/MegaCli64 -LDSetProp -Direct -Immediate -Lall -aAll