VMware ESXi MegaCLI StorCLI Enable Cache Write Back

You have two options for managing the LSI Logic, Dell PERC, etc. from the ESXi CLI: StorCLI or MegaCLI.

You can download MegaCLI for VMware here: 8.04.07_MegaCLI

You can download StorCLI from the LSI website and here: CLI_VMWare_MN_8.04.07

MegaCLI:

esxi1# ./MegaCli -LDSetProp -Cached -LAll -aAll

Set Cache Policy to Cached on Adapter 0, VD 0 (target id: 0) success
Set Cache Policy to Cached on Adapter 1, VD 0 (target id: 0) success

esxi1# ./MegaCli -LDSetProp EnDskCache -LAll -aAll

Set Disk Cache Policy to Enabled on Adapter 0, VD 0 (target id: 0) success
Set Disk Cache Policy to Enabled on Adapter 1, VD 0 (target id: 0) success

esxi1# ./MegaCli -LDSetProp RA -LALL -aALL

Set Read Policy to ReadAhead on Adapter 0, VD 0 (target id: 0) success

For those who have good power:

esxi1# ./MegaCli -LDSetProp WB -LALL -aALL

Set Write Policy to WriteBack on Adapter 0, VD 0 (target id: 0) success
Set Write Policy to WriteBack on Adapter 1, VD 0 (target id: 0) success

For those that live in fear, run the above command and also:

esxi1# ./MegaCli -LDSetProp NoCachedBadBBU -LALL -aALL

Set No Write Cache if bad BBU on Adapter 0, VD 0 (target id: 0) success
Set No Write Cache if bad BBU on Adapter 1, VD 0 (target id: 0) success

StorCLI:

Show all:

./storcli /c0 show all

Enable WriteBack Cache:
./storcli /c0/v0 set wrcache=AWB

Enable IOCache:
./storcli /c0/v0 set iopolicy=cached

Not recommended see:

Enable Physical Disk Drive Cache:

./storcli /c0/v0 set pdcache=On

Read Ahead

./storcli /c0/v0 set rdcache=RA  or  NoRA

VMware PowerCLI – How do I add functions?

When first using VMware PowerCLI, you will need to add functions that are associated with your profile.

Create a new profile:

PowerCLI> New-item –type file –force $profile

Once your profile has been created, you can now add functions by typing:

PowerCLI> notepad $profile

The above command simply opens notepad and allows you to edit your profile directly.

Once you have added functions, you will need to reload your profile (or restart PowerCLI):

PowerCLI> .$profile

Change ILO IP address via CLI on HP C7000 Blade Chassis

You need to change the ILO IP on an HP blade. You don’t have access to blade except via SSH to the HP C7000 Chassis.

Here is how:

1. Connect to the C7000 chassis:

HP BladeSystem Onboard Administrator
(C) Copyright 2006-2012 Hewlett-Packard Development Company, L.P.

Type ‘HELP’ to display a list of valid commands.
Type ‘HELP ‘ to display detailed information about a specific command.
Type ‘HELP HELP’ to display more detailed information about the help system.

2. Connect to the blade via the C7000 chassis CLI:
c7000-1> connect server 8

Connecting to bay 8 …
User:OAtmp-administrator logged-in to c7000-1(10.10.10.101)
iLO 2 Standard Blade Edition 1.80 at 10:12:14 Oct 30 2009
Server Name: host is unamed
Server Power: On

hpiLO->

3. Show the existing IP and Gateway:

hpiLO-> show /map1/enetport1/lanendpt1/ipendpt1
status=0
status_tag=COMMAND COMPLETED

/map1/enetport1/lanendpt1/ipendpt1
Targets
Properties
IPv4Address=10.81.0.160
SubnetMask=255.255.255.0
AddressOrigin=Static
Verbs
cd version exit show set

hpiLO->show gateway1
status=0
status_tag=COMMAND COMPLETED

/map1/gateway1
Targets
Properties
AccessInfo=10.150.240.1
AccessContext=Default Gateway
Verbs
cd version exit show set

4. Change the IP (requires reboot):
hpiLO->set /map1/enetport1/lanendpt1/ipendpt1 IPv4Address=10.13.247.222 SubnetMask=255.255.240.0
status=0
status_tag=COMMAND COMPLETED
Network settings change applied, iLO needs to be reset.

CLI session stopped

Connection terminated by server.

5. After the reboot, follow steps 1-3, and now change the Gateway (requires reboot):
hpiLO->set /map1/gateway1 AccessInfo=10.13.240.1
status=0
status_tag=COMMAND COMPLETED
Network settings change applied, iLO needs to be reset.

CLI session stopped

ESXi identify boot LUN + boot LUN claim rules

Identify bootlun:

# ls -l /
lrwxrwxrwx 1 root root 49 Oct 27 17:55 bootbank -> /vmfs/volumes/94671c74-55d3efd8-6f90-332c181fc3cf

Obtain the disk ID:

# vmkfstools -P path

For example:

# vmkfstools -P /vmfs/volumes/bebbef72-6cbc41fa-b169-68d3824c6d51

vfat-0.04 file system spanning 1 partitions.
File system label (if any):
Mode: private
Capacity 261853184 (63929 file blocks * 4096), 114647040 (27990 blocks) avail
UUID: bebbef72-6cbc41fa-b169-68d3824c6d51
Partitions spanned (on “disks”):
naa.600601604550250018ea2d38073cdf11

Get the paths:
esxcfg-mpath -b -d naa.600601604550250018ea2d38073cdf11
vmhba33:C0:T3:L0 state:active Local HBA vmhba33 channel 0 target 3
vmhba33:C0:T2:L0 state:standby Local HBA vmhba33 channel 0 target 2
vmhba33:C0:T1:L0 state:active Local HBA vmhba33 channel 0 target 1
vmhba33:C0:T0:L0 state:standby Local HBA vmhba33 channel 0 target 0

Create claim rules:

esxcli storage core claimrule add –type=”location” –rule=202 –plugin=”NMP” –adapter=vmhba0 –channel=0 –target=2 –lun=0
esxcli storage core claimrule add –type=”location” –rule=203 –plugin=”NMP” –adapter=vmhba1 –channel=0 –target=2 –lun=0
esxcli storage core claimrule add –type=”location” –rule=204 –plugin=”NMP” –adapter=vmhba2 –channel=0 –target=2 –lun=0
esxcli storage core claimrule add –type=”location” –rule=205 –plugin=”NMP” –adapter=vmhba3 –channel=0 –target=2 –lun=0

Check claim rules:
~ # esxcfg-mpath -b -d naa.6006016005b02c0025489b6399b1e211
naa.6006016005b02c0025489b6399b1e211 : DGC Fibre Channel Disk (naa.6006016005b02c0025489b6399b1e211)
vmhba3:C0:T2:L0 LUN:0 state:active fc Adapter: WWNN: 50:06:0b:00:00:c2:6e:17 WWPN: 50:06:0b:00:00:c2:6e:16 Target: WWNN: 50:06:01:60:c7:20:23:b5 WWPN: 50:06:01:69:47:20:23:b5
vmhba0:C0:T2:L0 LUN:0 state:active fc Adapter: WWNN: 50:06:0b:00:00:c2:6e:11 WWPN: 50:06:0b:00:00:c2:6e:10 Target: WWNN: 50:06:01:60:c7:20:23:b5 WWPN: 50:06:01:61:47:20:23:b5
vmhba1:C0:T2:L0 LUN:0 state:active fc Adapter: WWNN: 50:06:0b:00:00:c2:6e:13 WWPN: 50:06:0b:00:00:c2:6e:12 Target: WWNN: 50:06:01:60:c7:20:23:b5 WWPN: 50:06:01:68:47:20:23:b5
vmhba2:C0:T2:L0 LUN:0 state:active fc Adapter: WWNN: 50:06:0b:00:00:c2:6e:15 WWPN: 50:06:0b:00:00:c2:6e:14 Target: WWNN: 50:06:01:60:c7:20:23:b5 WWPN: 50:06:01:60:47:20:23:b5