vsphere esxi vcenter server 50 command line interface solutions and examples guide
DESCRIPTION
For the Vmware ESXi CommandsTRANSCRIPT
-
vSphere Command-Line InterfaceConcepts and Examples
ESXi 5.0
vCenter Server 5.0
This document supports the version of each product listed andsupports all subsequent versions until the document is replacedby a new edition. To check for more recent editions of thisdocument, see http://www.vmware.com/support/pubs.
EN-000489-00
-
VMware, Inc.3401 Hillview Ave.Palo Alto, CA 94304www.vmware.com
2 VMware, Inc.
vSphere Command-Line Interface Concepts and Examples
You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
Copyright 20082011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents.
VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective companies.
-
VMware, Inc. 3
Contents
AboutThisBook 9
1 vSphereCLICommandOverviews 11Introduction 11
Documentation 12CommandLineHelp 12
ListofAvailableCommands 12SupportedPlatformsforCommands 14RunningESXCLICommandsAgainstESXi4.xHosts 16CommandswithanesxcfgPrefix 16UsingESXCLIOutput 17ConnectionOptions 17vCLIandLockdownMode 18
2 ManagingHosts 21Stopping,Rebooting,andExaminingHostswithvicfghostops 21EnteringandExitingMaintenanceModewithvicfghostops 22BackingUpConfigurationInformationwithvicfgcfgbackup 22
BackupTasks 23BackingUpConfigurationData 23RestoringConfigurationData 23
UsingvicfgcfgbackupfromvMA 23ManagingVMkernelModules 24
ManagingModuleswithesxclisystemmodule 24ManagingModuleswithvicfgmodule 24
UsingvicfgauthconfigforActiveDirectoryConfiguration 25UpdatingHosts 26
3 ManagingFiles 27IntroductiontoVirtualMachineFileManagement 27ManagingtheVirtualMachineFileSystemwithvmkfstools 28UpgradingVMFS3VolumestoVMFS5 29ManagingVMFSVolumes 29
ManagingDuplicateVMFSDatastores 29MountingDatastoreswithExistingSignatures 29
MountingandUnmountingwithESXCLI 29MountingandUnmountingwithvicfgvolume 30
ResignaturingVMFSCopies 30ResignaturingaVMFSCopywithESXCLI 31ResignaturingaVMFSCopywithvicfgvolume 31
DetachingDevicesandRemovingaLUN 32WorkingwithPermanentDeviceLoss 32UsingvifstoManipulateFilesonRemoteESXiHosts 33
-
vSphere Command-Line Interface Concepts and Examples
4 VMware, Inc.
4 ManagingStorage 37IntroductiontoStorage 37
HowVirtualMachinesAccessStorage 38Datastores 39StorageDeviceNaming 39
ExaminingLUNs 40TargetandDeviceRepresentation 40ExaminingLUNswithesxclistoragecore 40ExaminingLUNswithvicfgscsidevs 41
ManagingPaths 42MultipathingwithLocalStorageandFCSANs 42ListingPathInformation 43
ListingPathInformationwithESXCLI 43ListingPathInformationwithvicfgmpath 44
ChangingtheStateofaPath 44ChangingPathStatewithESXCLI 45ChangingPathStatewithvicfgmpath 45
ManagingPathPolicies 45ChangingPathPolicies 46
ChangingPathPolicieswithESXCLI 46ChangingPathPolicieswithvicfgmpath 47
SettingPolicyDetailsforDevicesthatUseRoundRobin 47ManagingNFS/NASDatastores 48
CapabilitiesSupportedbyNFS/NAS 48AddingandDeletingNASFileSystems 48
ManagingNASFileSystemswithESXCLI 48ManagingNASFileSystemswithvicfgnas 49
MigratingVirtualMachineswithsvmotion 49StoragevMotionUses 50StoragevMotionRequirementsandLimitations 50RunningsvmotioninInteractiveMode 50RunningsvmotioninNoninteractiveMode 51
ConfiguringFCoEAdapters 51ScanningStorageAdapters 52
5 ManagingiSCSIStorage 53iSCSIStorageOverview 53
DiscoverySessions 54DiscoveryTargetNames 55
ProtectinganiSCSISAN 55ProtectingTransmittedData 55SecuringiSCSIPorts 56SettingiSCSICHAP 56
CommandSyntaxforesxcliiscsiandvicfgiscsi 57esxcliiscsiCommandSyntax 57KeytoesxcliiscsiShortOptions 58vicfgiscsiCommandSyntax 59
iSCSIStorageSetupwithESXCLI 62SettingUpSoftwareiSCSIwithESXCLI 62SettingUpDependentHardwareiSCSIwithESXCLI 64SettingUpIndependentHardwareiSCSIwithESXCLI 66
-
VMware, Inc. 5
Contents
iSCSIStorageSetupwithvicfgiscsi 67SettingUpSoftwareiSCSIwithvicfgiscsi 67SettingUpDependentHardwareiSCSIwithvicfgiscsi 69SettingUpIndependentHardwareiSCSIwithvicfgiscsi 70
ListingandSettingiSCSIOptions 71ListingiSCSIOptionswithESXCLI 71SettingMTUwithESXCLI 71ListingandSettingiSCSIOptionswithvicfgiscsi 72
ListingandSettingiSCSIParameters 72ListingandSettingiSCSIParameterswithESXCLI 72ReturningParameterstoDefaultInheritance 74ListingandSettingiSCSIParameterswithvicfgiscsi 74ReturningParameterstoDefaultInheritance 75
EnablingiSCSIAuthentication 76EnablingiSCSIAuthenticationwithESXCLI 76EnablingiSCSIAuthenticationwithvicfgiscsi 77
SettingUpPortsforiSCSIMultipathing 77ManagingiSCSISessions 78
IntroductiontoiSCSISessionManagement 78ListingiSCSISessions 79LoggingintoiSCSISessions 79RemovingiSCSISessions 79
6 ManagingThirdPartyStorageArrays 81ManagingNMPwithesxclistoragenmp 81
DeviceManagementwithesxclistoragenmpdevice 82esxclistoragenmpdevicelist 82esxclistoragenmpdeviceset 82
ListingPathswithesxclistoragenmppath 82ManagingPathSelectionPolicyPluginswithesxclistoragenmppsp 82
RetrievingPSPInformation 83SettingConfigurationParametersforThirdPartyExtensions 83
FixedPathSelectionPolicyOperations 83RetrievingthePreferredPath 83\SettingthePreferredPath 84
CustomizingRoundRobinSetup 84RetrievingPathSelectionSettings 84SpecifyingConditionsforPathChanges 85
ManagingSATPs 85RetrievingInformationAboutSATPs 85AddingSATPRules 85RemovingSATPRules 86RetrievingandSettingSATPConfigurationParameters 87
PathClaimingwithesxclistoragecoreclaiming 87UsingtheReclaimTroubleshootingCommand 88UnclaimingPathsorSetsofPaths 88
ManagingClaimRules 89AddingClaimRules 89ConvertingESX3.5LUNMaskstoClaimRuleFormat 91RemovingClaimRules 92ListingClaimRules 92LoadingClaimRules 92MovingClaimRules 92RunningPathClaimingRules 93
-
vSphere Command-Line Interface Concepts and Examples
6 VMware, Inc.
7 ManagingUsers 95UsersandGroupsinthevSphereEnvironment 95vicfguserCommandSyntax 95ManagingUserswithvicfguser 96ManagingGroupswithvicfguser 98
8 ManagingVirtualMachines 101vmwarecmdOverview 101
ConnectionOptionsforvmwarecmd 102GeneralOptionsforvmwarecmd 102FormatforSpecifyingVirtualMachines 102
ListingandRegisteringVirtualMachines 102RetrievingVirtualMachineAttributes 103ManagingVirtualMachineSnapshotswithvmwarecmd 104
TakingVirtualMachineSnapshots 104RevertingandRemovingSnapshots 105
PoweringVirtualMachinesOnandOff 105ConnectingandDisconnectingVirtualDevices 106WorkingwiththeAnswerVMAPI 107ForciblyStoppingVirtualMachineswithEXCLI 107
9 ManagingvSphereNetworking 109IntroductiontovSphereNetworking 109
NetworkingUsingvSphereStandardSwitches 110NetworkingUsingvSphereDistributedSwitches 111
RetrievingBasicNetworkingInformation 111SettingUpvSphereNetworkingwithvSphereStandardSwitches 112
SettingUpVirtualSwitchesandAssociatingaSwitchwithaNetworkInterface 112RetrievingInformationAboutVirtualSwitches 113
RetrievingInformationaboutVirtualSwitcheswithESXCLI 113RetrievingInformationaboutVirtualSwitcheswithvicfgvswitch 113
AddingandDeletingVirtualSwitches 113AddingandDeletingVirtualSwitcheswithESXCLI 113AddingandDeletingVirtualSwitcheswithvicfgvswitch 114SettingSwitchAttributeswithesxclinetworkvswitchstandard 114SettingSwitchAttributeswithvicfgvswitch 114
Checking,Adding,andRemovingPortGroups 115ManagingPortGroupswithESXCLI 115ManagingPortGroupswithvicfgvswitch 115
ManagingUplinksandPortGroups 115ConnectingandDisconnectingUplinkAdaptersandPortGroupswithESXCLI 115ConnectingandDisconnectingUplinksandPortGroupswithvicfgvswitch 116
SettingthePortGroupVLANID 116SettingthePortGroupVLANIDwithESXCLI 116SettingthePortGroupVLANIDwithvicfgvswitch 116
ManagingUplinkAdapters 117ManagingUplinkAdapterswithesxclinetworknic 117SpecifyingMultipleUplinkswithESXCLI 118ManagingUplinkAdapterswithvicfgnics 118LinkingandUnlinkingUplinkAdapterswithESXCLI 119LinkingandUnlinkingUplinkAdapterswithvicfgvswitch 119
-
VMware, Inc. 7
Contents
AddingandModifyingVMkernelNetworkInterfaces 119ManagingVMkernelNetworkInterfaceswithESXCLI 120ManagingVMkernelNetworkInterfaceswithvicfgvmknic 121
SettingUpvSphereNetworkingwithvSphereDistributedSwitch 122ManagingStandardNetworkingServicesinthevSphereEnvironment 123SettingtheDNSConfiguration 123
SettingtheDNSConfigurationwithESXCLI 123SettingtheDNSConfigurationwithvicfgdns 124
AddingandStartinganNTPServer 125ManagingtheIPGateway 126UsingvicfgipsecforSecureNetworking 126
UsingIPsecwithESXi 127ManagingSecurityAssociationswithvicfgipsec 128ManagingSecurityPolicieswithvicfgipsec 129
UsingesxclinetworkfirewallforESXiFirewallManagement 130
10 MonitoringESXiHosts 131UsingresxtopforPerformanceMonitoring 131ManagingDiagnosticPartitions 131
DiagnosticPartitionCreation 132DiagnosticPartitionManagement 132
ManagingCoreDumps 132ManagingLocalCoreDumpswithESXCLI 132ManagingCoreDumpswithESXiDumpCollector 133ManagingCoreDumpswithvicfgdumppart 133
ConfiguringESXiSyslogServices 134ManagingESXiSNMPAgentswithvicfgsnmp 135
ConfiguringSNMPCommunities 136ConfiguringtheSNMPAgenttoSendTraps 136ConfiguringtheSNMPAgentforPolling 137
ESX,ESXi,andVirtualMachineLogs 137
Index 139
-
VMware, Inc. 8
Contents
-
VMware, Inc. 9
ThevSphereCommandLineInterfaceConceptsandExamplesdocumentationexplainshowtousetheVMwarevSphereCommandLineInterface(vCLI)andincludescommandoverviewsandexamples.
Intended AudienceThisbookisforexperiencedWindowsorLinuxsystemadministratorswhoarefamiliarwithvSphereadministrationtasksanddatacenteroperationsandknowhowtousecommandsinscripts.
VMware Technical Publications GlossaryVMwareTechnicalPublicationsprovidesaglossaryoftermsthatmightbeunfamiliartoyou.FordefinitionsoftermsastheyareusedinVMwaretechnicaldocumentation,gotohttp://www.vmware.com/support/pubs.
Document FeedbackVMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhavecomments,[email protected].
Related DocumentationThevSphereCommandLineInterfaceReference,availableinthevSphereDocumentationCenter,includesreferenceinformationforvicfg-commandsandESXCLIcommands.GettingStartedwithvSphereCommandLineInterfacesincludesinformationaboutavailableCLIs,enablingtheESXiShell,andinstallingandrunningvCLIcommands.AnappendixsuppliestheESXCLInamespaceandcommandhierarchies.CommandLineManagementofvSphere5.0forServiceConsoleUsersisforcustomerswhocurrentlyusetheESX ServiceConsole.ThevSphereSDKforPerldocumentationexplainshowyoucanusethevSphereSDKforPerlandrelatedutilityapplicationstomanageyourvSphereenvironment.ThedocumentationincludesanInstallationGuide,aProgrammingGuide,andareferencetothevSphereSDKforPerlUtilityApplications.BackgroundinformationforthetasksdiscussedinthismanualisavailableinthevSpheredocumentationset.ThevSpheredocumentationconsistsofthecombinedvCenterServerandESXidocumentationandincludesinformationaboutmanagingstorage,networkingvirtualmachines,andmore.
Technical Support and Education ResourcesThefollowingsectionsdescribethetechnicalsupportresourcesavailabletoyou.Toaccessthecurrentversionofthisbookandotherbooks,gotohttp://www.vmware.com/support/pubs.
About This Book
-
vSphere Command-Line Interface Concepts and Examples
10 VMware, Inc.
Online and Telephone SupportTouseonlinesupporttosubmittechnicalsupportrequests,viewyourproductandcontractinformation,andregisteryourproducts,gotohttp://www.vmware.com/support.Customerswithappropriatesupportcontractsshouldusetelephonesupportforthefastestresponseonpriority1issues.Gotohttp://www.vmware.com/support/phone_support.
Support OfferingsTofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,gotohttp://www.vmware.com/support/services.
VMware Professional ServicesVMwareEducationServicescoursesofferextensivehandsonlabs,casestudyexamples,andcoursematerialsdesignedtobeusedasonthejobreferencetools.Coursesareavailableonsite,intheclassroom,andliveonline.Foronsitepilotprograms andimplementationbestpractices,VMwareConsultingServicesprovidesofferingsto helpyouassess,plan,build,andmanageyourvirtualenvironment.Toaccessinformationabouteducationclasses,certificationprograms,andconsultingservices,gotohttp://www.vmware.com/services.
-
VMware, Inc. 11
1
Thischapterintroducesthecommandset,presentssupportedcommandsfordifferentversionsofvSphere,listsconnectionoptions,anddiscussesvCLIandlockdownmode.Thischapterincludesthefollowingtopics: Introductiononpage 11 ListofAvailableCommandsonpage 12 SupportedPlatformsforCommandsonpage 14 RunningESXCLICommandsAgainstESXi4.xHostsonpage 16 CommandswithanesxcfgPrefixonpage 16 UsingESXCLIOutputonpage 17 ConnectionOptionsonpage 17 vCLIandLockdownModeonpage 18
IntroductionThevSphereCLIcommandset,availablesinceESX/ESXi3.5,allowsyoutoperformvSphereconfigurationtasksusingavCLIpackageinstalledonsupportedplatforms,orusingvMA.Thesetconsistsofseveralcommandsets.
YoucaninstallthevSphereCLIcommandsetonasupportedLinuxorWindowssystem.SeeGettingStartedwithvSphereCommandLineInterfaces.YoucanalsodeploythevSphereManagementAssistant(vMA)toanESXisystemofyourchoice.ManageESXihostsfromtheLinuxorWindowssystemorfromvMAbyrunningvCLIcommandswithconnectionoptionssuchasthetargethost,user,andpasswordoraconfigurationfile.SeeConnectionOptionsonpage 17.
vSphere CLI Command Overviews 1
Table 1-1. Components of the vSphere CLI Command Set
vCLI Commands Description
ESXCLIcommands ComprehensivesetofcommandsformanagingmostaspectsofvSphere.InvSphere5.0,thiscommandsethasbeenunified.Eventually,ESXCLIcommandswillreplaceothercommandsinthevCLIset.CompletelyequivalentESXCLIcommandsareavailableintheESXiShell.UsevCLIESXCLIcommandsforasaferenvironment.
vicfg- commands SetofcommandsformanyaspectsofvSphere.InvSphere5.0,onlyminorchangesweremadetothiscommandset.Eventually,thesecommandswillbereplacedbyESXCLIcommands.Asetofesxcfg-commandsthatpreciselymirrorsthevicfg-commandsisalsoincludedinthevCLIpackage.
Othercommands(vmware-cmd,vifs,vmkfstools)
CommandsimplementedinPerlthatdonothaveavicfg-prefix.AllvCLIcommandsarescheduledtobereplacedbyESXCLIcommands.
-
vSphere Command-Line Interface Concepts and Examples
12 VMware, Inc.
DocumentationGettingStartedwithvSphereCommandLineInterfacesincludesinformationaboutavailableCLIs,enablingtheESXiShell,andinstallingandrunningvCLIcommands.AnappendixsuppliesthenamespaceandcommandhierarchiesforESXCLI.ReferenceinformationforvCLIcommandsisavailableonthevCLIdocumentationpagehttp://www.vmware.com/support/developer/vcli/. vSphereCommandLineInterfaceReferenceisareferencetovicfg-andrelatedvCLIcommandsand
includesreferenceinformationforESXCLIcommands.Allreferenceinformationisgeneratedfromthehelp.
AreferencetoesxtopandresxtopisincludedintheResourceManagementdocumentation.
Command-Line HelpAvailablecommandlinehelpdiffersforthedifferentcommands.
List of Available CommandsTable 12listsallESX/ESXi4.1vCLIcommandsinalphabeticalorderandthecorrespondingESXCLIcommandifavailable.NonewcommandswereaddedinvSphere5.0.ManynewnamespaceswereaddedtoESXCLIinvSphere5.0.
Command set Available Command-Line Help
vicfgcommands Run --helpforanoverviewofeachoptions.RunPod2Htmlwithavicfgcommandasinputandpipetheoutputtoafileformoredetailedhelpinformation.pod2html vicfg-authconfig.pl > vicfg-authconfig.html
ThisoutputcorrespondstotheinformationavailableinthevSphereCommandLineInterfaceReference.
ESXCLIcommands Run--helpatanylevelofthehierarchyforinformationaboutbothcommandsandnamespacesavailablefromthatlevel.
Table 1-2. vCLI and ESXCLI Commands
vCLI 4.1 Command vCLI 5.0 Command Comment
esxcli esxcli(newsyntax) AllvCLI4.1commandshavebeenrenamed.SignificantadditionshavebeenmadetoESXCLI.Manytaskspreviouslyperformedwithavicfg-commandisnowperformedwithESXCLI.
resxtop resxtop(NoESXCLIequivalent)SupportedonlyonLinux.
MonitorsinrealtimehowESXihostsuseresources.Runsininteractiveorbatchmode.SeeUsingresxtopforPerformanceMonitoringonpage 131.SeethevSphereResourceManagementdocumentationforadetailedreference.
svmotion svmotion(NoESXCLIequivalent)MustrunagainstavCenterServersystem.
Movesavirtualmachinesconfigurationfile,and,optionally,itsdisks,whilethevirtualmachineisrunning.SeeMigratingVirtualMachineswithsvmotiononpage 49.
vicfg-advcfg esxcli system settings advanced
Performsadvancedconfiguration.TheadvancedsettingsareasetofVMkerneloptions.Theseoptionsaretypicallyinplaceforspecificworkaroundsordebugging.UsethiscommandasinstructedbyVMware.
vicfg-authconfig vicfg-authconfig(NoESXCLIequivalent).
RemotelyconfiguresActiveDirectorysettingsforanESXihost.SeeUsingvicfgauthconfigforActiveDirectoryConfigurationonpage 25.
vicfg-cfgbackup vicfg-cfgbackup(NoESXCLIequivalent),CannotrunagainstavCenterServersystem.
BacksuptheconfigurationdataofanESXisystemandrestorespreviouslysavedconfigurationdata.SeeBackingUpConfigurationInformationwithvicfgcfgbackuponpage 22.
-
VMware, Inc. 13
Chapter 1 vSphere CLI Command Overviews
vicfg-dns esxcli network ip dns
SpecifiesanESXihostsDNS(DomainNameServer)configuration.SeeSettingtheDNSConfigurationonpage 123.
vicfg-dumppart esxcli system coredump
Setsboththepartition(esxcli system coredump partition)andthenetwork(esxcli system coredump network)touseforcoredumps.UsethiscommandtosetupESXiDumpCollector.ManagingDiagnosticPartitionsonpage 131.
vicfg-hostops vicfg-hostops(NoESXCLIequivalent)
Manageshosts.Stopping,Rebooting,andExaminingHostswithvicfghostopsonpage 21.EnteringandExitingMaintenanceModewithvicfghostopsonpage 22.
vicfg-ipsec vicfg-ipsec(NoESXCLIequivalent)
SetsupIPsec(InternetProtocolSecurity),whichsecuresIPcommunicationscomingfromandarrivingatESXihosts.ESXihostssupportIPsecusingIPv6.SeeUsingvicfgipsecforSecureNetworkingonpage 126.
vicfg-iscsi esxcli iscsi ManageshardwareandsoftwareiSCSIstorage.SeeManagingiSCSIStorageonpage 53.
vicfg-module esxcli system module
EnablesVMkerneloptions.Usethiscommandwiththeoptionslistedinthisdocument,orasinstructedbyVMware.SeeManagingVMkernelModulesonpage 24.
vicfg-mpath
vicfg-mpath35
esxcli storage core path
Configuresstoragearrays.ManagingPathsonpage 42.
vicfg-nas esxcli storage nfs ManagesNAS/NFSfilesystems.SeeManagingNFS/NASDatastoresonpage 48.
vicfg-nics esxcli network nic ManagestheESXihostsuplinkadapters.SeeManagingUplinkAdaptersonpage 117.
vicfg-ntp vicfg-ntp(NoESXCLIequivalent)
DefinestheNTP(NetworkTimeProtocol)server.SeeAddingandStartinganNTPServeronpage 125.
vicfg-rescan esxcli storage adapter rescan
Rescansthestorageconfiguration.SeeScanningStorageAdaptersonpage 52.
vicfg-route vicfg-route (NoESXCLIequivalent)
ManagestheESXihostsrouteentry.SeeManagingtheIPGatewayonpage 126.
vicfg-scsidevs esxcli storage core adapter
FindsandexaminesavailableLUNs.SeeExaminingLUNsonpage 40.
vicfg-snmp vicfg-snmp(NoESXCLIequivalent)
ManagestheSNMPagent.ManagingESXiSNMPAgentswithvicfgsnmponpage 135.UsingSNMPinavSphereenvironmentisdiscussedindetailinthevSphereMonitoringandPerformancedocumentation.NewoptionsaddedinvCLI5.0.
vicfg-syslog esxcli system syslog
SpecifieslogsettingsforESXihostsincludinglocalstoragepoliciesandserverandportinformationfornetworklogging.SeeConfiguringESXiSyslogServicesonpage 134.ThevCenterServerandHostManagementdocumentationexplainshowtosetupsystemlogsusingthevSphereClient.
vicfg-user vicfg-user(NoESXCLIequivalent)
Creates,modifies,deletes,andlistslocaldirectaccessusersandgroupsofusers.SeeManagingUsersonpage 95.ThevSphereSecuritydocumentationdiscussessecurityimplicationsofusermanagementandcustomroles.
vicfg-vmknic esxcli network interface.
Adds,deletes,andmodifiesVMkernelnetworkinterfaces.SeeAddingandModifyingVMkernelNetworkInterfacesonpage 119.
vicfg-volume esxcli storage filesystem volume
SupportsresignaturingthecopyofaVMFSvolume,andmountingandunmountingthecopy.SeeManagingDuplicateVMFSDatastoresonpage 29.
vicfg-vswitch esxcli network vswitch
Addsorremovesvirtualswitchesormodifiesvirtualswitchsettings.SeeSettingUpVirtualSwitchesandAssociatingaSwitchwithaNetworkInterfaceonpage 112.
Table 1-2. vCLI and ESXCLI Commands (Continued)
vCLI 4.1 Command vCLI 5.0 Command Comment
-
vSphere Command-Line Interface Concepts and Examples
14 VMware, Inc.
Supported Platforms for CommandsMostvCLIcommandscanrunagainstanESXisystemoragainstvCenterServer.vCenterServersupportmeansthatyoucanconnecttoavCenterServersystemanduse--vihosttospecifytheESXihosttorunthecommandagainst.Theonlyexceptionissvmotion,whichyoucanrunagainstvCenterServersystems,butnotagainstESXisystems.ThefollowingcommandsmusthaveanESXisystem,notavCenterServersystemtarget. vicfg-snmp vifs vicfg-user vicfg-cfgbackup vihostupdate vmkfstools vicfg-ipsec resxtop
YoucannotrunthevihostupdatecommandagainstanESXi5.0system.Youcannotrunthevihostupdateandvicfg-mpathcommandsthatareinavCLI4.0orlaterinstallationagainstESX/ESXi3.5orvCenter2.5systems.Instead,runvihostupdate35andvicfg-mpath35,includedinthevCLI4.xinstallation,againstthosesystems.vihostupdate35issupportedforESXi,butnotforESX.Youcannotrunvicfg-syslog --setserverorvicfg-syslog --setportwithanESXi5.0target.
vifs vifs(NoESXCLIequivalent)
PerformsfilesystemoperationssuchasretrievinganduploadingfilesontheESXisystem.SeeManagingtheVirtualMachineFileSystemwithvmkfstoolsonpage 28.
vihostupdate
vihostupdate35
Runesxcli software vibagainstESXi5.0.RunvihostupdateagainstESX/ESXi4.x.Runvihostupdate35againstESX/ESXi3.5.
UpdatesESXihoststoadifferentversionofthesamemajorrelease.YoucannotrunvihostupdateagainstESXi5.0hosts.SeeManagingVMkernelModulesonpage 24.
vmkfstools vmkfstools(NoESXCLIequivalent)
Createsandmanipulatesvirtualdisks,filesystems,logicalvolumes,andphysicalstoragedevicesonanESXihost.SeeManagingtheVirtualMachineFileSystemwithvmkfstoolsonpage 28.
vmware-cmd vmware-cmd(NoESXCLIequivalent)
Performsvirtualmachineoperationsremotely.Thisincludes,forexample,creatingasnapshot,poweringthevirtualmachineonoroff,andgettinginformationaboutthevirtualmachine.SeeManagingVirtualMachinesonpage 101.
Table 1-2. vCLI and ESXCLI Commands (Continued)
vCLI 4.1 Command vCLI 5.0 Command Comment
IMPORTANTIfyourunvCLI4.xcommandsagainstESX/ESXi3.5systems,youcanuseonlytheoptionssupportedbythosesystems.SeetheVMwareInfrastructureRemoteCommandLineInterfaceInstallationandReferenceGuideforESX/ESXi3.5Update2foralistofsupportedoptions.Toaccessthatdocument,selectResources>DocumentationfromtheVMwarewebsite.FindthevSpheredocumentationsetandopenthearchive.AfewvCLI4.xoptionsaresupportedagainsthostsrunningESX/ESXi3.5Update2orlatereventhoughtheywerenotsupportedinRCLIversion3.5.RunavCLI4.xcommandwith--helpforinformationaboutoptionsupportwithESX/ESXi3.5Update 2,orseetheVMwareknowledgebasearticleathttp://kb.vmware.com/kb/1008940formoredetail.
-
VMware, Inc. 15
Chapter 1 vSphere CLI Command Overviews
Table 13listsplatformsupportforthedifferentvCLI5.xcommands.ThesecommandshavenotbeentestedagainstVirtualCenter2.5Update2systems.Youcan,however,connecttoavCenterServer4.xsystemandtargetESX/ESXi3.5Update2hosts.
Table 1-3. Platform Support for vCLI 5.x Commands
Command ESXi 5.0 VC 5.0 ESXi 4.x ESX 4.x VC 4.x ESXi 3.5 U2+ ESX 3.5 U2+
esxcli Yes Yes Yes Yes No No No
resxtop Yes(fromLinux)
Yes(fromLinux)
Yes(fromLinux)
Yes(fromLinux)
Yes(fromLinux)
Yes(fromLinux)
Yes(fromLinux)
svmotion No Yes No No Yes No No
vicfg-advcfg Yes Yes Yes Yes Yes Yes Yes
vicfg-authconfig Yes Yes Yes Yes Yes No No
vicfg-cfgbackup Yes No Yes No No Yes No
vicfg-dns Yes Yes Yes Yes Yes Yes Yes
vicfg-dumppart Yes Yes Yes Yes Yes Yes Yes
vicfg-hostops Yes Yes Yes Yes Yes No No
vicfg-ipsec Yes No Yes Yes No No No
vicfg-iscsi Yes Yes Yes Yes Yes No No
vicfg-module Yes Yes Yes Yes Yes Yes Yes
vicfg-mpath Yes Yes Yes Yes Yes Usevicfg-mpath35instead.vicfg-nas Yes Yes Yes Yes Yes Yes Yes
vicfg-nics Yes Yes Yes Yes Yes Yes Yes
vicfg-ntp Yes Yes Yes Yes Yes Yes Yes
vicfg-rescan Yes Yes Yes Yes Yes Yes Yes
vicfg-route Yes Yes Yes Yes Yes Yes Yes
vicfg-scsidevs Yes Yes Yes Yes Yes No No
vicfg-snmp Yes No Yes Yes No Yes Yes
vicfg-syslog No Nofor5.0target
Yes No Yes Yes No
vicfg-user Yes No Yes Yes No Yes Yes
vicfg-vmhbadevs NotincludedinvCLI4.xandvCLI5.0.Usevicfg-scsidevsinstead. Yes Yesvicfg-vmknic Yes Yes Yes Yes Yes Yes Yes
vicfg-volume Yes Yes Yes Yes Yes No No
vicfg-vswitch Yes Yes Yes Yes Yes Yes Yes
vifs Yes No Yes Yes No Yes Yes
vihostupdate Useesxcli software vibinstead.
Yes Yes No Usevihostupdate35instead
No
vmkfstools Yes No Yes Yes No Yes Yes
vmware-cmd Yes Yes Yes Yes Yes Yes Yes
vicfg-mpath35 No No No No No Yes Yes
vihostupdate35 No No No No No Yes No
-
vSphere Command-Line Interface Concepts and Examples
16 VMware, Inc.
Running ESXCLI Commands Against ESXi 4.x HostsWhenyourunanESXCLIvCLIcommand,youmustknowthecommandssupportedonthetargethostspecifiedwith--serverorasavMAtarget. IfyouruncommandsagainstESXi4.xhosts,ESXCLI4.xcommandsaresupported. IfyouruncommandsagainstESXi5.0hosts,ESXCLI5.0commandsaresupported.VMwarepartnersmightdevelopcustomESXCLIcommandsthatyoucanrunonhostswherethepartnerVIBhasbeeninstalled.Runesxcli --server --helpforalistofnamespacessupportedonthetarget.Youcandrilldownintothenamespacesforadditionalhelp.
Commands with an esxcfg PrefixFormanyofthevCLIcommands,youmighthaveusedscriptswithcorrespondingserviceconsolecommandsstartingwithanesxcfgprefixtomanageESX3.xhosts.TofacilitateeasymigrationfromESX/ESXi3.xtolaterversionsofESXi,acopyofeachvicfg-commandthatusesanesxcfg-prefixisincludedinthevCLIpackage.
Table 14listsallvCLIcommandsforwhichavCLIcommandwithanesxcfgprefixisavailable.
IMPORTANTESXCLIonESX4.xhostsdoesnotsupporttargetingavCenterServersystem.Youcanthereforenotruncommandswith--serverpointingtoavCenterServersystemevenifyouinstallvCLI5.0.
IMPORTANTVMwarerecommendsthatyouusethevCLIcommandswiththevicfgprefix.Commandswiththeesxcfgprefixareavailablemainlyforcompatibilityreasonsandmightbecomeobsolete.vCLIesxcfg-commandsareequivalenttovicfg-commands,butnotcompletelyequivalenttothedeprecatedesxcfg- serviceconsolecommands.
Table 1-4. Commands with an esxcfg Prefix
Command with vicfg prefix Command with esxcfg prefix
vicfg-advcfg esxcfg-advcfg
vicfg-cfgbackup esxcfg-cfgbackup
vicfg-dns esxcfg-dns
vicfg-dumppart esxcfg-dumppart
vicfg-module esxcfg-module
vicfg-mpath esxcfg-mpath
vicfg-nas esxcfg-nas
vicfg-nics esxcfg-nics
vicfg-ntp esxcfg-ntp
vicfg-rescan esxcfg-rescan
vicfg-route esxcfg-route
vicfg-scsidevs esxcfg-scsidevs
vicfg-snmp esxcfg-snmp
vicfg-syslog esxcfg-syslog
vicfg-vmknic esxcfg-vmknic
vicfg-volume esxcfg-volume
vicfg-vswitch esxcfg-vswitch
-
VMware, Inc. 17
Chapter 1 vSphere CLI Command Overviews
Using ESXCLI OutputManyESXCLIcommandsgenerateoutputyoumightwanttouseinyourapplication.Youcanrunesxcliwiththe--formatterdispatcheroptionandsendtheresultingoutputasinputtoaparser.The--formatteroptionssupportsthreevalues,csv,xml,andkeyvalueandisusedbeforeanynamespace.esxcli --formatter=csv storage filesystem list
ListsallfilesysteminformationinCSVformat.Youcanpipetheoutputtoafile.esxcli --formatter=keyvalue storage filesystem list > myfilesystemlist.txt
Connection OptionsTable 15listsoptionsthatareavailableforallvCLIcommandsinalphabeticalorder.Examplesinthisbookusetoindicatethepositionofconnectionoptions.Forexample,esxcli filesystem nfs listmeansthatyoucoulduseaconfigurationfile,asessionfile,orjustspecifyatargetserverandrespondwithausernameandpasswordwhenprompted.Thetableincludesoptionsforuseonthecommandlineandvariablesforuseinconfigurationfiles.
SeetheGettingStartedwithvSphereCommandLineInterfacesdocumentationforadditionalinformationandexamples.
IMPORTANTAlwaysuseaformatterforconsistentoutput.
IMPORTANTForconnections,vCLIsupportsonlytheIPv4protocol,nottheIPv6protocol.Youcan,however,configureIPv6onthetargethostwithseveralofthenetworkingcommands.
Table 1-5. vCLI Connection Options
Option and Environment Variable Description
--cacertsfile
-t
VI_CACERTFILE=
ESXCLIcommandsonly.UsedtospecifytheCA(CertificateAuthority)certificatefile,inPEMformat,toverifytheidentityofthevCenterServersystemorESXisystemtorunthecommandon.Canbeused,forexample,topreventmaninthemiddleattack.
--config
VI_CONFIG=
Usestheconfigurationfileatthespecifiedlocation.Specifyapaththatisreadablefromthecurrentdirectory.
--credstore Nameofacredentialstorefile.Defaultsto/.vmware/credstore/vicredentials.xmlonLinuxand/VMware/credstore/vicredentials.xmlonWindows.CommandsforsettingupthecredentialstoreareincludedinthevSphereSDKforPerl,whichisinstalledwithvCLI.ThevSphereSDKforPerlProgrammingGuideexplainshowtomanagethecredentialstore.
--encoding
VI_ENCODING=
Specifiestheencodingtobeused.Thefollowingencodingsaresupported. cp936(SimplifiedChinese) shftjis(Japanese) cp850(GermanandFrench).Youcanuse--encodingtospecifytheencodingvCLIshouldmaptowhenitisrunonaforeignlanguagesystem.
--passthroughauth
VI_PASSTHROUGHAUTH
Ifyouspecifythisoption,thesystemusestheMicrosoftWindowsSecuritySupportProviderInterface(SSPI)forauthentication.Trustedusersarenotpromptedforausernameandpassword.SeetheMicrosoftWebsiteforadetaileddiscussionofSSPI.ThisoptionissupportedonlyifyouarerunningvCLIonaWindowssystemandareconnectingtoavCenterServersystem.
-
vSphere Command-Line Interface Concepts and Examples
18 VMware, Inc.
--passthroughauthpackage
VI_PASSTHROUGHAUTHPACKAGE=
Usethisoptionwith--passthroughauthtospecifyadomainlevelauthenticationprotocoltobeusedbyWindows.Bydefault,SSPIusestheNegotiateprotocol,whichmeansthatclientandservertrytonegotiateaprotocolthatbothsupport.IfthevCenterServersystemtowhichyouareconnectingisconfiguredtouseaspecificprotocol,youcanspecifythatprotocolusingthisoption.ThisoptionissupportedonlyifyouarerunningvCLIonaWindowssystemandconnectingtoavCenterServersystem.
--password
VI_PASSWORD=
Usesthespecifiedpassword(usedwith--username)tologintotheserver. If--serverspecifiesavCenterServersystem,theusernameand
passwordapplytothatserver.IfyoucanlogintothevCenterServersystem,youneednoadditionalauthenticationtoruncommandsontheESXihoststhatservermanages.
If--serverspecifiesanESXihost,theusernameandpasswordapplytothatserver.
Usetheemptystring(' 'onLinuxand onWindows)toindicatenopassword.Ifyoudonotspecifyausernameandpasswordonthecommandline,thesystempromptsyouanddoesnotechoyourinputtothescreen.
--portnumber
VI_PORTNUMBER=
Usesthespecifiedporttoconnecttothesystemspecifiedby--server.Defaultis443.
--protocol
VI_PROTOCOL=
Usesthespecifiedprotocoltoconnecttothesystemspecifiedby--server.DefaultisHTTPS.
--savesessionfile
VI_SAVESESSIONFILE=
Savesasessiontothespecifiedfile.Thesessionexpiresifitisnotusedfor30minutes.
--server
VI_SERVER=
UsesthespecifiedESXiorvCenterServersystem.Defaultislocalhost.If--serverpointstoavCenterServersystem,youusethe--vihostoptiontospecifytheESXihostonwhichyouwanttorunthecommand.AcommandissupportedforvCenterServerifthe--vihostoptionisdefined.
--servicepath
VI_SERVICEPATH=
UsesthespecifiedservicepathtoconnecttotheESXihost.Defaultis/sdk/webService.
--sessionfile
VI_SESSIONFILE=
Usesthespecifiedsessionfiletoloadapreviouslysavedsession.Thesessionmustbeunexpired.
--url
VI_URL=
ConnectstothespecifiedvSphereWebServicesSDKURL.
--username
VI_USERNAME=
Usesthespecifiedusername. If--serverspecifiesavCenterServersystem,theusernameand
passwordapplytothatserver.IfyoucanlogintothevCenterServersystem,youneednoadditionalauthenticationtoruncommandsontheESXihoststhatservermanages.
If--serverspecifiesanESXisystem,theusernameandpasswordapplytothatsystem.
Ifyoudonotspecifyausernameandpasswordonthecommandline,thesystempromptsyouanddoesnotechoyourinputtothescreen.
--vihost -h
-
VMware, Inc. 19
Chapter 1 vSphere CLI Command Overviews
vCLI and Lockdown ModeForadditionalsecurity,anadministratorcanplaceoneormorehostsmanagedbyavCenterServersysteminlockdownmode.LockdownmodeaffectsloginprivilegesfortheESXihost. UsersthatwereloggedintotheESXiShellbeforelockdownmodewasenabledremainloggedinandcan
runcommands,however,thoseuserscannotdisablelockdownmode. Nootherusers,includingtherootusers,canlogintoanESXiShellinlockdownmode.Youcannolonger
accesstheshellfromthedirectconsoleorbyusingaremoteshell.Youcandisablelockdownmodeasfollows. TheadministratoruseronthevCenterServersystemcandisablelockdownmodeforhostsitmanages
fromthevCenterServersystem. TherootusercanalwayslogindirectlytotheESXihostsdirectconsoletodisablelockdownmode.Ifthe
directconsoleisdisabled,theadministratoronthevCenterServersystemcandisablelockdownmode.IfthehostisnotmanagedbyavCenterServersystemorifthehostisunreachable,youmustreinstallESXi.
TomakechangestoESXisystemsinlockdownmode,youmustgothroughavCenterServersystemthatmanagestheESXisystemastheuservpxuser.esxcli --server MyVC --vihost MyESXi storage filesystem list
ThecommandpromptsforthevCenterServersystemusernameandpassword.YoucanusethevSphereClientorvCLIcommandsthatsupportthe--vihostoption.ThefollowingcommandscannotrunagainstvCenterServersystemsandarethereforenotavailableinlockdownmode: vicfg-snmp vifs vicfg-user vicfg-cfgbackup vihostupdate vmkfstools vicfg-ipsecIfyouhaveproblemsrunningacommandonanESXihostdirectly(withoutspecifyingavCenterServertarget),checkwhetherlockdownmodeisenabledonthathost.ThevSphereSecuritydocumentationdiscusseslockdownmodeindetail.
-
vSphere Command-Line Interface Concepts and Examples
20 VMware, Inc.
-
VMware, Inc. 21
2
HostmanagementcommandscanstopandrebootESXihosts,backupconfigurationinformation,andmanagehostupdates.YoucanalsouseahostmanagementcommandtomakeyourhostjoinanActiveDirectorydomainorexitfromadomain.Thechapterincludesthefollowingtopics: Stopping,Rebooting,andExaminingHostswithvicfghostopsonpage 21 EnteringandExitingMaintenanceModewithvicfghostopsonpage 22 BackingUpConfigurationInformationwithvicfgcfgbackuponpage 22 ManagingVMkernelModulesonpage 24 UsingvicfgauthconfigforActiveDirectoryConfigurationonpage 25 UpdatingHostsonpage 26ForinformationonupdatingESXi5.0hostswiththeesxcli softwarecommandandonchangingthehostacceptanceleveltomatchthelevelofaVIBthatyoumightwanttouseforanupdate,seethevSphereUpgradedocumentation.
Stopping, Rebooting, and Examining Hosts with vicfg-hostopsYoucanshutdownorrebootanESXihostusingthevSphereClientorthevicfg-hostopsvCLIcommand.NoequivalentESXCLIcommandiscurrentlyavailable.ShuttingdownamanagedhostdisconnectsitfromthevCenterServersystem,butdoesnotremovethehostfromtheinventory.Youcanshutdownasinglehostorallhostsinadatacenterorcluster.SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof. Singlehost.Runvicfg-hostopswith--operationshutdown.
Ifthehostisinmaintenancemode,runthecommandwithoutthe--forceoption.vicfg-hostops --operation shutdown
Ifthehostisnotinmaintenancemode,use--forcetoshutdownthehostandallrunningvirtualmachines.
vicfg-hostops --operation shutdown --force
Allhostsindatacenterorcluster.Toshutdownallhostsinaclusterordatacenter,specify--clusteror--datacenter.vicfg-hostops --operation shutdown --cluster vicfg-hostops --operation shutdown --datacenter
Youcanrebootasinglehostorallhostsinadatacenterorcluster. Singlehost.Runvicfg-hostopswith--operationreboot.
Managing Hosts 2
-
vSphere Command-Line Interface Concepts and Examples
22 VMware, Inc.
Ifthehostisinmaintenancemode,runthecommandwithoutthe--forceoption.vicfg-hostops --operation reboot
Ifthehostisnotinmaintenancemode,use--forcetoshutdownthehostandallrunningvirtualmachines.vicfg-hostops --operation reboot --force
Allhostsindatacenterorcluster.Youcanspecify--clusteror--datacentertorebootallhostsinaclusterordatacenter.vicfg-hostops --operation reboot --cluster vicfg-hostops --operation reboot --datacenter
Youcandisplayinformationaboutahostbyrunningvicfg-hostopswith--operationinfo.vicfg-hostops --operation info
Thecommandreturnsthehostname,manufacturer,model,processortype,CPUcores,memorycapacity,andboottime.ThecommandalsoreturnswhethervMotionisenabledandwhetherthehostisinmaintenancemode.
Entering and Exiting Maintenance Mode with vicfg-hostopsYouplaceahostinmaintenancemodetoserviceit,forexample,toinstallmorememory.Ahostentersorleavesmaintenancemodeonlyastheresultofauserrequest.vicfg-hostopssuspendsvirtualmachinesbydefault,orpowersoffthevirtualmachineifyourunvicfg-hostops --action poweroff.
ThehostisinastateofEnteringMaintenanceModeuntilallrunningvirtualmachinesaresuspendedormigrated.Whenahostisenteringmaintenancemode,youcannotpoweronvirtualmachinesonitormigratevirtualmachinestoit.Whenyourunthevicfg-hostopsvCLIcommand,youcanspecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof.To enter maintenance mode
1 Runvicfg-hostops --operation entertoentermaintenancemode.2 Runvicfg-hostops --operation infotocheckwhetherthehostisinmaintenance
modeorintheEnteringMaintenanceModestate.Afterallvirtualmachinesonthehosthavebeensuspendedormigrated,thehostentersmaintenancemode.Youcannotdeployorpoweronavirtualmachineonhostsinmaintenancemode.Youcanputallhostsinaclusterordatacenterinmaintenancemodebyusingthe--clusteror--datacenteroption.Donotusethoseoptionsunlesssuspendingallvirtualmachinesinthatclusterordatacenterisnoproblem.Youcanlaterrunvicfg-hostops --operation exittoexitmaintenancemode.
Backing Up Configuration Information with vicfg-cfgbackupAfteryouconfigureanESXihost,youcanbackupthehostconfigurationdata.AlwaysbackupyourhostconfigurationafteryouchangetheconfigurationorupgradetheESXiimage.
NOTEvicfg-hostopsdoesnotworkwithVMwareDRS.Virtualmachinesarealwayssuspended.
IMPORTANTThevicfg-cfgbackupcommandisavailableonlyforESXihosts.ThecommandisnotavailablethroughavCenterServersystemconnection.NoequivalentESXCLIcommandissupported.
-
VMware, Inc. 23
Chapter 2 Managing Hosts
Backup TasksDuringaconfigurationbackup,theserialnumberisbackedupwiththeconfiguration.Thenumberisrestoredwhenyourestoretheconfiguration.ThenumberisnotpreservedwhenyouruntheRecoveryCD(ESXiEmbedded)orperformarepairoperation(ESXiInstallable).Youcanbackupandrestoreconfigurationinformationasfollows.1 Backuptheconfigurationbyusingthevicfg-cfgbackupcommand.2 RuntheRecoveryCDorrepairoperation3 Restoretheconfigurationbyusingthevicfg-cfgbackupcommand.Whenyourestoreaconfiguration,youmustmakesurethatallvirtualmachinesonthehostarestopped.
Backing Up Configuration Data
Youcanbackupconfigurationdatabyrunningvicfg-cfgbackupwiththe-soption.vicfg-cfgbackup -s /tmp/ESXi_181842_backup.txt
Forthebackupfilename,includethenumberofthebuildthatisrunningonthehostthatyouarebackingup.IfyouarerunningvCLIonvMA,thebackupfileissavedlocallyonvMA.Backupfilescansafelybestoredlocallybecausevirtualappliancesarestoredinthe/vmfs/volumes/directoryonthehost,whichisseparatefromtheESXiimageandconfigurationfiles.
Restoring Configuration Data
Ifyouhavecreatedabackup,youcanlaterrestoreESXiconfigurationdata.Whenyourestoreconfigurationdata,thenumberofthebuildrunningonthehostmustbethesameasthenumberofthebuildthatwasrunningwhenyoucreatedthebackupfile.Tooverridethisrequirement,includethe-f (force)option.To restore ESXi configuration data
1 Poweroffallvirtualmachinesthatarerunningonthehostthatyouwanttorestore.2 LogintoahostonwhichvCLIisinstalled,orlogintovMA.3 Runvicfg-cfgbackupwiththe-lflagtoloadthehostconfigurationfromthespecifiedbackupfile.
SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof. Ifyourunthefollowingcommand,youarepromptedforconfirmation.
vicfg-cfgbackup -l /tmp/ESXi_181842_backup.tgz
Ifyourunthefollowingcommand,youarenotpromptedforconfirmation.vicfg-cfgbackup -l /tmp/ESXi_181842_backup.tgz -q
Torestorethehosttofactorysettings,runvicfg-cfgbackupwiththe-roption:vicfg-cfgbackup -r
Using vicfg-cfgbackup from vMATobackupahostconfiguration,youcanrunvicfg-cfgbackupfromavMAinstance.ThevMAinstancecanrunonthetargethost(thehostthatyouarebackinguporrestoring),oronaremotehost.Torestoreahostconfiguration,youmustrunvicfg-cfgbackup fromavMAinstancerunningonaremotehost.Thehostmustbeinmaintenancemode,whichmeansallvirtualmachines(includingvMA)mustbesuspendedonthetargethost.Forexample,abackupoperationfortwoESXihosts(host1andhost2)withvMAdeployedonbothhostsworksasfollows: Tobackuponeofthehostsconfiguration(host1orhost2),runvicfg-cfgbackupfromthevMA
appliancerunningoneitherhost1orhost2.Usethe--serveroptiontospecifythehostforwhichyouwantbackupinformation.TheinformationisstoredonvMA.
-
vSphere Command-Line Interface Concepts and Examples
24 VMware, Inc.
Torestorethehost1configuration,runvicfg-cfgbackupfromthevMAappliancerunningonhost2.Usethe--serveroptiontopointtohost1torestoretheconfigurationtothathost.
Torestorethehost2configuration,runvicfg-cfgbackupfromthevMAappliancerunningonhost1.Usethe--serveroptiontopointtohost2torestoretheconfigurationtothathost.
Managing VMkernel Modules Theesxcli system moduleandvicfg-modulecommandssupportsettingandretrievingVMkernelmoduleoptions.vicfg-moduleandesxcli system modulecommandsareimplementationsofthedeprecatedesxcfg-moduleserviceconsolecommand.Thetwocommandssupportmostoftheoptionsesxcfg-modulesupports.vicfg-moduleandesxcli system modulearecommonlyusedwhenVMwareTechnicalSupport,aKnowledgeBasearticle,orVMwaredocumentationinstructyoutodoso.
Managing Modules with esxcli system moduleNotallVMkernelmoduleshavesettablemoduleoptions.ThefollowingexampleillustrateshowtoexamineandenableNetQueueVMkernelmodules.SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof.To examine, enable, and set NetQueue VMkernel modules
1 ListinformationabouttheNetQueuemodule.esxcli system module list -module=s2io
Thesystemreturnsthename,type,value,anddescriptionofthemodule.2 (Optional)Listallenabledorloadedmodules.
esxcli system module list --enabled=trueesxcli system module list --loaded=true
3 EnabletheNetQueuemodel.esxcli system module set --module=s2io --enabled=true
4 Settheparameter.esxcli system module parameters set --module s2io --parameter-string="rx_ring_num=8"
5 VerifythattheNetQueuemoduleisconfigured.esxcli system module parameters list --module=s2io
Managing Modules with vicfg-moduleNotallVMkernelmoduleshavesettablemoduleoptions.ThefollowingexampleillustrateshowtheexamineandenableNetQueueVMkernelmodules.SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof.To examine and set NetQueue VMkernel modules
1 Runvicfg-module --listtolistthemodulesonthehost.vicfg-module --list
2 Runvicfg-module --set-optionswithconnectionoptions,theoptionstringtobepassedtoamodule,andthemodulename.Forexample:vicfg-module --set-options 'rx_ring_num=8' s2io
ConfiguresasupportednetworkinterfacetouseNetQueue.
-
VMware, Inc. 25
Chapter 2 Managing Hosts
Toretrievetheoptionstringthatisconfiguredtobepassedtoamodulewhenthemoduleisloaded,runvicfg-module --get-options.Thisstringisnotnecessarilytheoptionstringcurrentlyinusebythemodule.
vicfg-module --get-options s2io
VerifiesthattheNetQueuemoduleisconfigured.
Using vicfg-authconfig for Active Directory ConfigurationvSphere5.0istightlyintegratedwithActiveDirectory.ActiveDirectoryprovidesauthenticationforalllocalservicesandforremoteaccessthroughthevSphereWebServicesSDK,vSphereClient,PowerCLI,andvSphereCLI.YoucanconfigureActiveDirectorysettingswiththevSphereClient,asdiscussedinthevCenterServerandHostManagementdocumentation,orusevicfg-autconfig.vicfg-authconfigallowsyoutoremotelyconfigureActiveDirectorysettingsonESXihosts.Youcanlistsupportedandactiveauthenticationmechanisms,listthecurrentdomain,andjoinorpartfromanActiveDirectorydomain.BeforeyourunthecommandonanESXihost,youmustpreparethehost.
To prepare ESXi hosts for Active Directory Integration
1 MakesuretheESXisystemandtheActiveDirectoryserverareusingthesametimezonebyconfiguringESXiandADtousesameNTPserver.TheESXisystemstimezoneisalwayssettoUTC.
2 ConfiguretheESXisystemsDNStobeintheActiveDirectorydomain.Youcanrunvicfg-authconfigtoaddthehosttothedomain.Auserwhorunsvicfg-authconfigtoconfigureActiveDirectorysettingsmusthavetheappropriateActiveDirectorypermissions,andmusthaveadministrativeprivilegesontheESXihost.YoucanrunthecommanddirectlyagainstthehostoragainstavCenterServersystem,specifyingthehostwith--vihost.To set up Active Directory
1 InstalltheESXihost,asexplainedinthevSphereInstallationandSetupdocumentation.2 InstallWindowsActiveDirectoryonaWindowsServerthatrunsWindows2000,Windows2003,or
Windows2008.SeetheMicrosoftWebsiteforinstructionsandbestpractices.3 SynchronizetimebetweentheESXisystemandWindowsActiveDirectory(AD).4 TestthattheWindowsADServercanpingtheESXihostbyusingthehostname.
ping
5 Runvicfg-authcofigtoaddthehosttotheActiveDirectorydomain.vicfg-authconfig --server=
--username= --password=
Thesystempromptsforusernamesandpasswordsifyoudonotspecifythemonthecommandline.Passwordsarenotechoedtothescreen.
6 CheckthataSuccessfully Joined messageappears.7 VerifytheESXihostisintheintendedWindowsADdomain.
vicfg-authconfig --server XXX.XXX.XXX.XXX --authscheme AD -c
YouarepromptedforausernameandpasswordfortheESXisystem.
IMPORTANTAllhoststhatjoinActiveDirectorymustalsobemanagedbyanNTPServertoavoidissueswithclockskewsandKerberostickets.
-
vSphere Command-Line Interface Concepts and Examples
26 VMware, Inc.
Updating HostsWhenyouaddcustomdriversorpatchestoahost,theprocessiscalledanupdate. UpdateESXi4.0andESXi4.1hostswiththevihostupdatecommand,asdiscussedinthevSphere
CommandLineInterfaceInstallationandReferenceGuideincludedinthevSphere4.1documentationset. UpdateESXi5.0hostswithesxcli software vibcommandsdiscussedinthevSphereUpgrade
documentationincludedinthevSphere5.0documentationset.YoucannotrunthevihostupdatecommandagainstanESXi5.0host.
-
VMware, Inc. 27
3
ThevSphereCLIincludestwocommandsforfilemanipulation.vmkfstoolsallowsyoutomanipulateVMFS(VirtualMachineFileSystem)andvirtualdisks.vifssupportsremoteinteractionwithfilesonyourESXihost.
Thischapterincludesthefollowingtopics: IntroductiontoVirtualMachineFileManagementonpage 27 ManagingtheVirtualMachineFileSystemwithvmkfstoolsonpage 28 UpgradingVMFS3VolumestoVMFS5onpage 29 ManagingVMFSVolumesonpage 29 DetachingDevicesandRemovingaLUNonpage 32 WorkingwithPermanentDeviceLossonpage 33 UsingvifstoManipulateFilesonRemoteESXiHostsonpage 33
Introduction to Virtual Machine File ManagementYoucanusethevSphereClientorvCLItoaccessdifferenttypesofstoragedevicesthatyourESXihostdiscoversandtodeploydatastoresonthosedevices.
Dependingonthetypeofstorageyouuse,datastorescanbebackedbythefollowingfilesystemformats: VirtualMachineFileSystem(VMFS).Highperformancefilesystemthatisoptimizedforstoringvirtual
machines.YourhostcandeployaVMFSdatastoreonanySCSIbasedlocalornetworkedstoragedevice,includingFibreChannelandiSCSISANequipment.AsanalternativetousingtheVMFSdatastore,yourvirtualmachinecanhavedirectaccesstorawdevicesanduseamappingfile(RDM)asaproxy.YoumanageVMFSandRDMswiththevSphereClientorthevmkfstoolsutility.
NetworkFileSystem(NFS).FilesystemonaNASstoragedevice.ESXisupportsNFSversion3overTCP/IP.ThehostcanaccessadesignatedNFSvolumelocatedonanNFSserver,mountthevolume,anduseitforanystorageneeds.YoumanageNASstoragedeviceswiththeesxcli storage nfscommand.
Managing Files 3NOTESeeManagingStorageonpage 37forinformationaboutstoragemanipulationcommands.
NOTEDatastoresarelogicalcontainers,analogoustofilesystems,thathidespecificsofeachstoragedeviceandprovideauniformmodelforstoringvirtualmachinefiles.DatastorescanbeusedforstoringISOimages,virtualmachinetemplates,andfloppyimages.ThevSphereClientusesthetermdatastoreexclusively.ThismanualusesthetermdatastoreandVMFS(orNFS)volumetorefertothesamelogicalcontaineronthephysicaldevice.
-
vSphere Command-Line Interface Concepts and Examples
28 VMware, Inc.
Figure 3-1. Virtual Machines Accessing Different Types of Storage
Managing the Virtual Machine File System with vmkfstoolsVMFSdatastoresprimarilyserveasrepositoriesforvirtualmachines.YoucanstoremultiplevirtualmachinesonthesameVMFSvolume.Eachvirtualmachine,encapsulatedinasetoffiles,occupiesaseparatesingledirectory.Fortheoperatingsysteminsidethevirtualmachine,VMFSpreservestheinternalfilesystemsemantics.Inaddition,youcanusetheVMFSdatastorestostoreotherfiles,suchasvirtualmachinetemplatesandISOimages.VMFSsupportsfileandblocksizesthatenablevirtualmachinestorundataintensiveapplications,includingdatabases,ERP,andCRM,invirtualmachines.SeethevSphereStoragedocumentation.YouusethevmkfstoolsvCLItocreateandmanipulatevirtualdisks,filesystems,logicalvolumes,andphysicalstoragedevicesonanESXihost.Youcanusevmkfstoolstocreateandmanageavirtualmachinefilesystem(VMFS)onaphysicalpartitionofadiskandtomanipulatefiles,suchasvirtualdisks,storedonVMFS3andNFS.Youcanalsousevmkfstoolstosetupandmanagerawdevicemappings(RDMs).
ThevSphereStoragedocumentationincludesacompletereferencetothevmkfstoolscommandthatyoucanuseintheESXiShell.YoucanusemostofthesameoptionswiththevmkfstoolsvCLIcommand.SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof.ThefollowingoptionssupportedbythevmkfstoolsESXiShellcommandarenotsupportedbythevmkfstoolsvCLIcommand. --breaklock -B --chainConsistent -e --eagerzero -k --fix -x --lock -L --migratevirtualdisk -M --parseimage -Y --punchzero -K --snapshotdisk -I --verbose -v
iSCSI array NAS appliancefibre array
Host
VMFS
localethernet
SCSI
VMFS VMFS NFS
virtualmachine
virtualmachine
virtualmachine
virtualmachine
virtualmachine
SAN LAN LAN LAN
iSCSI hardwareinitiator
fibrechannelHBA
ethernetNIC
ethernetNIC
softwareinitiator
requires TCP/IP connectivity
Key
physicaldisk
datastore
virtualdisk
IMPORTANTThevmkfstoolsvCLIsupportsmostbutnotalloftheoptionsthatthevmkfstoolsESXiShellcommandsupports.SeeVMwareKnowledgeBasearticle1008194.Youcannotrunvmkfstoolswith--serverpointingtoavCenterServersystem.
-
VMware, Inc. 29
Chapter 3 Managing Files
Upgrading VMFS3 Volumes to VMFS5vSphere5.0supportsVMFS5volumes,whichhaveimprovedscalabilityandperformance.YoucanupgradefromVMFS3toVMFS5byusingthevSphereClient,thevmkfstoolsESXiShellcommand,ortheesxcli storage vmfs upgradecommand.PassthevolumelabelorthevolumeUUIDtotheESXCLIcommand.
Managing VMFS VolumesDifferentcommandsareavailableforlisting,mounting,andunmountingVMFSvolumesandforlisting,mounting,andunmountingVMFSsnapshotvolumes. ManagingVMFSvolumes
esxcli storage filesystem listshowsallvolumes,mountedandunmounted,thatareresolved,thatis,thatarenotsnapshotvolumes.esxcli storage filesystem unmountunmountsacurrentlymountedfilesystem.Usethiscommandforsnapshotvolumesorresolvedvolumes.
Managingsnapshotvolumesesxcli storage vmfs snapshotcommandscanbeusedforlisting,mounting,andresignaturingsnapshotvolumes.SeeMountingDatastoreswithExistingSignaturesonpage 29andResignaturingVMFSCopiesonpage 30.
Managing Duplicate VMFS DatastoresEachVMFSdatastorecreatedinaLUNhasauniqueUUIDthatisstoredinthefilesystemsuperblock.WhentheLUNisreplicatedorwhenasnapshotismade,theresultingLUNcopyisidentical,byteforbyte,totheoriginalLUN.Asaresult,iftheoriginalLUNcontainsaVMFSdatastorewithUUIDX,theLUNcopyappearstocontainanidenticalVMFSdatastore,oraVMFSdatastorecopy,withthesameUUIDX.ESXihostscandeterminewhetheraLUNcontainstheVMFSdatastorecopy,andeithermountthedatastorecopywithitsoriginalUUIDorchangetheUUIDtoresignaturethedatastore.WhenaLUNcontainsaVMFSdatastorecopy,youcanmountthedatastorewiththeexistingsignatureorassignanewsignature.ThevSphereStoragedocumentationdiscussesvolumeresignaturingindetail.
Mounting Datastores with Existing SignaturesYoucanmountaVMFSdatastorecopywithoutchangingitssignatureiftheoriginalisnotmounted.Forexample,youcanmaintainsynchronizedcopiesofvirtualmachinesatasecondarysiteaspartofadisasterrecoveryplan.Intheeventofadisasterattheprimarysite,youcanmountthedatastorecopyandpoweronthevirtualmachinesatthesecondarysite.
WhenyoumounttheVMFSdatastore,ESXiallowsbothreadandwriteoperationstothedatastorethatresidesontheLUNcopy.TheLUNcopymustbewritable.Thedatastoremountsarepersistentandvalidacrosssystemreboots.Youcanmountadatastorewithvicfg-volume(seeTomountadatastorewithvicfgvolumeonpage 30)orwithESXCLI(seeTomountadatastorewithESXCLIonpage 30).
IMPORTANTYoucannotupgradeVMFS3volumestoVMFS5withthevmkfstoolscommandincludedinvSphereCLI.
IMPORTANTYoucanmountaVMFSdatastoreonlyifitdoesnotconflictwithanalreadymountedVMFSdatastorethathasthesameUUID.
-
vSphere Command-Line Interface Concepts and Examples
30 VMware, Inc.
Mounting and Unmounting with ESXCLI
Theesxcli storage filesystemcommandssupportmountingandunmountingvolumes.Youcanalsospecifywhethertopersistthemountedvolumesacrossrebootsbyusingthe--no-persistoption.Usetheesxcli storage filesystemcommandtolistmountedvolumes,mountnewvolumes,andunmountavolume.SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof.To mount a datastore with ESXCLI1 Listallvolumesthathavebeendetectedassnapshots.
esxcli storage filesystem list
2 Runesxcli storage filesystem mountwiththevolumelabelorvolumeUUID.Bydefault,thevolumeismountedpersistently,use--no-persisttomountpersistently.esxcli storage filesystem volume mount
--volume-label=|--volume-uuid=
Thiscommandfailsiftheoriginalcopyisonline.Youcanlaterrunesxcli storage filesystem volume unmounttounmountthesnapshotvolume.esxcli storage filesystem volume unmount
--volume-label=|--volume-uuid=
Mounting and Unmounting with vicfg-volume
Usethevicfg-volumecommandtolistmountedvolumes,mountnewvolumes,andunmountavolume.SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof.To mount a datastore with vicfg-volume
1 Listallvolumesthathavebeendetectedassnapshotsorreplicas.vicfg-volume --list
2 Runvicfg-volume --persistent-mount withtheVMFSUUIDorlabelasanargumenttomountavolume.vicfg-volume --persistent-mount
Thiscommandfailsiftheoriginalcopyisonline.Youcanlaterrunvicfg-volume --unmounttounmountthesnapshotorreplicavolume.vicfg-volume --unmount
Thevicfg-volumecommandsupportsresignaturingasnapshotvolumeandmountingandunmountingthevolume.Youcanalsomakethemountedvolumepersistentacrossrebootsandqueryalistofsnapshotvolumesandoriginalvolumes.
Resignaturing VMFS CopiesUsedatastoreresignaturingtoretainthedatastoredontheVMFSdatastorecopy.WhenresignaturingaVMFScopy,theESXihostassignsanewUUIDandanewlabeltothecopy,andmountsthecopyasadatastoredistinctfromtheoriginal.BecauseESXipreventsyoufromresignaturingthemounteddatastore,unmountthedatastorebeforeresignaturing.Thedefaultformatofthenewlabelassignedtothedatastoreissnap--,whereisanintegerandisthelabeloftheoriginaldatastore.Whenyouperformdatastoreresignaturing,considerthefollowingpoints: Datastoreresignaturingisirreversible. TheLUNcopythatcontainstheVMFSdatastorethatyouresignatureisnolongertreatedasaLUNcopy.
-
VMware, Inc. 31
Chapter 3 Managing Files
Aspanneddatastorecanberesignaturedonlyifallitsextentsareonline. Theresignaturingprocessiscrashandfaulttolerant.Iftheprocessisinterrupted,youcanresumeitlater. YoucanmountthenewVMFSdatastorewithoutariskofitsUUIDconflictingwithUUIDsofanyother
datastore,suchasanancestororchildinahierarchyofLUNsnapshots.YoucanresignatureaVMFScopywithESXCLI(seeResignaturingaVMFSCopywithESXCLIonpage 31)orwithvicfg-volumeseeResignaturingaVMFSCopywithvicfgvolumeonpage 31.
Resignaturing a VMFS Copy with ESXCLI
Theesxcli storage vmfs snapshotcommandssupportresignaturingasnapshotvolume.SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof.To resignature a VMFS copy with ESXCLI
1 Listunresolvedsnapshotsorreplicavolumes.esxcli storage vmfs snapshot list
2 (Optional)Unmountthecopy.esxcli storage filesystem unmount
3 Runtheresignaturecommand.esxcli storage vmfs snapshot resignature
--volume-label=|--volume-uuid=
Thecommandreturnstothepromptorsignalsanerror.Afterresignaturing,youmighthavetodothefollowing: Iftheresignatureddatastorecontainsvirtualmachines,updatereferencestotheoriginalVMFSdatastore
inthevirtualmachinefiles,including.vmx,.vmdk,.vmsd,and.vmsn. Topoweronvirtualmachines,registerthemwiththevCenterServersystem.
Resignaturing a VMFS Copy with vicfg-volume
Youcanusevicfg-volumetomount,unmount,andresignatureVMFSvolumes.To resignature a VMFS copy with vicfg-volume
1 Makesurethecopyisnotmounted.2 Runvicfg-volumewiththeresignatureoption.
vicfg-volume --resignature
Thecommandreturnstothepromptorsignalsanerror.
-
vSphere Command-Line Interface Concepts and Examples
32 VMware, Inc.
Detaching Devices and Removing a LUNBeforeyoucanremoveaLUN,youmustdetachthecorrespondingdevicebyusingthevSphereClientortheesxcli storage core device setcommand.Detachingadevicebringsadeviceoffline.Detachingadevicedoesnotimpactpathstates.IftheLUNisstillvisible,thepathstateisnotsettodead.To detach a device and remove a LUN
1 Migratevirtualmachinesfromthedeviceyouplantodetach.Forinformationonmigratingvirtualmachines,seethevCenterServerandHostManagementdocumentation.
2 Unmountthedatastoredeployedonthedevice.SeeMountingDatastoreswithExistingSignaturesonpage 29.Iftheunmountfails,ESXCLIreturnsanerror.Ifyouignorethaterror,youwillgetanerrorinstep4whenyouattempttodetachadevicewithaVMFSpartitionstillinuse.
3 Iftheunmountfailed,checkwhetherthedeviceisinuse.esxcli storage core device world list -d
IfaVMFSvolumeisusingthedeviceindirectly,theworldnameincludesthestringidle0.IfavirtualmachineusesthedeviceasanRDM,thevirtualmachineprocessnameisdisplayed.Ifanyotherprocessisusingtherawdevice,theinformationisdisplayed.
4 Detachthestoragedevice.esxcli storage core device set -d naa.xxx... --state=off
Detachispersistentacrossrebootsanddeviceunregistration.Anydevicethatisdetachedremainsdetacheduntilamanualattachoperation.Rescandoesnotbringpersistentlydetacheddevicesbackonline.Apersistentlydetacheddevicecomesbackintheoffstate.ESXimaintainsthepersistentinformationaboutthedevicesofflinestateevenifthedeviceisunregistered.Youcanremovethedeviceinformationbyrunningesxcli storage core device detached remove -d naa.12.
5 (Optional)Totroubleshootthedetachoperation,listalldevicesthatweredetachedmanually.esxcli storage core device detached list
6 Performarescan.esxcli storage core adapter rescan
Whenyouhavecompletedstoragereconfiguration,youcanreattachthestoragedevice,mountthedatastore,andrestartthevirtualmachines.To reattach the device
1 (Optional)Checkthatthedeviceisdetached.esxcli storage core device detached list
2 Attachthedevice.esxcli storage core device set -d naa.XXX --state=on
3 Mountthedatastoreandrestartvirtualmachines.SeeMountingDatastoreswithExistingSignaturesonpage 29.
-
VMware, Inc. 33
Chapter 3 Managing Files
Working with Permanent Device LossWithearlierESX/ESXireleases,anAPD(AllPathsDown)eventresultswhentheLUNbecomesunavailable.TheeventisdifficultforadministratorsbecausetheydonothaveenoughinformationaboutthestateoftheLUNtoknowwhichcorrectiveactionisappropriate.InESXi5.0,theESXihostcandeterminewhetherthecauseofanAllPathsDown(APD)eventistemporary,orwhetherthecauseispermanentdeviceloss.APLDstatusoccurswhenthestoragearrayreturnsSCSIsensecodesindicatingthattheLUNisnolongeravailableorthatasevere,unrecoverablehardwareproblemexistwithit.ESXihasanimprovedinfrastructurethatcanspeedupoperationsofupperlayerapplicationsinadevicelossscenario.
To Remove a PDL LUN
HowyouremoveaPDLLUNdependsonwhetheritwasinuse. IftheLUNthatgoesintoPDLisnotinusebyanyuserprocessorbytheVMkernel,theLUNdisappears
byitselfafteraPDL. IftheLUNwasinusewhenitenteredPLD,deletetheLUNmanuallybyfollowingtheprocessdescribed
inDetachingDevicesandRemovingaLUNonpage 32.To Reattach a PDL LUN
1 ReturntheLUNtoworkingorder.2 Removeanyusersofthedevice.
Youcannotbringadevicebackwithoutremovingactiveusers.TheESXihostcannotknowwhetherthedevicethatwasaddedbackhaschanged.ESXimustbeabletotreatthedevicesimilarlytoanewdevicebeingdiscovered.
3 Performarescantogetthedevicebackinworkingorder.
Using vifs to Manipulate Files on Remote ESXi Hosts Inmostcases,vmkfstoolsandothercommandsareusedtomanipulatevirtualmachinefiles.Insomecases,youmighthavetoviewandmanipulatefilesonremoteESXihostsdirectly.
Thevifscommandperformscommonoperationssuchascopy,remove,get,andputonESXifilesanddirectories.ThecommandissupportedagainstESXihostsbutnotagainstvCenterServersystems.SomesimilaritiesbetweenvifsandDOSorUNIX/Linuxfilesystemmanagementutilitiesexist,buttherearemanydifferences.Forexample,vifsdoesnotsupportwildcardcharactersorcurrentdirectoriesand,asaresult,relativepathnames.Usevifsonlyasdocumented.Insteadofusingthevifscommand,youcanbrowsedatastorecontentsandhostfilesbyusingaWebbrowser.Connecttothefollowinglocation:http://ESX_host_IP_Address/hosthttp://ESX_host_IP_Address/folder
YoucanviewdatacenteranddatastoredirectoriesfromthisrootURL.Forexample:http:///folder?dcPath=ha-datacenterhttp:///folder?dcPath=ha-datacente
IMPORTANTDonotplanforAPD/PDLevents,forexample,whenyouwanttoupgradeyourhardware.Instead,performanorderlyremovalofLUNsfromyourESXiserver,whichisdescribedinDetachingDevicesandRemovingaLUNonpage 32,performtheoperation,andaddtheLUNback.
CAUTIONIfyoumanipulatefilesdirectly,yourvSpheresetupmightendupinaninconsistentstate.UsethevSphereClientoroneoftheothervCLIcommandstomanipulatevirtualmachineconfigurationfilesandvirtualdisks.
-
vSphere Command-Line Interface Concepts and Examples
34 VMware, Inc.
TheESXihostpromptsforausernameandpassword.Thevifscommandsupportsdifferentoperationsforthefollowinggroupsoffilesanddirectories.Differentoperationsareavailableforeachgroup,andyouspecifylocationswithadifferentsyntax.ThebehaviordiffersforvSphere4.xandvSphere5.0.
Toavoidproblemswithdirectorynamesthatusespecialcharactersorspaces,enclosethepathinquotesforbothoperatingsystems.Whenyourunvifs,youcanspecifytheoperationnameandargumentandoneofthestandardconnectionoptions.Usealiases,symboliclinks,orwrapperscriptstosimplifytheinvocationsyntax.
Options
vifscommandspecificoptionsallowyoutoretrieveanduploadfilesfromtheremotehostandperformanumberofotheroperations.Allvifsoptionsworkondatastorefilesordirectories.Someoptionsalsoworkonhostfilesandfilesinthetempdirectory.Youmustalsospecifyconnectionoptions.
vSphere 4.x vSphere 5.0
Host Hostconfigurationfiles.Youmustspecifythefilesuniquenameidentifier.Specifyhostlocationsbyusingthe/host/syntax.
Hostconfigurationfiles.Youmustspecifythefilesuniquenameidentifier.Specifyhostlocationsbyusingthe/host/syntax.Youcannotlistsubdirectoriesof/host.
Temp The/tmpdirectoryandfilesinthatdirectory.Specifytemplocationsbyusingthe/tmp/dir/subdirsyntax.
Notsupported.
Datastores Datastorefilesanddirectories.Youhavetwochoicesforspecifyingadatastore: Datastoreprefixstyle:'[ds_name] relative_path'.Forexample:
'[myStorage1] testvms/VM1/VM1.vmx'(Linux) or "[myStorage1] testvms/VM1/VM1.vmx" (Windows)
URLstyle:/folder/dir/subdir/file?dsName=.Forexample:'/folder/testvms/VM1/VM1.vmx?dsName=myStorage1' (Linux)"/folder/testvms/VM1/VM1.vmx?dsName=myStorage1" (Windows)
ThetwoexamplepathsrefertoavirtualmachineconfigurationfileforthevirtualmachineVM1inthetestvms/VM1directoryofthemyStorage1datastore.
IMPORTANTTheconceptsofworkingdirectoryandlastdirectoryorfileoperatedonarenotsupportedwithvifs.
Command Description Target Syntax
--copy -c
Copiesafileinadatastoretoanotherlocationinadatastore.Themustbearemotesourcepath,thearemotetargetpathordirectory.The--forceoptionreplacesexistingdestinationfiles.
DatastoreTemp
copy src_file_path dst_directory_path [force]copy src_file_path dst_file_path [force]
--dir -D
Liststhecontentsofadatastoredirectory. DatastoreTemp
dir datastore_directory_path
--force-F
Overwritesthedestinationfile.Usedwith--moveand--copy.
DatastoreTemp
copy src_file_path dst_file_path [force]
--get-g
DownloadsafilefromtheESXihosttothemachineonwhichyourunvCLI.ThisoperationusesHTTP GET.
DatastoreHost
get src_dstore_file_path dst_local_file_path
get src_d store_dir_path dst_local_file_path
--listdc-C
ListsthedatacenterpathsavailableonanESXisystem.
DatastoreHost
-
VMware, Inc. 35
Chapter 3 Managing Files
Youcanlistinformationabouttheremotedirectoriesinseveralways.SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof. Listthecurrentdatastores.
vifs --listds.
Thecommandliststhenamesofalldatastoresonthespecifiedserver.Forexample:osdc-cx700-02osdc-cx700-03osdc-cx700-02osdc-cx700-03osdc-cx700-04osdc-cx700-05
Youcanuseeachnamethathasbeenreturnedtorefertodatastorepathsbyusingsquarebracketnotation,asfollows:'[my_datastore] dir/subdir/file'
Listthecontentsofonedirectoryinthedatastore.vifs --dir '[osdc-cx700-02] winxpPro-sp2'
Thecommandliststhedirectorycontent.Inthisexample,thecommandliststhecontentsofavirtualmachinedirectory.Content Listing_________________vmware-37.logvmware-38.log... vmware.log...winxpPro-sp2.vmdkwinxpPro-sp2.vmxwinxpPro-sp2.vmxf...
--listds-S
ListsthedatastorenamesontheESXisystem.Whenmultipledatacentersareavailable,usethe--dc (-Z)argumenttospecifythenameofthedatacenterfromwhichyouwanttolistthedatastore.
DatastoreHost
vifs --listds
--mkdir -M
Createsadirectoryinadatastore.Thisoperationfailsiftheparentdirectoryofdst_datastore_file_pathdoesnotexist.
DatastoreTemp
mkdir dst_directory_path
--move-m
Movesafileinadatastoretoanotherlocationinadatastore.Themustbearemotesourcepath,thearemotetargetpathordirectory.The--forceoptionreplacesexistingdestinationfiles.
DatastoreTemp
move src_file_path dst_directory_path [force]move src_file_path dst_file_path [force]
--put-p
UploadsafilefromthemachineonwhichyourunvCLItotheESXihost.ThisoperationusesHTTP PUT.Thiscommandcanreplaceexistinghostfilesbutcannotcreatenewfiles.
DatastoreHostTemp
put src_local_file_path dst_file_path
put src_local_file_path dst_directory_path
--rm-r
Deletesadatastorefile. DatastoreTemp
rm dst_file_path
--rmdir-R
Deletesadatastoredirectory.Thisoperationfailsifthedirectoryisnotempty.
DatastoreTemp
rmdir dst_directory_path
Command Description Target Syntax
-
vSphere Command-Line Interface Concepts and Examples
36 VMware, Inc.
Listthecontentsofoneofthedatastores.vifs --dir '[osdc-cx700-02]'
Thecommandliststhecompletecontentsofthedatastore.Thefollowingexamplescenarioillustratesotherusesofvifs.SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof.To manage files and directories on the remote ESXi system
1 Createadirectoryinthedatastore.vifs --mkdir '[osdc-cx700-03] vcli_test'
Youmustspecifytheprecisepath;thereisnoconceptofarelativepath.2 Placeafilethatisonthesystemfromwhichyouarerunningthecommandsintothenewlycreated
directory.vifs --put /tmp/test_doc '[osdc-cx700-03] vcli_test/test_doc'
3 Moveafileintoavirtualmachinedirectory.vifs --move '[osdc-cx700-03] vcli_test/test_doc'
'[osdc-cx700-03] winxpPro-sp2/test_doc
Amessageindicatessuccessorfailure.4 RetrieveoneofthefilesfromtheremoteESXisystem.
Thefollowingexampleretrievesalogfileforanalysis.vifs --get '[osdc-cx700-03] winxpPro-sp2/vmware.log' ~user1/vmware.log
5 Cleanupbyremovingthefileanddirectoryyoucreatedearlier.vifs --rm '[osdc-cx700-03] vcli_test/test_doc'vifs --rmdir '[osdc-cx700-03] vcli_test'
-
VMware, Inc. 37
4
Avirtualmachineusesavirtualdisktostoreitsoperatingsystem,programfiles,andotherdataassociatedwithitsactivities.Avirtualdiskisalargephysicalfile,orasetoffiles,thatcanbecopied,moved,archived,andbackedup.Tostorevirtualdiskfilesandmanipulatethefiles,ahostrequiresdedicatedstoragespace.ESXistorageisstoragespaceonavarietyofphysicalstoragesystems,localornetworked,thatahostusestostorevirtualmachinedisks.Thischapterincludesthefollowingtopics: IntroductiontoStorageonpage 37 ExaminingLUNsonpage 40 ManagingPathsonpage 42 ManagingPathPoliciesonpage 45 ManagingNFS/NASDatastoresonpage 48 MigratingVirtualMachineswithsvmotiononpage 50 ConfiguringFCoEAdaptersonpage 51 ScanningStorageAdaptersonpage 52Chapter 5,ManagingiSCSIStorage,onpage 53discussesiSCSIstoragemanagement.Chapter 6,ManagingThirdPartyStorageArrays,onpage 81explainshowtomanagethePluggableStorageArchitecture,includingPathSelectionPlugin(PSP)andStorageArrayTypePlugin(SATP)configuration.ForinformationonmaskingandunmaskingpathswithESXCLI,seethevSphereStoragedocumentation.
Introduction to StorageFibreChannelSANarrays,iSCSISANarrays,andNASarraysarewidelyusedstoragetechnologiessupportedbyVMwarevSpheretomeetdifferentdatacenterstorageneeds.Thestoragearraysareconnectedtoandsharedbetweengroupsofserversthroughstorageareanetworks.Thisarrangementallowsaggregationofthestorageresourcesandprovidesmoreflexibilityinprovisioningthemtovirtualmachines.
Managing Storage 4
-
vSphere Command-Line Interface Concepts and Examples
38 VMware, Inc.
Figure 4-1. vSphere Datacenter Physical Topology
How Virtual Machines Access StorageAvirtualdiskhidesthephysicalstoragelayerfromthevirtualmachinesoperatingsystem.Regardlessofthetypeofstoragedevicethatyourhostuses,thevirtualdiskalwaysappearstothevirtualmachineasamountedSCSIdevice.Asaresult,youcanrunoperatingsystemsthatarenotcertifiedforspecificstorageequipment,suchasSAN,inthevirtualmachine.Whenavirtualmachinecommunicateswithitsvirtualdiskstoredonadatastore,itissuesSCSIcommands.Becausedatastorescanexistonvarioustypesofphysicalstorage,thesecommandsareencapsulatedintootherforms,dependingontheprotocolthattheESXihostusestoconnecttoastoragedevice.Figure 42depictsfivevirtualmachinesthatusedifferenttypesofstoragetoillustratethedifferencesbetweeneachtype.Figure 4-2. Virtual Machines Accessing Different Types of Storage
servergroup 1
virtual machines
servergroup 2
servergroup 3
fibre channelstorage array
iSCSIstorage array
NASstorage array
vCenter Server terminalWeb accessvSphere Client
fibre channel switch fabric / IP network
ESX/ESXi
VM VM VM
VM VM VM
iSCSI array NAS appliancefibre array
Host
VMFS
localethernet
SCSI
VMFS VMFS NFS
virtualmachine
virtualmachine
virtualmachine
virtualmachine
virtualmachine
SAN LAN LAN LAN
iSCSI hardwareinitiator
fibrechannelHBA
ethernetNIC
ethernetNIC
softwareinitiator
requires TCP/IP connectivity
Key
physicaldisk
datastore
virtualdisk
-
VMware, Inc. 39
Chapter 4 Managing Storage
YoucanusevCLIcommandstomanagethevirtualmachinefilesystemandstoragedevices. VMFS.Usevmkfstoolstocreate,modify,andmanageVMFSvirtualdisksandrawdevicemappings.
SeeManagingtheVirtualMachineFileSystemwithvmkfstoolsonpage 28foranintroductionandthevSphereStoragedocumentationforadetailedreference.
Datastores.Severalcommandsallowyoutomanagedatastoresandareusefulformultipleprotocols. LUNs.Useesxcli storage coreorvicfg-scsidevscommandstodisplayavailableLUNsand
mappingsforeachVMFSvolumetoitscorrespondingpartition.SeeExaminingLUNsonpage 40. Pathmanagement.Useesxcli storage coreorvicfg-mpathcommandstolistinformationabout
FibreChanneloriSCSILUNsandtochangeapathsstate.SeeManagingPathsonpage 42.UsetheESXCLIcommandtoviewandmodifypathpolicies.SeeManagingPathPoliciesonpage 45.
Rescan.Useesxcli storage coreorvicfg-rescanadapter rescantoperformarescanoperationeachtimeyoureconfigureyourstoragesetup.SeeScanningStorageAdaptersonpage 52.
Storagedevices.Severalcommandsmanageonlyspecificstoragedevices. NFSstorage.Useesxcli storage nfsorvicfg-nastomanageNASstoragedevices.See
ManagingNFS/NASDatastoresonpage 48. iSCSIstorage.Useesxcli iscsiorvicfg-iscsitomanagebothhardwareandsoftwareiSCSI.
SeeManagingiSCSIStorageonpage 53.
DatastoresESXihostsusestoragespaceonavarietyofphysicalstoragesystems,includinginternalandexternaldevicesandnetworkedstorage.Ahostcandiscoverstoragedevicestowhichithasaccessandformatthemasdatastores.Eachdatastoreisaspeciallogicalcontainer,analogoustoafilesystemonalogicalvolume,wherethehostplacesvirtualdiskfilesandothervirtualmachinefiles.Datastoreshidespecificsofeachstorageproductandprovideauniformmodelforstoringvirtualmachinefiles.Dependingonthetypeofstorageyouuse,datastorescanbebackedbythefollowingfilesystemformats: VirtualMachineFileSystem(VMFS).Highperformancefilesystemoptimizedforstoringvirtual
machines.YourhostcandeployaVMFSdatastoreonanySCSIbasedlocalornetworkedstoragedevice,includingFibreChannelandiSCSISANequipment.AsanalternativetousingtheVMFSdatastore,yourvirtualmachinecanhavedirectaccesstorawdevicesanduseamappingfile(RDM)asaproxy.SeeManagingtheVirtualMachineFileSystemwithvmkfstoolsonpage 28.
NetworkFileSystem(NFS).FilesystemonaNASstoragedevice.ESXisupportsNFSversion3overTCP/IP.ThehostcanaccessadesignatedNFSvolumelocatedonanNFSserver,mountthevolume,anduseitforanystorageneeds.
Storage Device NamingEachstoragedevice,orLUN,isidentifiedbyseveralnames. Name.AfriendlynamethattheESXihostassignstoadevicebasedonthestoragetypeandmanufacturer,
forexample,DGCFibreChannelDisk.ThisnameisvisibleinthevSphereClient. DeviceUID.Auniversallyuniqueidentifierassignedtoadevice.Thetypeofstoragedeterminesthe
algorithmusedtocreatetheidentifier.Theidentifierispersistentacrossrebootsandisthesameforallhostssharingthedevice.Theformatisoftennaa.xxxxxxxoreui.xxxxxxxx.
VMLName.AlegacySCSIdevicenamespecifictoVMware.UsethedeviceUIDinstead.Theruntimenameofthefirstpathtothedeviceisapathidentifierandnotareliableidentifierforthedevice.Runtimenamesarecreatedbythehost,andarenotpersistent.Theruntimenamehastheformatvmhba#:C#:T#:L#.YoucanviewtheruntimenameusingthevSphereClient.
-
vSphere Command-Line Interface Concepts and Examples
40 VMware, Inc.
Examining LUNs ALUN(LogicalUnitNumber)isanidentifierforadiskvolumeinastoragearraytarget.
Target and Device RepresentationIntheESXicontext,thetermtargetidentifiesasinglestorageunitthatahostcanaccess.ThetermsdeviceandLUNdescribealogicalvolumethatrepresentsstoragespaceonatarget.ThetermsdeviceandLUNmeanaSCSIvolumepresentedtothehostfromastoragetarget.DifferentstoragevendorspresenttheirstoragesystemstoESXihostsindifferentways.SomevendorspresentasingletargetwithmultipleLUNsonit.Othervendors,especiallyiSCSIvendors,presentmultipletargetswithoneLUNeach.Figure 4-3. Target and LUN Representations
InFigure 43,threeLUNsareavailableineachconfiguration.Ontheleft,thehostseesonetarget,butthattargethasthreeLUNsthatcanbeused.EachLUNrepresentsanindividualstoragevolume.Ontheright,thehostseesthreedifferenttargets,eachhavingoneLUN.
Examining LUNs with esxcli storage coreUseesxcli storage coretodisplayinformationaboutavailableLUNsonESXi5.0.ForESX/ESXi4.xhosts,usevicfg-scsidevs.ForESX/ESXi3.5systems,thecorrespondingcommandisvicfg-vmhbadevs.YoucanrunoneofthefollowingcommandstoexamineLUNs.SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof. Listalllogicaldevicesknownonthissystemwithdetailedinformation.
esxcli storage core device list
Thecommandlistsdeviceinformationforalllogicaldevicesonthissystem.Theinformationincludesthename(UUID),devicetype,displayname,andmultipathingplugin.Specifythe--deviceoptiontoonlylistinformationaboutaspecificdevice.naa.5000c50006ee9cc7 Display Name: Local SEAGATE Disk (naa.5000c50006ee9cc7) Has Settable Display Name: true Size: 286102 Device Type: Direct-Access Multipath Plugin: NMP Devfs Path: /vmfs/devices/disks/naa.5000c50006ee9cc7 Vendor: SEAGATE Model: ST3300555SS Revision: T211 SCSI Level: 5 Is Pseudo: false Status: on Is RDM Capable: true Is Local: true Is Removable: false Is SSD: false Thin Provisioning Status: unknown Attached Filters: VAAI Status: unknown VAAI Plugin Name: Other UIDs: vml.02000000005000c50006ee9cc7535433333030mpx.vmhba0:C0:T0:L0
storage array
target
LUN LUN LUN
storage array
target target target
LUN LUN LUN
-
VMware, Inc. 41
Chapter 4 Managing Storage
...Attached Filters:
VAAI Status: unsupported VAAI Plugin Name: Other UIDs: vml.0005000000766d686261303a303a30
Listaspecificlogicaldevicewithitsdetailedinformation.esxcli storage core device list -d mpx.vmhba32:C0:T1:L0
Listalldeviceuniqueidentifiers.esxcli storage core device list
ThecommandliststheprimaryUIDforeachdevice(naa.xxxorotherprimaryname)andanyotherUIDsforeachUID(VMLname).Youcanspecify--devicetoonlylistinformationforaspecificdevice.
PrintmappingsforVMFSvolumestothecorrespondingpartition,pathtothatpartition,VMFSUUID,extentnumber,andvolumenames.esxcli storage filesystem list
PrintHBAdeviceswithidentifyinginformation.esxcli storage core adapter list
ThereturnvalueincludesadapterandUIDinformation. PrintamappingbetweenHBAsandthedevicesitprovidespathsto.
esxcli storage core path list
Examining LUNs with vicfg-scsidevsUsevicfg-scsidevstodisplayinformationaboutavailableLUNsonESX/ESXi 4.xhosts.ForESX/ESXi3.5systems,thecorrespondingcommandisvicfg-vmhbadevs.
YoucanrunoneofthefollowingcommandstoexamineLUNs.SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof. Listalllogicaldevicesknownonthissystemwithdetailedinformation.
vicfg-scsidevs --list
Thecommandlistsdeviceinformationforalllogicaldevicesonthissystem.Theinformationincludesthename(UUID),devicetype,displayname,andmultipathingplugin.Specifythe--deviceoptiontoonlylistinformationaboutaspecificdevice.Thefollowingexampleshowsoutputfortwodevices;theactuallistingmightincludemultipledevicesandthepreciseformatdiffersbetweenreleases.mpx.vmhba2:C0:T1:L0
Device Type: cdromSize: 0 MBDisplay Name: Local HL-DT-ST (mpx.vmhba2:C0:T1:L0)Plugin: NMPConsole Device: /vmfs/devices/cdrom/mpx.vmhba2:C0:T1:L0Devfs Path: /vmfs/devices/cdrom/mpx.vmhba2:C0:T1:L0Vendor: SONY Model: DVD-ROM GDRXX8XX Revis: 3.00SCSI Level: 5 Is Pseudo: Status:Is RDM Capable: Is Removable:Other Names:
vml.000N000000XXXdXXXXXXXXaXXXaXXVAAI Status: nnnn
naa.60060...Device Type: diskSize: 614400 MBDisplay Name: DGC Fibre Channel Disk (naa.60060...)...
IMPORTANTYoucanrunvicfg-scsidevs--queryandvicfg-scsidevs --vmfsagainstESX/ESXiversion3.5.TheotheroptionsaresupportedonlyagainstESX/ESXiversion4.0andlater.
-
vSphere Command-Line Interface Concepts and Examples
42 VMware, Inc.
Listalllogicaldeviceswithabbreviatedinformation.vicfg-scsidevs --compact-list
TheinformationincludesthedeviceID,devicetype,size,plugin,anddevicedisplayname. Listalldeviceuniqueidentifiers.
vicfg-scsidevs --uids
ThecommandliststheprimaryUIDforeachdevice(naa.xxxorotherprimaryname)andanyotherUIDsforeachUID(VMLname).Youcanspecify--devicetoonlylistinformationforaspecificdevice.
Listaspecificlogicaldevicewithitsdetailedinformation.vicfg-scsidevs -l -d mpx.vmhba32:C0:T1:L0
PrintmappingsforVMFSvolumestothecorrespondingpartition,pathtothatpartition,VMFSuuid,extentnumber,andvolumenames.vicfg-scsidevs --vmfs
PrintHBAdeviceswithidentifyinginformation.vicfg-scsidevs --hbas
ThereturnvalueincludestheadapterID,driverID,adapterUID,PCI,vendor,andmodel. PrintamappingbetweenHBAsandthedevicesitprovidespathsto.
vicfg-scsidevs --hba-device-list
Managing PathsTomaintainaconstantconnectionbetweenanESXihostanditsstorage,ESXisupportsmultipathing.WithmultipathingyoucanusemorethanonephysicalpathfortransferringdatabetweentheESXihostandtheexternalstoragedevice.IncaseoffailureofanelementintheSANnetwork,suchasanHBA,switch,orcable,theESXihostcanfailovertoanotherphysicalpath.Onsomedevices,multipathingalsooffersloadbalancing,whichredistributesI/Oloadsbetweenmultiplepathstoreduceoreliminatepotentialbottlenecks.ThestoragearchitectureinvSphere4.0andlatersupportsaspecialVMkernellayer,PluggableStorageArchitecture(PSA).ThePSAisanopenmodularframeworkthatcoordinatesthesimultaneousoperationofmultiplemultipathingplugins(MPPs).YoucanmanagePSAusingESXCLIcommands.SeeManagingThirdPartyStorageArraysonpage 81.ThissectionassumesyouareusingonlyPSApluginsincludedinvSpherebydefault.
Multipathing with Local Storage and FC SANsInasimplemultipathinglocalstoragetopology,youcanuseoneESXihostwithtwoHBAs.TheESXihostconnectstoadualportlocalstoragesystemthroughtwocables.ThisconfigurationensuresfaulttoleranceifoneoftheconnectionelementsbetweentheESXihostandthelocalstoragesystemfails.TosupportpathswitchingwithFCSAN,theESXihosttypicallyhastwoHBAsavailablefromwhichthestoragearraycanbereachedthroughoneormoreswitches.Alternatively,thesetupcanincludeoneHBAandtwostorageprocessorssothattheHBAcanuseadifferentpathtoreachthediskarray.InFigure 44,multiplepathsconnecteachhostwiththestoragedevice.Forexample,ifHBA1orthelinkbetweenHBA1andtheswitchfails,HBA2takesoverandprovidestheconnectionbetweentheserverandtheswitch.TheprocessofoneHBAtakingoverforanotheriscalledHBAfailover.
-
VMware, Inc. 43
Chapter 4 Managing Storage
Figure 4-4. FC Multipathing
IfSP1orthelinkbetweenSP1andtheswitchbreaks,SP2takesoverandprovidestheconnectionbetweentheswitchandthestoragedevice.ThisprocessiscalledSPfailover.ESXimultipathingsupportsHBAandSPfailover.
Afteryouhavesetupyourhardwaretosupportmultipathing,youcanusethevSphereClientorvCLIcommandstolistandmanagepaths.Youcanperformthefollowingtasks. Listpathinformationwithvicfg-mpathoresxcli storage core path.SeeListingPathInformation
onpage 43. Changepathstatewithvicfg-mpathoresxcli storage core path.SeeChangingtheStateofaPath
onpage 45.
ChangepathpolicieswithESXCLI.SeeSettingPolicyDetailsforDevicesthatUseRoundRobinonpage 47.
MaskpathswithESXCLI.SeethevSphereStoragedocumentation. Manipulatetherulesthatmatchpathstomultipathingpluginstonewlydiscovereddeviceswithesxcli
claimrule.SeeManagingClaimRulesonpage 89. Runorrerunclaimrulesorunclaimpaths.SeeManagingClaimRulesonpage 89. Rescanwithvicfg-rescan.SeeScanningStorageAdaptersonpage 52.
Listing Path InformationYoucanlistpathinformationwithESXCLIorwithvicfg-mpath.
Listing Path Information with ESXCLI
Youcanrunesxcli storage core pathtodisplayinformationaboutFibreChanneloriSCSILUNs.
IMPORTANTUseESXCLIforESXi5.0.Usevicfg-mpathforESX/ESXi4.0orlater.Usevicfg-mpath35forESX/ESXi3.5.
SP2
storage array
SP1
switch switch
HBA2 HBA1 HBA3 HBA4
Host 1 Host 2
IMPORTANTUseindustrystandarddevicenames,withformateui.xxxornaa.xxxtoensureconsistency.DonotuseVMLLUNnamesunlessdevicenamesarenotavailable.NamesofvirtualmachineHBAsarenotguaranteedtobevalidacrossreboots.
-
vSphere Command-Line Interface Concepts and Examples
44 VMware, Inc.
Youcandisplayinformationaboutpathsbyrunningesxcli storage core path.SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof. Listalldeviceswiththeircorrespondingpaths,stateofthepath,adaptertype,andotherinformation.
esxcli storage core path list
Limitthedisplaytoonlyaspecifiedpathordevice.esxcli storage core path list --path esxcli storage core path list --device
ListthestatisticsfortheSCSIpathsinthesystem.Youcanlistallpathsorlimitthedisplaytoaspecificpath.esxcli storage core path stats getesxcli storage core path stats get --path
-
VMware, Inc. 45
Chapter 4 Managing Storage
Changing the State of a Path YoucanchangethestateofapathwithESXCLIorwithvicfg-mpath.
Changing Path State with ESXCLI
Youcantemporarilydisablepathsformaintenanceorotherreasons,andenablethepathwhenyouneeditagain.YoucandisablepathswithESXCLI.SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof.Ifyouarechangingapathsstate,thechangeoperationfailsifI/Oisactivewhenthepathsettingischanged.Reissuethecommand.YoumustissueatleastoneI/Ooperationbeforethechangetakeseffect.To disable a path with ESXCLI
1 (Optional)Listalldevicesandcorrespondingpaths.esxcli storage core path list
Thedisplayincludesinformationabouteachpathsstate.2 SetthestateofaLUNpathtooff.
esxcli storage core path set --state off --path vmhba32:C0:T1:L0
Whenyouareready,setthepathstatetoactiveagain.esxcli storage core path set --state active --path vmhba32:C0:T1:L0
Changing Path State with vicfg-mpath
Youcandisablepathswithvicfg-mpath.SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof.Ifyouarechangingapathsstate,thechangeoperationfailsifI/Oisactivewhenthepathsettingischanged.Reissuethecommand.YoumustissueatleastoneI/Ooperationbeforethechangetakeseffect.To disable a path with vicfg-mpath
1 (Optional)Listalldevicesandcorrespondingpaths.vicfg-mpath --list-paths
Thedisplayincludesinformationabouteachpathsstate.2 SetthestateofaLUNpathtooff.
vicfg-mpath --state off --path vmhba32:C0:T1:L0
Whenyouareready,setthepathstatetoactiveagain.vicfg-mpath --state active --path vmhba32:C0:T1:L0
Managing Path PoliciesForeachstoragedevicemanagedbyNMP(notPowerPath),anESXihostusesapathselectionpolicy.IfyouhaveathirdpartyPSPinstalledonyourhost,itspolicyalsoappearsonthelist.Thefollowingpathpoliciesaresupportedbydefault.
-
vSphere Command-Line Interface Concepts and Examples
46 VMware, Inc.
Thetypeofarrayandthepathpolicydeterminethebehaviorofthehost.
Changing Path PoliciesYoucanchangepathpolicieswithESXCLIorwithvicfg-mpath.
Changing Path Policies with ESXCLI
YoucanchangethepathpolicywithESXCLI.SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof.To change the path policy with ESXCLI
1 EnsureyourdeviceisclaimedbytheNMPplugin.OnlyNMPdevicesallowyoutochangethepathpolicy.esxcli storage nmp device list
2 Retrievethelistofpathselectionpoliciesonthesystemtoseewhichvaluesarevalidforthe--pspoptionwhenyousetthepathpolicy.esxcli storage core plugin registration list --plugin-class="PSP"
3 Setthepathpolicyusingesxcli.esxcli storage nmp device set --device naa.xxx --psp VMW_PSP_RR
SeeTable 41,SupportedPathPolicies,onpage 46.
Table 4-1. Supported Path Policies
Policy Description
VMW_PSP_FIXED Thehostusesthedesignatedpreferredpath,ifithasbeenconfigured.Otherwise,thehostselectsthefirstworkingpathdiscoveredatsystemboottime.Ifyouwantthehosttouseaparticularpreferredpath,specifyitthroughthevSphereClientorbyusingesxcli storage nmp psp fixed deviceconfig set.SeeChangingPathPoliciesonpage 46.ThedefaultpolicyforactiveactivestoragedevicesisVMW_PSP_FIXED.Important:VMwaredoesnotrecommendyouuseVMW_PSP_FIXEDfordevicesthathavetheVMW_SATP_ALUAstoragearraytypepolicyassignedtothem.
VMW_PSP_MRU Thehostselectsthepaththatitusedmostrecently.Whenthepathbecomesunavailable,thehostselectsanalternativepath.Thehostdoesnotrevertbacktotheoriginalpathwhenthatpathbecomesavailableagain.ThereisnopreferredpathsettingwiththeMRUpolicy.MRUisthedefaultpolicyforactivepassivestoragedevices.
VMW_PSP_RR Thehostusesanautomaticpathselectionalgorithmthatrotatesthroughallactivepathswhenconnectingtoactivepassivearrays,orthroughallavailablepathswhenconnectingtoactiveactivearrays.Automaticpathselectionimplementsloadbalancingacrossthephysicalpathsavailabletoyourhost.LoadbalancingistheprocessofspreadingI/Orequestsacrossthepaths.ThegoalistooptimizethroughputperformancesuchasI/Oper