http://lonesysadmin.net/linux-virtual-machine-tuning-guide/
Thursday, May 22, 2014
Wednesday, May 14, 2014
RHEL6 in readonly mode
http://www.vxcompany.info/2011/05/05/howto-rhel6-in-readonly-mode/
HOWTO: RHEL6 in readonly mode
I would like to make a RHEL system read-only. This is obviously not possible for the complete system. For example directories like /tmp en /var need write access. Why would I want this? There are various reasons:
- Security. It’s safe(r). Nobody can tamper with you’re system, unless they get root access. Getting root access is by itself pretty hard, but not impossible. I will add some simple tips to make it even harder to gain root access.
- Performance. Because most of the filesystem is readonly, there is no need for locking, making the IO system faster.
- Backup. Because the best part of the filesystem is readonly, that part needs to be back-ed up only once, making backup’s faster en smaller.
I will sum up the various things to make this work:
First, you need to think about you’re file system and partition layout. The following is needed at a minimum (make the size as needed):
- Seperate
/bootpartition. This is mainly necessary if you’re going to put the rest into LVM, which we will. - A seperate LV for
/ - Seperate LV’s for
/home,/tmp,/varandswap. I also wanted to put/rootinto a seperate LV, but anaconda refused to do this.
Install the system and login with root. Next, make the following adjustments:
- Add the
noexecoption to the mountoptions of the/tmp,/var,/boot,swapand possibly/homefilesystems. This prevents the execution of executables on these filesystems, even if you have execute permission. If you want you’re users to be able to execute scripts from their home directory, don’t add this to the/homefilesystem. - Add the
rooption to the root filesystem. Don’t be surprised is you’ll end up with a writable root filesystem after reboot. More needs to be done. - Some files in
/etcneed write access, although imho they don’t belong there, because of this. These files are/etc/mtaband/etc/resolv.conf. mtab is more or less deprecated and/proc/mountsgives you the same and even more info. However, the system complains about not being able to write to it./etc/resolv.confmust only be writeable is the system is on DHCP and under the control of NetworkManager. Most servers have a static ip stack and don’t need NetworkManager. Create a directory/vat/etc, move/etc/mtaband, if needed,/etc/resolv.confto this directory and create symlinks to them from their old location in/etc. - Add the following two lines to the end of
/etc/rc.d/rc.local:
umount /boot
mount -o remount,ro /
This will unmount
/boot and remounts the root filesystem to readonly. This file is executed at the end of the boot procedure and will unmount the /boot filesystem and make the root filesystem readonly. The /boot filesystem is only needed during boot and maintenance.- As root, create the directory
/root/binand create 2 scripts, namedmaintonandmaintoffinside it. Make sure these two scripts havemode 6000on them. We put these scripts in/root/binbecause this directory is only accessable by root and is present in the path of the root user. Pretty safe. The function of themaintonscript is to change the system to “maintenance mode” by making the root filesystem writeable again and by mounting the boot filesystem on it.maintoff, as you would guess, reverts this again, putting the system into “safe” mode. The two scripts look like this:
/root/bin/mainton:
#!/bin/sh
mount -o remount,rw /
mount /boot
echo "System now in Maintenance Mode.."
exit 0
/root/bin/maintoff:
#!/bin/sh
if [ -d /boot/grub ]; then umount /boot; fi
mount -o remount,ro /
echo "System now in Safe Mode.."
exit 0
- Add the
/root/bin/maintoffscript to/root/.bash_logout. This will put the system into safe mode implicetly when you logout, in case you forgot to do it explicetly.
Now, if maintenance is needed, simply execute
mainton and everything is back to “normal”. After maintenace, don’t forget to put the system back into safe mode by executing maintoff. Depending on the function of the server, more stuff needs to be done. For example, if you install apache onto this system, the websites end up in /var/www. That’s a writeable filesystem and I don’t particularly like to have my website on that. Better move it to /web or something, but don’t forget to change the SELinux policies to reflect this. Some apps like to have themselves installed in /opt and want to have write access to some files in there. Find out what files need write access and move them to a location in /var, where they belong. Just use the same procedure as with /etc/mtab.
If this is a virtual filesystem, things get even better. Put all the readonly filesystems,
/tmp, and swap on one virtual disk, /var and /home on another. save the virtual disk with the readonly filesystems as a template disk. Restoring the system is now simply copying the template and restoring the virtual disk with /var on it. Don’t forget to create a new template after doing maintenance.
For backup purpose, only
/var needs to be back-ed up. Doing backup’s and restores fast using snapshot technology is for another HOWTO post.Wednesday, February 12, 2014
Best practices for maintenance of RSA Authentication Manager 6.1.2
1. Maintain correct local time on Primary server.
- Utilize the Network Time Protocol (NTP) if possible.
- Server local time must be monitored at all times to ensure that there is no drift in system time.
- If you notice a drift in the local time, do not correct it without scheduling. It may be required that you need to run the RSA 'setsyncint' utility and it may require downtime for administration.
2. Schedule regular reboots of the Primary authentication server.
- This will free up all resources, particularly if your Primary server maintains inbound TCP connections from remote admin, Quick admin and Deployment Manager products.
Note : If these connections exceed the limits set by the operating system, the server may refuse the requests for new connections from web server or remote administration machines.
- The server may run out of resources when not restarted on a semi-regular basis, especially if it is extremely busy.
- If your database is prohibitively large (e.g. > 5,000 users and tokens), plan and schedule server database compression and log database compression.
- Schedule compression of your log database and server database on separate days.
- Utilize the 'sdcompress' utility to accomplish this.
4. Monitor file sizes of RSA system files.
- Closely monitor the sizes of the sdlog.* and sdserv.* files in the RSA "prog" sub-directory.
- The file size of any single file should never be allowed to exceed 2 GB.
- Use the "delete and archive" feature to accomplish this.
- Refer to page 153 of the "RSA Authentication Manager 6.1 Administrator's Guide".
6. Maintain the Windows Event Viewer or UNIX system logs.
- Use the Windows Event Viewer to save and subsequently clear the Application log and System log.
- Clear all logs frequently.
- If the system log is too busy, you will be forced to delete it.
7. Replica nomination.
- If for some reason, the Primary server cannot be restarted due to a hard disk or other failure, immediately nominate a replica server to become the primary server.
8. Maintain Windows or UNIX operating system patches.
- Update the Primary server with most recent service pack, and other security patches.
- It is not necessary to update the web browser.
9. Backup your data.
- Do not backup the files while RSA services are running.
- Stop the RSA services and save the RSA Authentication Manager\data directory.
- Save the data on an alternate server or filesystem.
10. Monitor logs for status of replication.
- Always ensure replication is running correctly.
- Monitor the Primary server system log and application log for positive messages regarding successful replication.
Monday, February 3, 2014
MegaCli
Managing LSI Raid Cards
Docs:
To identify the problem drive:
~/tmp $ grep -n ErrLba ttylog.txt
The ErrLba= indicates a hardware error on the specified block. It seems
the raid controller attempted to read the data, and found it to be
corrupted. But, it then wrote it back, and all is now okay again
~/tmp $ grep -n orrected ttylog.txt
if it sees many of these errors (many being a loose
definition which varies from disk to disk) the controller will raise a
predictive failure error. Until then, we ignore it.
----------
Docs:
- https://supportforums.cisco.com/docs/DOC-16309
- http://tools.rapidsoft.de/perc/perc-cheat-sheet.html
- https://calomel.org/megacli_lsi_commands.html
General Parameters
- Adapter parameter -aN
The parameter -aN (where N is a number starting with zero or the string ALL) specifies the adapter ID. If you have only one controller it’s safe to use ALL instead of a specific ID, but you’re encouraged to use the ID for everything that make changes to your RAID configuration. - Physical drive parameter -PhysDrv [E:S]
For commands that operate on one or more pysical drives, the -PhysDrv [E:S] parameter is used, where E is the enclosure device ID in which the drive resides and S the slot number (starting with zero). You can get the enclosure device ID using MegaCli -EncInfo -aALL. The E:S syntax is also used for specifying the physical drives when creating a new RAID virtual drive. - Virtual drive parameter -Lx
The parameter -Lx is used for specifying the virtual drive (where x is a number starting with zero or the string all).
Gather information
- Controller information
# MegaCli -AdpAllInfo -aALL # MegaCli -CfgDsply -aALL # MegaCli -AdpEventLog -GetEvents -f events.log -a0 -nolog # MegaCli -fwtermlog -dsply -a0 - Enclosure information
# MegaCli -EncInfo -aAll - Virtual drive information
# MegaCli -LDInfo -Lall -aALL - Physical drive information
# MegaCli -PDList -aALL # MegaCli -PDInfo -PhysDrv [E:S] -aALL - Battery backup information
# MegaCli -AdpBbuCmd -aALL - Show Consistancy check progress
- Background initialization (ongoing processes)
# MegaCli -LDBI -ShowProg|-ProgDsply -aAll
Set background initialization rate to 90%# MegaCli -AdpSetProp BgiRate 90 -aAll
Controller Management
- Silence active alarm
# MegaCli -AdpSetProp AlarmSilence -aALL - Disable alarm
# MegaCli -AdpSetProp AlarmDsbl -aALL - Enable alarm
# MegaCli -AdpSetProp AlarmEnbl -aALL - Disable battery backup warning on system boot
# MegaCli -AdpSetProp BatWarnDsbl -a0 - Change adpater rebuild rate to 60%
# MegaCli -AdpSetProp {RebuildRate -60} -aALL
Virtual Drive Management
- Create RAID 0,1,5 drive
# MegaCli -CfgLdAdd -r(0|1|5) [E:S, E:S, ...] -aN - Create RAID 10 drive
# MegaCli -CfgSpanAdd -r10 -Array0[E:S,E:S] -Array1[E:S,E:S] -aN - Remove drive
# MegaCli -CfgLdDel -Lx -aN
Physical Drive Management
- Set state to offline
# MegaCli -PDOffline -PhysDrv [E:S] -aN - Set state to online
# MegaCli -PDOnline -PhysDrv [E:S] -aN - Mark as missing
# MegaCli -PDMarkMissing -PhysDrv [E:S] -aN - Prepare for removal
# MegaCli -PdPrpRmv -PhysDrv [E:S] -aN - Show missing drive
# MegaCli -PDGetMissing -a0 - Replace missing drive
# MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
* The number N of the array parameter is the Span Reference you get using MegaCli -CfgDsply -aALL and the number N of the row parameter is the Physical Disk in that span or array starting with zero (it’s not the physical disk’s slot!). - Rebuild drive, drive status should be "Firmware state: Rebuild"
# MegaCli -PDRbld -Start|-Stop|-ShowProg|-ProgDsply -PhysDrv [E:S] -aN - Clear drive
# MegaCli -PDClear -Start|-Stop|-ShowProg -PhysDrv [E:S] -aN - Bad to good
# MegaCli -PDMakeGood -PhysDrv[E:S] -aN - Blink the fron LED to help locate a particular drive
# MegaCli -AdpSetProp \{UseDiskActivityforLocate -1\} -aALL# MegaCli -PdLocate -start -physdrv\[E:S\] -aALL
Stop the blinking
# MegaCli -PdLocate -stop -physdrv\[E:S\] -aALL
Hot Spare Management
- Set global hot spare
# MegaCli -PDHSP -Set -PhysDrv [E:S] -aN - Remove hot spare
# MegaCli -PDHSP -Rmv -PhysDrv [E:S] -aN - Set dedicated hot spare
# MegaCli -PDHSP -Set -Dedicated -ArrayN,M,... -PhysDrv [E:S] -aN
Rebuild a drive that is marked 'Foreign' when inserted:
- Bad to Good
# MegaCli -PDMakeGood -PhysDrv [E:S] -aALL - Clear foreign setting
# MegaCli -CfgForeign -Scan -aALL
# MegaCli -CfgForeign -Clear -aALL - set global hot spare
# MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
MegaCli -PDList -aAll | grep --before-context=12 Firmware
Find drive that the "Firmware state" is not "online"
Change/Replace a drive
- Enable autorebuild
# # MegaCli -AdpAutoRbld -Enbl -a0 - set the drive offline
# MegaCli -PDOffline -PhysDrv [E:S] -aN - mark the drive as missing
# MegaCli -PDMarkMissing -PhysDrv [E:S] -aN - prepare drive for removal
# MegaCli -PDPrpRmv -PhysDrv [E:S] -aN - change/replace the drive
- if you are using hot spares, the replaced drive should become new hot spare
# MegaCli -PDHSP -Set -PhysDrv [E:S] -aN
if you are not using hot spares, you must re-add the new drive to your RAID virtual drive and start the rebuilding
# MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
# MegaCli -PDRbld -Start -PhysDrv [E:S] -aN
To identify the problem drive:
- Gather information:
MegaCli -LDInfo -Lall -aALLMegaCli -PDList -a0MegaCli -CfgDsply -aALLMegaCli -AdpGetProp AlarmDsply -aAllMegaCli -LDCC -ShowProg -L0 -a0 -NologMegaCli -FwTermLog -Dsply -a0
- Locate a physical drive: MegaCli64 -PdLocate -start -physdrv [E:S] -a0
- To Clear Terminal Log: MegaCli -FwTermLog -Clear -aN
- Check battery status: MegaCli -AdpBbuCmd -aAll
- Check BBU (battery backup unit) status:
MegaCli -AdpBbuCmd -GetBbuStatus -a0 -NoLog | egrep 'charge|battery' - Work with bad BBU: MegaCli -LDSetProp CachedBadBBU -LAll -aAll -NoLog
- To find enclosure IDs: MegaCli -EncInfo -aN
- To view a particular physical drive: MegaCli -pdinfo -PhysDrv [E:S] -aN
- To replace a drive:
MegaCli -PDOffline -PhysDrv [E:S] -aNMegaCli -PDMarkMissing -PhysDrv [E:S] -aNMegaCli -PDPrpRmv -PhysDrv [E:S] -aN- ** swap the drive **
MegaCli -PdReplaceMissing -PhysDrv [E:S] -ArrayN -rowN -aN
Note: The number N of the array parameter is the Span Reference you get usingFor example: to replace physical disk 0 in span 1 using disk ID 25 you would use the following command: MegaCli -PdReplaceMissing -PhysDrv [:25] -Array1 -row0 -a0MegaCli -CfgDsply -aALLand the number N of the row parameter is the Physical Disk in that span which you are replacing, not the slot number. S is the slot number of the NEW disk.
Warning: Drive rebuilds do not start automatically! You have to actually tell the controller to start rebuilding the drive.
MegaCli -PDRbld -Start -PhysDrv [E:S] -aNTo rebuild a drive that has a "foreign" configuration:
- Mark the drive as good: MegaCli -PDMakeGood -PhysDrv [E:S] -aALL
- Clear the foreign setting: MegaCli -CfgForeign -Clear -a0
- Set global hot spare - drive should start rebuilding after this:
MegaCli -PDHSP -Set -PhysDrv [E:S] -aN - Stop consistency check:MegaCli -LDCC -Abort -L0 -a0 -Nolog
- Silence Alarm Beeps: MegaCli -AdpSetProp -AlarmSilence -aN
- Show Rebuild Status:
watch -n 10 /opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg PhysDrv [E:S] -a0
Dump the log file${megacli} -fwtermlog -dsply -aall > /tmp/ttylog.txt
~/tmp $ grep -n ErrLba ttylog.txt
The ErrLba= indicates a hardware error on the specified block. It seems
the raid controller attempted to read the data, and found it to be
corrupted. But, it then wrote it back, and all is now okay again
~/tmp $ grep -n orrected ttylog.txt
if it sees many of these errors (many being a loose
definition which varies from disk to disk) the controller will raise a
predictive failure error. Until then, we ignore it.
----------
~]# MegaCLI -help
MegaCLI SAS RAID Management Tool Ver 1.01.39 Aug 01, 2007
(c)Copyright 2007, LSI Logic Corporation, All Rights Reserved.
${megacli} -v
${megacli} -help|-h|?
${megacli} -adpCount
${megacli} -AdpSetProp {CacheFlushInterval -val}|{ RebuildRate -val}
|{PatrolReadRate -val}|{BgiRate -val}|{CCRate -val}
|{ReconRate -val}|{SpinupDriveCount -val}|{SpinupDelay -val}
|{CoercionMode -val}|{ClusterEnable -val}|{PredFailPollInterval -val}
|{BatWarnDsbl -val} |{EccBucketSize -val} | {EccBucketLeakRate -val}
|{AbortCCOnError val} | AlarmEnbl | AlarmDsbl | AlarmSilence -aN|-a0,1,2|-aALL
${megacli} -AdpGetProp CacheFlushInterval | RebuildRate | PatrolReadRate | BgiRate
| CCRate | ReconRate | SpinupDriveCount | SpinupDelay | CoercionMode
| PredFailPollInterval | EccBucketSize | EccBucketLeakRate | EccBucketCount
| ClusterEnable | BatWarnDsbl | AbortCCOnError | AlarmDsply -aN|-a0,1,2|-aALL
${megacli} -AdpAllInfo -aN|-a0,1,2|-aALL
${megacli} -AdpGetTime -aN|-a0,1,2|-aALL
${megacli} -AdpSetTime yyyymmdd hh:mm:ss -aN
${megacli} -AdpSetVerify -f fileName -aN|-a0,1,2|-aALL
${megacli} -AdpBIOS -Enbl |-Dsbl | -SOE | -BE | -Dsply -aN|-a0,1,2|-aALL
${megacli} -AdpBootDrive {-Set -Lx}|-Get -aN|-a0,1,2|-aALL
${megacli} -AdpAutoRbld -Enbl|-Dsbl|-Dsply -aN|-a0,1,2|-aALL
${megacli} -AdpCacheFlush -aN|-a0,1,2|-aALL
${megacli} -AdpPR -Dsbl|EnblAuto|EnblMan|Start|Stop|Info|{SetDelay Val}
-aN|-a0,1,2|-aALL
${megacli} -AdpCcSched -Dsbl|-Info|{-ModeConc | -ModeSeq [-ExcludeLD -LN|-L0,1,2]
[-SetStartTime yyyymmdd hh ] [-SetDelay val ] } -aN|-a0,1,2|-aALL
${megacli} -AdpCcSched -SetStartTime yyyymmdd hh -aN|-a0,1,2|-aALL
${megacli} -AdpCcSched -SetDelay val -aN|-a0,1,2|-aALL
${megacli} -FwTermLog -BBUoff|BBUoffTemp|BBUon|BBUGet|Dsply|Clear -aN|-a0,1,2|-aALL
${megacli} -AdpShutDown -aN|-a0,1,2|-aALL
${megacli} -PDList -aN|-a0,1,2|-aALL
${megacli} -PDGetNum -aN|-a0,1,2|-aALL
${megacli} -pdInfo -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
${megacli} -PDOnline -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
${megacli} -PDOffline -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
${megacli} -PDMakeGood -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
${megacli} -PDHSP {-Set [-Dedicated [-ArrayN|-Array0,1,2...]] [-EnclAffinity] [-nonRevertible]}
|-Rmv -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
${megacli} -PDRbld -Start|-Stop|-ShowProg |-ProgDsply
-PhysDrv [E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
${megacli} -PDClear -Start|-Stop|-ShowProg |-ProgDsply
-PhysDrv [E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
${megacli} -PdLocate {[-start] | -stop} -physdrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
${megacli} -PdMarkMissing -physdrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL
${megacli} -PdGetMissing -aN|-a0,1,2|-aALL
${megacli} -PdReplaceMissing -physdrv[E0:S0] -arrayA, -rowB -aN
${megacli} -PdPrpRmv [-UnDo] -physdrv[E0:S0] -aN|-a0,1,2|-aALL
${megacli} -EncInfo -aN|-a0,1,2|-aALL
${megacli} -PhyInfo -phyM -aN|-a0,1,2|-aALL
${megacli} -LDInfo -Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL
${megacli} -LDSetProp {-Name LdNamestring} | -RW|RO|Blocked | WT|WB|RA|NORA|ADRA
| Cached|Direct | -EnDskCache|DisDskCache | CachedBadBBU|NoCachedBadBBU
-Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL
${megacli} -LDGetProp -Cache | -Access | -Name | -DskCache -Lx|-L0,1,2|-LALL
-aN|-a0,1,2|-aALL
${megacli} -LDInit {-Start [-full]}|-Abort|-ShowProg|-ProgDsply -Lx|-L0,1,2|-LALL -aN|-a0,1,2|-aALL
${megacli} -LDCC -Start|-Abort|-ShowProg|-ProgDsply -Lx|-L0,1,2|-LALL -aN|-a0,1,2|-aALL
${megacli} -LDBI -Enbl|-Dsbl|-getSetting|-Abort|-ShowProg|-ProgDsply -Lx|-L0,1,2|-LALL -aN|-a0,1,2|-aALL
${megacli} -LDRecon {-Start -rX [{-Add | -Rmv} -Physdrv[E0:S0,...]]}|-ShowProg|-ProgDsply
-Lx -aN
${megacli} -LdPdInfo -aN|-a0,1,2|-aALL
${megacli} -LDGetNum -aN|-a0,1,2|-aALL
${megacli} -CfgLdAdd -rX[E0:S0,E1:S1,...] [WT|WB] [NORA|RA|ADRA] [Direct|Cached]
[CachedBadBBU|NoCachedBadBBU] [-szXXX [-szYYY ...]]
[-strpszM] [-Hsp[E0:S0,...]] [-AfterLdX] -aN
${megacli} -CfgEachDskRaid0 [WT|WB] [NORA|RA|ADRA] [Direct|Cached]
[CachedBadBBU|NoCachedBadBBU] [-strpszM] -aN|-a0,1,2|-aALL
${megacli} -CfgClr -aN|-a0,1,2|-aALL
${megacli} -CfgDsply -aN|-a0,1,2|-aALL
${megacli} -CfgLdDel -LX|-L0,2,5...|-LALL -aN|-a0,1,2|-aALL
${megacli} -CfgFreeSpaceinfo -aN|-a0,1,2|-aALL
${megacli} -CfgSpanAdd -r10 -Array0[E0:S0,E1:S1] -Array1[E0:S0,E1:S1] [-ArrayX[E0:S0,E1:S1] ...]
[WT|WB] [NORA|RA|ADRA] [Direct|Cached] [CachedBadBBU|NoCachedBadBBU]
[-szXXX[-szYYY ...]][-strpszM][-AfterLdX] -aN
${megacli} -CfgSpanAdd -r50 -Array0[E0:S0,E1:S1,E2:S2,...] -Array1[E0:S0,E1:S1,E2:S2,...]
[-ArrayX[E0:S0,E1:S1,E2:S2,...] ...] [WT|WB] [NORA|RA|ADRA] [Direct|Cached]
[CachedBadBBU|NoCachedBadBBU][-szXXX[-szYYY ...]][-strpszM][-AfterLdX] -aN
${megacli} -CfgSave -f filename -aN
${megacli} -CfgRestore -f filename -aN
${megacli} -CfgForeign -Scan -aN|-a0,1,2|-aALL
${megacli} -CfgForeign -Dsply [x] -aN|-a0,1,2|-aALL
${megacli} -CfgForeign -Preview [x] -aN|-a0,1,2|-aALL
${megacli} -CfgForeign -Import [x] -aN|-a0,1,2|-aALL
${megacli} -CfgForeign -Clear [x] -aN|-a0,1,2|-aALL
x - index of foreign configurations. Optional. All by default.
${megacli} -AdpEventLog -GetEventLogInfo -aN|-a0,1,2|-aALL
${megacli} -AdpEventLog -GetEvents -f -aN|-a0,1,2|-aALL
${megacli} -AdpEventLog -GetSinceShutdown -f -aN|-a0,1,2|-aALL
${megacli} -AdpEventLog -GetSinceReboot -f -aN|-a0,1,2|-aALL
${megacli} -AdpEventLog -IncludeDeleted -f -aN|-a0,1,2|-aALL
${megacli} -AdpEventLog -GetLatest n -f -aN|-a0,1,2|-aALL
${megacli} -AdpEventLog -GetCCIncon -f -LX|-L0,2,5...|-LALL -aN|-a0,1,2|-aALL
${megacli} -AdpEventLog -Clear -aN|-a0,1,2|-aALL
${megacli} -AdpBbuCmd -aN|-a0,1,2|-aALL
${megacli} -AdpBbuCmd -GetBbuStatus -aN|-a0,1,2|-aALL
${megacli} -AdpBbuCmd -GetBbuCapacityInfo -aN|-a0,1,2|-aALL
${megacli} -AdpBbuCmd -GetBbuDesignInfo -aN|-a0,1,2|-aALL
${megacli} -AdpBbuCmd -GetBbuProperties -aN|-a0,1,2|-aALL
${megacli} -AdpBbuCmd -BbuLearn -aN|-a0,1,2|-aALL
${megacli} -AdpBbuCmd -BbuMfgSleep -aN|-a0,1,2|-aALL
${megacli} -AdpBbuCmd -BbuMfgSeal -aN|-a0,1,2|-aALL
${megacli} -AdpBbuCmd -SetBbuProperties -f -aN|-a0,1,2|-aALL
${megacli} -AdpFacDefSet -aN
${megacli} -AdpFwFlash -f filename [-NoSigChk] [-NoVerChk] -aN|-a0,1,2|-aALL
${megacli} -AdpGetConnectorMode -ConnectorN|-Connector0,1|-ConnectorAll -aN|-a0,1,2|-aALL
${megacli} -AdpSetConnectorMode -Internal|-External -ConnectorN|-Connector0,1|-ConnectorAll -aN|-a0,1,2|-aALL
${megacli} -PhyErrorCounters -aN|-a0,1,2|-aALL
${megacli} -DirectPdMapping -Enbl|-Dsbl|-Dsply -aN|-a0,1,2|-aALL
Note: The directly connected drives can be specified as [:S]
Wildcard '?' can be used to specify the enclosure ID for the drive in the
only enclosure without direct connected device or the direct connected
drives with no enclosure in the system.
The following options may be given at the end of any command above:
[-Silent] [-AppLogFile filename] [-NoLog]
----------| Description | MegaCLI Command |
| System Commands | |
| Show the software version | MegaCLI -v |
| Show help information | MegaCLI -help|-h|? |
| Show the number of controllers connected | MegaCLI -adpCount |
| Controller Commands | |
| Show the status of properties related to the controllers | MegaCli -AdpGetProp <PropertyName>-aN|-a0,1,2|-aALL The following properties can be used with this command: abortcconerror alarmdsply autodetectbackplanedsbl Autoenhancedimportdsply autosnapshotspace batwarndsbl bgirate bootwithpinnedcache cachebypass ccrate clusterenable coercionmode copybackdsbl Defaultldpspolicy defaultsnapshotspace defaultviewspace disableldpsinterval disableldpstime disableocr dsbl eccbucketcount eccbucketleakrate eccbucketsize enableeghsp enableesmarter enableeug| enablejbod enblspindownunconfigdrvs loadbalancemode maintainpdfailhistoryenbl ncqdsply patrolreadrate perfmode predfailpollinterval rebuildrate reconrate rstrhotspareoninsert smartcpybkenbl spindowntime spinupdelay spinupdrivecount spinupencdelay spinupencdrvcnt ssdsmartcpybkenbl usediskactivityforlocate usefdeonlyencrypt |
| Set properties on the selected controllers |
Megacli -AdpSetProp <propertyname>-an|-a0,1,2|-aall The following properties can be set using this command: abortcconerror alarmdsply autodetectbackplanedsbl autoenhancedimportdsply autosnapshotspace batwarndsbl bgirate bootwithpinnedcache cachebypass ccrate clusterenable coercionmode copybackdsbl defaultldpspolicy defaultsnapshotspace defaultviewspace disableldpsinterval disableldpstime disableocr dsbl eccbucketcount eccbucketleakrate eccbucketsize enableeghsp enableesmarter enableeug| enablejbod enblspindownunconfigdrvs loadbalancemode maintainpdfailhistoryenbl ncqdsply patrolreadrate perfmode predfailpollinterval rebuildrate reconrate rstrhotspareoninsert smartcpybkenbl spindowntime spinupdelay spinupdrivecount spinupencdelay |
| Set properties on the selected controllers | autocarve=<on|off> autodetect=<on|off > disk=<p:-p>|all autorebuild=<on|off> carvesize=<1024..32768> dpmstat=<on|off> ondegrade=<cacheoff|follow> rebuild=<enable|disable|><1..5> rebuildmode=<adaptive|lowlatency> rebuildrate=<1..5> selftest=<enable|disable> spinup=<value> stagger=<value> verify=advanced|basic|<1..5> verify=basic [pref=ddd:hh]where hh={00..23} and ddd={mon|tue|wed|thu|fri|sat|sun} verify=enable|disable|<1..5> verifymode=<adaptive|lowlatency> verifyrate=<1..5> spinupencdrvcnt sdsmartcpybkenbl usediskactivityforlocate usefdeonlyencrypt |
| Show the number of controllers connected | MegaCLI -adpCount |
| Show all information about the adapter, such as cluster state, BIOS, alarm, firmware, version, and so on | MegaCli -AdpAllInfo -aN|-a0,1,2|-aALL |
| Show the freespace available in the controller | MegaCLI -CfgFreeSpaceinfo -aN|-a0,1,2|-aALL |
| Download the controller firmware | MegaCli -AdpFwFlash -f filename [-NoSigChk] [-NoVerChk] -aN|-a0,1,2|-aALL |
| Show the preserved cache status | MegaCLI-GetPreservedCacheList -aN|-a0,1,2|-aALL |
| Set the controller time | MegaCLI –AdpSetTime yyyymmdd hh:mm:ss -aN|-a0,1,2|-aALL |
| Set the controller time | MegaCLI –AdpGetTime -aN |
| RAID Configuration commands | |
| Create a RAID configuration of RAID type 0, 1, 5, and 6 | MegaCli –CfgLDAdd -R0|-R1|-R5|-R6[E0:S0,E1:S1,...] [WT|WB] [NORA|RA|ADRA] [Direct|Cached] [CachedBadBBU|NoCachedBadBBU] [-szXXXXXXXX [-szYYYYYYYY [... ]]] [-strpszM] [–Hsp[E5:S5,...]] [–afterLdX] -aN |
| Create a CacheCade virtual drive | MegaCLI -CfgCacheCadeAdd [-rX] -Physdrv[E0:S0,...] {-Name LdNamestring} [WT|WB|ForcedWB] [-assign -LX|L0,2,5..|LALL] -aN|-a0,1,2|-Aall |
| Create a RAID configuration of RAID type 10, 50, and 60 | MegaCli –CfgSpanAdd -aN|-a0,1,2|-aALL -R10|-R50|R60 –Array0[E0:S0,E1:S1,...] –Array1[E0:S0,E1:S1,...] [...] [WT | WB] [NORA | RA | ADRA] [Direct | Cached] [CachedBadBBU|NoCachedBadBBU] [-szXXXXXXXX [-szYYYYYYYY [... ]]] [-strpszM] [–afterLdX] -aN |
| Delete a virtual drive | MegaCli -CfgClr [-Force] -aN|-a0,1,2|-aALL |
| Show the topology information of the drive group | MegaCLI -CfgDsply -aN|-a0,1,2|-Aall |
| Show information for a CacheCade virtual drive | MegaCLI -CfgCacheCadeDsply -aN|-a0,1,2|-Aall |
| Delete a virtual drive hosting the operating system | MegaCLI -CfgLdDel -LX|-L0,2,5...|-LALL [-Force] -aN|-a0,1,2|-aALL |
| Delete a CacheCade virtual drive | MegaCLI -CfgCacheCadeDel -LX|-L0,2,5...|-LALL -aN|-a0,1,2|-Aall |
| Show, delete, and import the foreign configuration commands | MegaCli –CfgForeign –Scan | {-Preview | –Dsply| -Import | -Clear[FID]} -aN|-a0,1,2|-aALL" |
| Patrol Read Commands | |
| Show the patrol read status and patrol read parameters, if any in progress | MegaCli -AdpPR -info -aN|-a0,1,2|-aALL |
| Set the patrol read options on a single adapter, multiple adapters, or all adapters (x = single controller) | MegaCli -AdpPR –Dsbl|EnblAuto|EnblMan|Start|Stop| Info|Suspend|Resume|Stop| SSDPatrolReadEnbl | SSDPatrolReadDsbl |{SetDelay Val}|{-SetStartTime yyyymmdd hh}|{maxConcurrentPD Val} -aN|-a0,1,2|-aALL |
| Disable patrol read | MegaCli -AdpPR -Dsbl -aN|-a0,1,2|-aALL |
| Enable automatic patrol read. | MegaCli -AdpPR -EnblAuto -aN|-a0,1,2|-aALL |
| Enable manual patrol read. | MegaCli -AdpPR -EnblMan -aN|-a0,1,2|-aALL |
| Start patrol read. | MegaCli -AdpPR -Start -aN|-a0,1,2|-aALL |
| Suspend a running patrol read | MegaCli -AdpPR -Suspend -aN|-a0,1,2|-aALL |
| Resume a suspended patrol read | MegaCli -AdpPR -Resume -aN|-a0,1,2|-aALL |
| Stop a running patrol read | MegaCli -AdpPR -Stop -aN|-a0,1,2|-aALL |
| Include SSD drives in patrol read | MegaCli -AdpPR -SSDPatrolReadEnbl -aN|-a0,1,2|-aALL |
| Exclude SSD drives in patrol read | MegaCli -AdpPR -SSDPatrolReadDsbl -aN|-a0,1,2|-aALL |
| Delay a patrol read | MegaCli -AdpPR -SetDelay Val -aN|-a0,1,2|-aALL |
| Schedule a patrol read | MegaCli -AdpPR -SetStartTime yyyymmdd hh -aN|-a0,1,2|-aALL |
| Set the value for maximum concurrent physical drives for the patrol read | MegaCli -AdpPR -maxConcurrentPD Val -aN|-a0,1,2|-aALL |
| Consistency Check Commands | |
| Schedule a consistency check | MegaCLI -AdpCcSched -Dsbl|-Info| {-ModeConc | -ModeSeq [-ExcludeLD -LN|-L0,1,2] [-SetStartTime yyyymmdd hh ] [-SetDelay val ] } -aN|-a0,1,2|-aALL |
| Show consistency check status and consistency parameters, in progress, if any | MegaCLI -AdpCcSched -Info |
| OPROM BIOS Commands | |
| Schedule a consistency check | MegaCli -AdpBIOS -Dsply -aN|-a0,1,2|-aALL |
| Show consistency check status and consistency parameters, if any in progress | MegaCli -AdpBootDrive {-Set {-Lx|-physdrv[E0:S0]}} -aN|-a0,1,2|-aALL |
| Sets the BIOS properties for the controller | MegaCli -AdpBIOS -Enbl | -Dsbl | -Dsply | SOE | BE EnblAutoSelectBootLd | DsblAutoSelectBootLd -aN|-a0,1,2|-aALL |
| Battery (BBU) Commands | |
| Show battery-related information | MegaCli -AdpBbuCmd -aN|-a0,1,2|-aALL |
| Show the battery learn properties | MegaCli -AdpBbuCmd -GetBbuProperties -aN|-a0,1,2|-aALL |
| Show the battery information, firmware status, and the gas gauge status | MegaCli -AdpBbuCmd -GetBbuStatus -aN|-a0,1,2|-aALL |
| Show battery capacity information | MegaCli -AdpBbuCmd -GetBbuCapacityInfo -aN|-a0,1,2|-aALL |
| Show battery design information | MegaCli -AdpBbuCmd -GetBbuDesignInfo -aN|-a0,1,2|-aALL |
| Set battery properties | MegaCli -AdpBbuCmd -SetBbuProperties -f <fileName> -aN|-a0,1,2|-aALL |
| Start battery learn cycle | MegaCli -AdpBbuCmd -BbuLearn -aN|-a0,1,2|-aALL |
| Set the battery to low power storage mode | MegaCli -AdpBbuCmd -BbuMfgSleep -aN|-a0,1,2|-aALL |
| Seal the gas gauge EEPROM write access | MegaCli -AdpBbuCmd -BbuMfgSeal -aN|-a0,1,2|-aALL |
| Security Commands | |
| Set the key ID for the controller | MegaCli -CreateSecurityKey -SecurityKey sssssssssss | [-Passphrase sssssssssss] | [-KeyID kkkkkkkkkkk] -aN |
| Change the security key for the controller | MegaCli -ChangeSecurityKey -OldSecurityKey sssssssssss | -SecurityKey sssssssssss| [-Passphrase sssssssssss] | [-KeyID kkkkkkkkkkk] -aN |
| Delete the security key | MegaCLI -DestroySecurityKey | [-Force] -aN |
| Set the security key for the controller | MegaCli -SetKeyID -KeyID kkkkkkkkkkk -aN |
| Virtual Drive Commands | |
| Show the virtual drive information | MegaCli –LDInfo –Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL |
| Set virtual drive properties | MegaCli –LDSetProp WT|WB|NORA|RA|ADRA|-Cached|Direct| CachedBadBBU|NoCachedBadBBU| -RW|RO|Blocked |{-Name nameString} | -EnDskCache|DisDskCache –Lx| -L0,1,2|-Lall -aN|-a0,1,2|-aALL |
| Set power-saving (dimmer switch) properties | MegaCli -LDSetPowerPolicy -Default| -Automatic| -None| -Maximum| -MaximumWithoutCaching -Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL |
| Show virtual drive expansion information | MegaCli -getLdExpansionInfo -Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL |
| Expand the virtual drive within the existing array; also use if you replace the drives with larger drives, beyond the size of the existing array | MegaCli -LdExpansion -pN -dontExpandArray -Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL |
| Secure the virtual drive | MegaCLI –LDMakeSecure -Lx|-L0,1,2,...|-Lall –An |
| Show specific properties of virtual drives | MegaCli –LDGetProp -Cache|-Access|-Name|-DskCache -Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL |
| Start virtual drive initialization | MegaCli –LDInit –Start [Fast|Full] -Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL |
| Stop a running virtual drive initialization. | MegaCli –LDInit -Abort -Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL |
| Show the initialization progress | MegaCli –LDInit –ShowProg -Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL |
| Start a consistency check on an uninitialized virtual drive | MegaCli –LDCC –Start –Lx|-L0,1,2|-Lall -aN|-a0,1,2|-aALL |
| Start, stop, suspend, resume, and show the progress of a consistency check operation | MegaCli -LDCC -Start|-Abort|-Suspend|-Resume|-ShowProg| -ProgDsply -Lx|-L0,1,2|-LALL -aN|-a0,1,2|-aALL |
| Enable/disable automatic background initialization. Show, stop, pause, resume, and show the progress of the background initialization | MegaCLI -LDBI -Enbl|-Dsbl| -getSetting|-Abort|-Suspend|-Resume|-ShowProg|-ProgDsply -Lx|-L0,1,2|-LALL -aN|-a0,1,2|-Aall |
| Start and show progress for a migrate operation | MegaCli –LDRecon {–Start –Rx [Add|Rmv PhysDrv[E0:S0,E1:S1,...] ] } | –ShowProg|-ProgDsply –Lx –aN |
| Delete preserved cache | MegaCLI -DiscardPreservedCache -Lx|-L0,1,2|-Lall -force -aN|-a0,1,2|-aALL |
| Assign the CacheCade virtual drive | MegaCLI -Cachecade -assign|-remove -Lx|-L0,1,2|-LALL -aN|-a0,1,2|-aALL |
| Physical Drive Commands | |
| Show drive information | MegaCli -pdInfo -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL |
| Start, stop, suspend, or resume an ongoing rebuild operation. | MegaCLI PDRbld -Start|-Stop|-Suspend|-Resume| -ShowProg|-ProgDsply -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL |
| Start, stop, pause, resume, or show the progress of a copyback operation |
MegaCLI PDCpyBk -Start|-Stop |-Suspend|-Resume| -ShowProg|-ProgDsply -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL |
| Mark a drive as missing | MegaCli -PdMarkMissing -physdrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL |
| Show missing drive information | MegaCli -PdGetMissing -aN|-a0,1,2|-aALL |
| Replace the configured drive that is identified as missing, and then start an automatic rebuild | MegaCli -PdReplaceMissing -physdrv[E0:S0] -arrayA, -rowB -aN |
| Set the drive state to online | MegaCli –PDOnline -PhysDrv[E0:S0,E1:S1....] -aN|-a0,1,2 |
| Set the drive state to offline | MegaCli –PDOffline -PhysDrv[E0:S0,E1:S1....] -aN|-a0,1,2|-aALL |
| Set the drive state to JBOD | MegaCli –PDMakeGood -PhysDrv[E0:S0,E1:S1....] -aN|-a0,1,2|-aALL |
| Add and delete hotspare drives | MegaCli –PDHSP {–Set [{-Dedicated -ArrayN |-Array0,1...}] [-EnclAffinity] [-nonRevertible] } |-Rmv -PhysDrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL |
| Start, stop, pause, resume or show the progress of an initialization process | MegaCli –PDClear -Start |-Stop|-ShowProg |-ProgDsply - PhysDrv[E0:S0,E1:S1....] -aN|-a0,1,2|-aALL |
| Start a drive locate and activate (blink) the drive’s LED or stop a drive locate (LED blinking) and deactivate the drive’s LED | MegaCli –PDLocate {[-start] |-stop} -physdrv[E0:S0,E1:S1,...] -aN|-a0,1,2|-aALL |
| Spin down an unconfigured drive and prepare it for removal or spin up spun-down drive and mark the drive state as unconfigured good | MegaCli -PDPrpRmv [-Undo] -PhysDrv[E0:S0,E1:S1....] -aN|-a0,1,2|-aALL |
| Show physical drive information of all connected drives | MegaCli –PDList -aN|-a0,1..|-aAll |
| Flash the physical drive firmware | MegaCLI PdFwDownload[offline] [ForceActivate] {[-SataBridge] -PhysDrv[0:1]}| {-EncdevId[devId1]} -f <filename> -aN|-a0,1,2|-Aall |
| Erase the drive's security configuration and securely erase data on a drive | MegaCli -PDInstantSecureErase -PhysDrv[E0:S0,E1:S1,...] | [-Force] -aN|-a0,1,2|-aALL |
| Show the security key for secured physical drives | MegaCli -GetKeyID [-PhysDrv[E0:S0]] -aN |
| Start, stop, and show the progress of a secure erase operation | MegaCli -SecureErase Start[ Simple| [Normal [ |ErasePattern ErasePatternA|ErasePattern ErasePatternA ErasePattern ErasePatternB]]|[Thorough [ |ErasePattern ErasePatternA|ErasePattern ErasePatternA ErasePattern ErasePatternB]]] | Stop| ShowProg| ProgDsply [-PhysDrv [E0:S0,E1:S1,...] | -Lx|-L0,1,2|-LALL] -aN|-a0,1,2|-aALL |
| Enable/disable the direct physical drive mapping mode. Show the current state of the direct physical drive mapping. | MegaCLI DirectPdMapping -Enbl|-Dsbl|-Dsply -aN|-a0,1,2|-Aall |
| Enclosure Commands | |
| Show enclosure information | MegaCli –EncInfo -aN|-a0,1,2|-aALL |
| Show enclosure status | MegaCli –EncStatus -aN|-a0,1,2|-aALL |
| PHY Commands | |
| Show PHY information | MegaCli –PHYInfo -phyM -aN|-a0,1,2|-aALL |
| Set PHY link speed | MegaCLI PhySetLinkSpeed -phyM -speed -aN|-a0,1,2|-aALL |
| Show the PHY error counters. | Megacli PhyErrorCounters -An |
| Alarm Commands | |
| Show alarm properties | MegaCli -AdpGetProp AlarmDsply -aN|-a0,1,2|-aALL |
| Set alarm properties | MegaCli -AdpSetProp AlarmEnbl|AlarmDsbl|AlarmSilence -aN|-a0,1,2|-aALL |
| Event Log Properties Commands | |
| Show event logs. | MegaCli -AdpEventLog -GetEventLogInfo -aN|-a0,1,2|-aALL |
| Show the specified type of event logs. | MegaCli -AdpEventLog -GetEvents {-info -warning -critical -fatal} {-f <fileName>} -aN|-a0,1,2|-aALL |
| Show the specified event logs | MegaCli -AdpEventLog -GetSinceShutdown {-info -warning -critical -fatal} {-f <fileName>} -aN|-a0,1,2|-aALL |
| Delete the event logs. | MegaCli -AdpEventLog -Clear -aN|-a0,1,2|-aALL |
| Premium Feature Key Commands | |
| Show the Safe ID of the controller | MegaCli -ELF -GetSafeId -a0 |
| Show the Advanced Software Options that are enabled on thecontroller, including the ones in trial mode. | MegaCli -ELF –ControllerFeatures -a0 |
| Apply the Activation Key in preview mode. | MegaCli -ELF -Applykey key –val -preview -a0 |
| Apply the Activation Key | MegaCli -ELF -Applykey key –val -a0 |
| Deactivate the trial key | MegaCli -ELF –DeactivateTrialKey -a0 |
| Show the re-host information and, if re-hosting is necessary, show the controller and key vault serial numbers. | MegaCli -ELF -ReHostInfo -a0 |
| Indicate to the controller that the re-host is complete | MegaCli -ELF -ReHostComplete -a0 |
Subscribe to:
Posts (Atom)