In the course of studying for the VCAP5-DCA, I’ve been using ESXCLI a lot. The namespace I’ve spent the most time with is, unsurprisingly, storage. There are a lot of storage related objectives on the VCAP5-DCA blueprint, and, for me, the related ESXCLI commands were the hardest to get to grips with in terms of being able to use them quickly and efficiently to perform storage related tasks. With that in mind, I thought a post to summarise a lot of the ESXCLI storage namespace commands would be useful.
These aren’t in any particular order, and are mostly taken from examples I’ve used in other articles. You can find links to those here.
Tagging a Device as SSD
esxcli storage nmp satp rule add -s VMW_SATP_DEFAULT_AA -d t10.F405E46494C4540013C625565687D2A6A75633D293877753 -o enable_ssd esxcli storage core claiming unclaim -t device -d t10.F405E46494C4540013C625565687D2A6A75633D293877753 esxcli storage core claimrule load esxcli storage core claimrule run
To untag the device:
esxcli storage nmp satp rule remove -s VMW_SATP_DEFAULT_AA -d t10.F405E46494C4540013C625565687D2A6A75633D293877753
Rescan All Storage Adapters
esxcli storage core adapter rescan --all
Display VAAI Plugins and Filters
esxcli storage core plugin list
Displaying VAAI Support and Attached Filters for a Device
~ # esxcli storage core device list -d t10.F405E46494C454000714543337B6D29543B603D2A6652613 t10.F405E46494C454000714543337B6D29543B603D2A6652613 Display Name: OPNFILER iSCSI Disk (t10.F405E46494C454000714543337B6D29543B603D2A6652613) Has Settable Display Name: true Size: 5088 Device Type: Direct-Access Multipath Plugin: NMP Attached Filters: VAAI Status: unknown Other UIDs: vml.010001000070414533736b2d59346b302d6a566231564952545541 Is Local SAS Device: false Is Boot USB Device: false No of outstanding IOs with competing worlds: 32
Listing VAAI Status for a Device
~ # esxcli storage core device vaai status get -d t10.F405E46494C4540013C625565687D2A6A75633D293877753 t10.F405E46494C4540013C625565687D2A6A75633D293877753 VAAI Plugin Name: ATS Status: unsupported Clone Status: unsupported Zero Status: supported Delete Status: unsupported
Mount and Unmount Datastores
esxcli storage filesystem mount -l datastore1
esxcli storage filesystem unmount -l datastore1
Upgrading Datastores to VMFS 5
esxcli storage vmfs upgrade -l datastore1
Changing the PSP for a Device
esxcli storage nmp device list -d t10.F405E46494C4540013C625565687D2A6A75633D293877753 esxcli storage nmp device set -d t10.F405E46494C4540013C625565687D2A6A75633D293877753 -P VMW_PSP_FIXED
Setting a Preferred Path for a Device using Fixed PSP
~ # esxcli storage nmp psp fixed deviceconfig get -d naa.6006048cccd89513e04a7c70864d6b55 Configured Preferred Path: iqn.1998-01.com.vmware:localhost-7e961ff7-00023d000001,iqn.1992-05.com.emc:bb000c2965b5ae0000-1,t,1-naa.6006048cccd89513e04a7c70864d6 Device: naa.6006048cccd89513e04a7c70864d6b55 Preferred Path: vmhba33:C0:T0:L1
~ # esxcli storage nmp psp fixed deviceconfig set -d naa.6006048cccd89513e04a7c70864d6b55 -p vmhba33:C1:T0:L1
Customise Round-Robin Parameters
~ # esxcli storage nmp psp roundrobin deviceconfig set -d naa.6006048cccd89513e04a7c70864d6b55 -t bytes -B 1000000
~ # esxcli storage nmp psp roundrobin deviceconfig get -d naa.6006048cccd89513e04a7c70864d6b55 Byte Limit: 1000000 Device: naa.6006048cccd89513e04a7c70864d6b55 IOOperation Limit: 1000 Limit Type: Bytes Use Active Unoptimized Paths: false
To reset it to default settings:
~ # esxcli storage nmp psp roundrobin deviceconfig set -d naa.6006048cccd89513e04a7c70864d6b55 -t default
Listing Snapshot Datastores and Resignaturing
esxcli storage vmfs snapshot list
esxcli storage vmfs snapshot resignature -l datastore1
Masking and Unmasking LUNs
To mask:
esxcli storage core claimrule add -r 103 -t location -A vmhba33 -C 0 -T 1 -L 0 -P MASK_PATH esxcli storage core claimrule load esxcli storage core claimrule reclaim -d naa.98437598437543987598437
To unmask a previously masked LUN:
esxcli storage core claimrule remove -r 103 esxcli storage core claimrule load esxcli core storage claiming unclaim –d naa.98437598437543987598437 -t location -A vmhba33 -C 0 -T 1 -L 0 esxcli storage core claimrule run