GUI’s are generally cool, but when you need to get many of the same/similar tasks done, you can’t beat the speed and ease of using scripts and CLI based tools.
I recently had a situation with a EMC VNX2 array where someone (or something) had caused all the LUNs in a RAID Group to become FastCACHE enabled. All 32 of them. Disabling this for one LUN is simple with Unisphere, but 32 would bore me to tears and take far too much effort.
The easy way to do this was to use Powershell and a string array to loop the disable process through Naviseccli.
To work out the affected RAID Group LUNs just use the getrg command with the –lunlist option. For me, this was RAID group 10 so the command was;
1 |
Naviseccli –h arrayspa getrg 10 –lunlist |
So the LUNs I’m working with are 50 through 81.
To check/verify the getlun command can be used with the –fastcache option. Singularly;
1 |
Naviseccli –h arrayspa getlun ID –fastcache |
But let’s do it in ‘bulk’. I’m also adding the LUN ID as this is not included in the output.(saved and executed as fastchk.ps1)
1 2 3 |
$lunlist = @(50..81) ForEach ($lunid in $lunlist) { write-host LUN_id= $lunid ; naviseccli -h arrayspa getlun $lunid -fastcache } |
Details; The first variable $lunlist stores the range of LUNs to be processed in an array we use in a standard ForEach loop to step each LUN through a naviseccli getlun operation.
The write-host preceding the naviseccli command simply inserts the currently processing LUN id as this is not returned from the direct execution.
Result, in progress. As you can see Fast Cache is in an Enabled state.
To disable this for the same list of LUNs, we’ll use the chglun command with -fastcache 0 (use with -fastcache 1 to re-enable); and insert a ‘Completed’ after each LUN is processed. This again uses the same array/looping process as earlier. (saved and executed as fastchg.ps1)
1 2 3 |
$lunlist = @(50..81) ForEach ($lunid in $lunlist) { write-host Processing LUN_id= $lunid ; naviseccli -h mdcvnx-spa chglun -l $lunid -fastcache 0 ;write-host ..Completed } |
Results in progress, and completed;
To change a LUN singularly, you would use the chglun command like this
1 |
Naviseccli –h arrayspa chglun –l ID –fastcache 0 |
Verify by reusing the getlun command, as previous; Or of course check through Unisphere;
Hope this is useful 🙂
I found your blog website on google and verify a few of your early posts. Continue to keep up the very good operate. I just further up your RSS feed to my MSN Information Reader. Looking for ahead to reading extra from you in a while!…
Every time I read “LUN’s” I cringe. It made for a struggle.
I’m so sorry you had to cringe through 4 instances of a typo. Rest assured I have corrected them now.
I hope you find the courage to press on through these dire struggles.
Every time I read “LUN’s” I cringe. It made for a struggle.
I’m so sorry you had to cringe through 4 instances of a typo. Rest assured I have corrected them now.
I hope you find the courage to press on through these dire struggles.