Skip to main content

CLI madness Part II Useful storage esxcli com mands

CLI madness Part II Useful storage esxcli commands


EUI identifier association with datastore name
A good number of folks have been asking about the cryptic device names appearing in VI Client, connected to vCenter Server.  For example,

How in the world do I know which datastore does that correspond to?  The eui identifier is a mile long!  If you do have a need to correspond the device and the datastore as you see in vSphere, easiest way is to right click on the given LUN, then select “Manage Paths”.  In this view, the volume/datastore name is available in multiple places, but somewhat hidden:

If you really don’t want to look at the hideous eui identifier for your datastores, you could easily rename each after discovering the datastore name:

The cool thing about renaming the display name is that it makes lives easier for CLI results as well.  For example, if you want to find out quickly in the CLI what a given datastore’s working path(canonical name) and SATP/PSP plugins, the following command would do:

# esxcli storage nmp device list | grep -A 7 view5
Device Display Name: view5 (this is what we entered as the new label)
Storage Array Type: VMW_SATP_ALUA
Storage Array Type Device Config: {implicit_support=on;explicit_support=off; explicit_allow=on;alua_followover=on;{TPG_id=0,TPG_state=AO}}
Path Selection Policy: NIMBLE_PSP_DIRECTED
Path Selection Policy Device Config: {policy=rr iops=0 bytes=0 useANO=0 BIN_MAP_CHANGED=0 NUM_OF_MEM_ARRAY=1 lastPathIndex=0 NumIOsPending=0 numBytesPending=0 path[0]=vmhba37:C0:T2:L0;maGid=1 path[1]=vmhba37:C1:T2:L0;maGid=2 }
Path Selection Policy Device Custom Config:
Working Paths: vmhba37:C0:T2:L0, vmhba37:C1:T2:L0
Otherwise, you’d have to run the #esxcli storage nmp device list, and sort through the output!  Another use case is with esxtop.  Remember the useful toggle key of ‘u’ to display the stats on a per LUN basis?

Let’s say one of the datastores is exhibiting interesting stats, and you want to drill down on which volume that is, it could be a bit of a challenge if you don’t label the device name in vCenter.  However, if you labelled it like I did above, then it is a simple highlight of the device eui identifier, and execution of the following command to find the corresponding datastore name:
# esxcli storage nmp device list | grep -A 7 eui.a35390c4baa8698f6c9ce900179b8b4c
How to find SCSI reservation conflict stats
If you have a large environment with good number of ESX hosts (say 5+) sharing access to VMFS volumes, and the storage array is not running a version of microcode or OS that supports VAAI ATS (hardware assisted offload), then it’d be a good idea to check whether SCSI-2 reservation conflict is impacting your vSphere environment (note: Nimble OS 1.4 has full support for VAAI ATS).  Below is a quick command to check whether your ESX hosts are experiencing LUN locking conflicts (as result of operations such as vMotion of VM, VM power on, taking vmware snapshot, extending VMDK disk for a given VM, etc.)
Easiest thing to do is the find the datastore of interest (now that you have labeled the device name with datastore name in vCenter), right click on the device corresponding to the datastore, select “Copy Identifier to Clipboard), then execute the following command in the ESX server(s):
#esxcli storage core device stats get | grep –A 14 eui.a35390c4baa8698f6c9ce900179b8b4c
The output will look something like this:

Or if you want to just get the reservation conflicts across the board, run this simple command instead (quick spot check to see if there’s any)








How to find paths stats
Ever wonder how many commands/blocks were read/written for a given path?  Here’s a quick command to find out:
#esxcli storage core path stats get | grep –A 10 view5 (view5 is the datastore name of interest – this command can be run with/without device name labeling)
Sample output is below with lots of great stats:


Comments

Popular posts from this blog

  Issue with Aria Automation Custom form Multi Value Picker and Data Grid https://knowledge.broadcom.com/external/article?articleNumber=345960 Products VMware Aria Suite Issue/Introduction Symptoms: Getting  error " Expected Type String but was Object ", w hen trying to use Complex Types in MultiValue Picker on the Aria for Automation Custom Form. Environment VMware vRealize Automation 8.x Cause This issue has been identified where the problem appears when a single column Multi Value Picker or Data Grid is used. Resolution This is a known issue. There is a workaround.  Workaround: As a workaround, try adding one empty column in the Multivalue picker without filling the options. So we can add one more column without filling the value which will be hidden(there is a button in the designer page that will hide the column). This way the end user will receive the same view.  

57 Tips Every Admin Should Know

Active Directory 1. To quickly list all the groups in your domain, with members, run this command: dsquery group -limit 0 | dsget group -members –expand 2. To find all users whose accounts are set to have a non-expiring password, run this command: dsquery * domainroot -filter “(&(objectcategory=person)(objectclass=user)(lockoutTime=*))” -limit 0 3. To list all the FSMO role holders in your forest, run this command: netdom query fsmo 4. To refresh group policy settings, run this command: gpupdate 5. To check Active Directory replication on a domain controller, run this command: repadmin /replsummary 6. To force replication from a domain controller without having to go through to Active Directory Sites and Services, run this command: repadmin /syncall 7. To see what server authenticated you (or if you logged on with cached credentials) you can run either of these commands: set l echo %logonserver% 8. To see what account you are logged on as, run this command: ...
  The Guardrails of Automation VMware Cloud Foundation (VCF) 9.0 has redefined private cloud automation. With full-stack automation powered by Ansible and orchestrated through vRealize Orchestrator (vRO), and version-controlled deployments driven by GitOps and CI/CD pipelines, teams can build infrastructure faster than ever. But automation without guardrails is a recipe for risk Enter RBAC and policy enforcement. This third and final installment in our automation series focuses on how to secure and govern multi-tenant environments in VCF 9.0 with role-based access control (RBAC) and layered identity management. VCF’s IAM Foundation VCF 9.x integrates tightly with enterprise identity providers, enabling organizations to define and assign roles using existing Active Directory (AD) groups. With its persona-based access model, administrators can enforce strict boundaries across compute, storage, and networking resources: Personas : Global Admin, Tenant Admin, Contributor, Viewer Projec...