Professional Documents
Culture Documents
This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition. To check for more recent editions of this document, see http://www.vmware.com/support/pubs.
EN-000274-00
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: docfeedback@vmware.com
Copyright 20082010 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.
Contents
AboutThisBook
1 InstallingvCLI 11
InstallationOverview 11 InstallingandUninstallingvCLIonLinux 11 InstallationProcess 12 InstallingPrerequisiteSoftwareforRedHatEnterpriseLinux5.2 13 RequiredSoftware 13 RecommendedPerlModules 13 InstallingPrerequisiteSoftwareforSLES10andSLES11 13 RequiredSoftware 13 RecommendedPerlModules 13 InstallingPrerequisiteSoftwareforUbuntuDesktop9.04 13 RequiredSoftware 14 RecommendedPerlModules 14 InstallingthevCLIPackage 14 UninstallingthevCLIPackageonLinux 15 InstallingandUninstallingvCLIonWindows 15 DeployingvMA 17
2 RunningvCLICommands 19
OverviewofRunningCommands 19 SpecifyingAuthenticationInformation 20 OrderofPrecedenceforvCLIAuthentication 20 UsingaSessionFile 20 UsingEnvironmentVariables 21 UsingaConfigurationFile 21 UsingCommandLineOptions 22 UsingMicrosoftWindowsSecuritySupportProviderInterface 22 vCLIandLockdownMode 23 CommonOptionsforvCLIExecution 23 UsingvSphereCLICommandsinScripts 25
3 ManagingHosts 27
Stopping,RebootingandExaminingHostswithvicfghostops 27 EnteringandExitingMaintenanceModewithvicfghostops 28 BackingUpConfigurationInformationwithvicfgcfgbackup 28 BackupTasks 28 BackingUpConfigurationData 29 RestoringConfigurationData 29 UsingvicfgcfgbackupfromvMA 29 ManagingHostUpdateswithvihostupdate 29 DeployingThirdPartyBundles 31 RemovingBulletinsfromaHost 31 ManagingVMkernelModuleswithvicfgmodule 32 UsingvicfgauthconfigforActiveDirectoryConfiguration 32
VMware, Inc.
4 ManagingFiles 35
IntroductiontoVirtualMachineFileManagement 35 ManagingtheVirtualMachineFileSystemwithvmkfstools 36 vmkfstoolsCommandSyntax 36 SupportedCommandSpecificOptions 37 SupportedvmkfstoolTargets 38 vmkfstoolsFileSystemOptions 38 CreatingaVMFSFileSystem 38 ListingVMFSVolumeAttributes 39 ExtendingVMFSPartitionsbySpanning 39 vmkfstoolsVirtualDiskOptions 40 SupportedDiskFormats 40 CreatingVirtualDisks 41 InitializingVirtualDisks 41 InflatingThinVirtualDisks 41 DeletingVirtualDisks 42 RenamingVirtualDisk 42 CloningVirtualorRawDisks 42 MigratingVMwareWorkstationandVMwareGSXServerVirtualMachines 43 ExtendingVirtualDisks 43 DisplayingVirtualDiskGeometry 43 ManagingRawDeviceMappingFiles 44 RDMVirtualandPhysicalCompatibilityModes 44 CreatingVirtualCompatibilityModeRawDeviceMappings 45 CreatingPhysicalCompatibilityModeRawDeviceMappings 45 UsingvifstoManipulateFilesonRemoteESX/ESXiHosts 46
5 ManagingStorage 49
IntroductiontoStorage 49 HowVirtualMachinesAccessStorage 50 Datastores 51 StorageDeviceNaming 51 ExaminingLUNswithvicfgscsidevs 52 TargetandDeviceRepresentation 52 ExaminingLUNs 52 ManagingPathswithvicfgmpath 53 MultipathingwithLocalStorageandFCSANs 53 ListingPathInformation 54 ChangingtheStateofaPath 55 ManagingPathPolicieswithesxcli 55 SettingPolicyDetailsforDevicesthatUseRoundRobin 56 MaskingPathswithesxclicorestorageclaimrule 57 ManagingNFS/NASDatastoreswithvicfgnas 58 CapabilitiesSupportedbyNFS/NAS 58 AddingandDeletingNASFileSystems 59 MigratingVirtualMachineswithsvmotion 59 StorageVMotionUses 59 StorageVMotionRequirementsandLimitations 60 RunningsvmotioninInteractiveMode 60 RunningsvmotioninNoninteractiveMode 60 ManagingDuplicateVMFSDatastoreswithvicfgvolume 61 MountingDatastoreswithExistingSignatures 61 ResignaturingVMFSCopies 62 RescanningStorageAdapterswithvicfgrescan 63
4 VMware, Inc.
Contents
6 ManagingiSCSIStorage 65
iSCSIStorageOverview 65 DiscoverySessions 66 DiscoveryTargetNames 67 ProtectinganiSCSISAN 67 ProtectingTransmittedData 67 SecuringiSCSIPorts 68 SettingiSCSICHAP 68 iSCSIStorageSetup 69 SettingUpSoftwareiSCSI 69 SettingUpDependentHardwareiSCSI 70 SettingUpIndependentHardwareiSCSI 72 vicfgiscsiCommandSyntax 73 ListingandSettingiSCSIOptions 77 ListingandSettingiSCSIParameters 77 ReturningParameterstoDefaultInheritance EnablingiSCSIAuthentication 79 SettingUpPortsforiSCSIMultipathing 80 ManagingiSCSISessions 80 ListingiSCSISessions 80 LoggingintoiSCSISessions 81 RemovingiSCSISessions 81
79
7 ManagingUsers 83
UsersandGroupsinthevSphereEnvironment 83 vicfguserCommandSyntax 83 ManagingUserswithvicfguser 84 ManagingGroupswithvicfguser 86
8 ManagingVirtualMachines 89
vmwarecmdOverview 89 ConnectionOptionsforvmwarecmd 89 GeneralOptionsforvmwarecmd 90 FormatforSpecifyingVirtualMachines 90 ListingandRegisteringVirtualMachines 90 RetrievingVirtualMachineAttributes 91 ManagingSnapshotswithvmwarecmd 92 TakingSnapshots 92 RevertingandRemovingSnapshots 93 PoweringVirtualMachinesOnandOff 93 ConnectingandDisconnectingVirtualDevices 94 RetrievingUserInput 95 ForciblyStoppingVirtualMachines 95
9 ManagingThirdPartyStorageArrayswithesxcli 97
esxcliCommandSyntax 98 ManagingNMPwithesxclinmp 99 DeviceManagementwithesxclinmpdevice esxclinmpdevicelist 99 esxclinmpdevicesetpolicy 99 ListingPathswithesxclinmppath 99 99
VMware, Inc.
Contents
ManagingPathSelectionPolicyPluginswithesxclinmppsp 100 RetrievingPSPInformation 100 SettingConfigurationParametersforThirdPartyExtensions 100 FixedPathSelectionPolicyOperationswithesxclinmpfixed 100 esxclinmpfixedgetpreferred 100 esxclinmpfixedsetpreferred 101 CustomizingRoundRobinSetupwithesxclinmproundrobin 101 esxclinmproundrobingetconfig 101 esxclinmproundrobinsetconfig 101 ManagingSATPswithesxclinmpsatp 102 RetrievingInformationAboutSATPs 102 AddingSATPRules 102 DeletingSATPRules 103 RetrievingandSettingSATPConfigurationParameters 103 SettingtheDefaultPSP 104 PathClaimingwithesxclicorestorageclaiming 104 esxclicorestorageclaimingreclaim 104 esxclicorestorageclaimingunclaim 105 ManagingClaimRuleswithesxclicorestorageclaimrule 106 AddingClaimRuleswithesxclicorestorageclaimruleadd 106 ConvertingESX3.5LUNMaskstoClaimRuleFormat 107 DeletingClaimRuleswithesxclicorestorageclaimruledelete 108 ListingClaimRuleswithesxclicorestorageclaimrulelist 108 LoadingClaimRuleswithesxclicorestorageclaimruleload 108 MovingClaimRuleswithesxclicorestorageclaimrulemove 109 esxclicorestorageclaimrulerun 109
10 ManagingvSphereNetworking 111
IntroductiontovSphereNetworking 111 NetworkingUsingvNetworkStandardSwitches 112 NetworkingUsingvNetworkDistributedSwitches 113 SettingUpvSphereNetworkingwithvNetworkStandardSwitches 113 SettingUpVirtualSwitchesandAssociatingaSwitchwithaNetworkInterface 114 RetrievingInformationaboutVirtualSwitches 114 AddingandDeletingVirtualSwitches 115 SettingSwitchAttributes 115 Checking,Adding,andRemovingPortGroups 115 ConnectingandDisconnectingUplinkAdaptersandPortGroups 115 SettingthePortGroupVLANID 116 LinkingandUnlinkingUplinkAdapters 116 ManagingUplinkAdapterswithvicfgnics 116 AddingandModifyingVMkernelNetworkInterfaceswithvicfgvmknic 117 SettingUpvSphereNetworkingwithvNetworkDistributedSwitch 118 ManagingvNetworkDistributedSwitches 119 ManagingStandardNetworkingServicesinthevSphereEnvironment 119 SettingtheDNSConfiguration 119 AddingandStartinganNTPServer 120 ManagingtheIPGateway 120 UsingvicfgipsecforSecureNetworking 121 UsingIPsecwithESX/ESXi 122 ManagingSecurityAssociationswithvicfgipsec 122 ManagingSecurityPolicieswithvicfgipsec 123
VMware, Inc.
Contents
11 MonitoringESX/ESXiHosts 125
UsingresxtopforPerformanceMonitoring 125 ManagingDiagnosticPartitionswithvicfgdumppart 125 ConfiguringSyslogonESXiHosts 126 ManagingESX/ESXiSNMPAgentswithvicfgsnmp 127 ConfiguringSNMPCommunities 127 ConfiguringtheSNMPAgenttoSendTraps 128 ConfiguringtheSNMPAgentforPolling 128 ESX,ESXi,andVirtualMachineLogs 129 EnablingandDisablingCIMProviders 129
12 vSphereCLICommandOverviews 131
ListofAvailableCommands 131 SupportedPlatformsforCommands 133 CommandswithanesxcfgPrefix 135 esxcliCommandOverview 136 Helpforesxcli 137 esxclicorestorageNamespace 137 claimingCommands 137 claimruleCommands 138 deviceCommands 138 plugincommands 139 esxclinetworkNamespace 139 connectionslistCommand 139 neighborsshowCommand 139 esxclinmpNamespace 139 bootrestoreCommand 139 deviceCommands 140 fixedCommands 140 pathCommands 140 pspCommands 140 roundrobinCommands 141 satpCommands 141 esxcliswiscsiNamespace 141 nicCommands 141 sessionCommands 142 vmknicCommands 142 vmnicCommands 142 esxclivaaiNamespace 143 devicelistCommand 143 esxclivmsNamespace 143 vmCommands 143
VMware, Inc.
VMware, Inc.
Intended Audience
ThisbookisforexperiencedWindowsorLinuxsystemadministratorswhoarefamiliarwithvSphere administrationtasksanddatacenteroperationsandknowhowtousecommandsinscripts.
Document Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhavecomments,sendyour feedbacktodocfeedback@vmware.com.
Related Documentation
ThevSphereCommandLineInterfaceReference,whichisthecompaniondocumenttothisguide,isavailableon thevSphereCLIdocumentationpage. ThevSphereSDKforPerldocumentationexplainshowyoucanusethevSphereSDKforPerlandrelated utilityapplicationstomanageyourvSphereenvironment.Thedocumentationincludesinformationaboutthe vSphereSDKforPerlUtilityApplications. ThevSphereManagementAssistantGuideexplainshowtoinstallandusethevSphereManagementAssistant (vMA).vMAisavirtualmachinethatincludesthevCLIandotherprepackagedsoftware.SeeDeploying vMAonpage 17. BackgroundinformationforthetasksdiscussedinthismanualisavailableinthevSpheredocumentationset. ThevSpheredocumentationconsistsofthecombinedVMwarevCenterServerandESX/ESXidocumentation andincludesconfigurationguides,administratorsguides,guidesforstoragesetup,andmore.
VMware, Inc.
Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto http://www.vmware.com/support/services.
10
VMware, Inc.
Installing vCLI
Installation Overview
ThevCLIinstalleralsoinstallsvSphereSDKforPerlbecausevCLIcommandsrunontopofthevSphereSDK forPerl.OnWindows,theinstallationpackageincludesvCLI,vSphereSDKforPerl,andprerequisite software.OnLinux,theinstallationpackageincludesvCLIandvSphereSDKforPerl.Youareresponsiblefor installingrequiredprerequisitesoftware.
VMware, Inc.
11
Installation Process
ThevCLIpackageinstallerinstallsthevCLIscriptsandthevSphereSDKforPerl.Duringinstallation,the installercheckswhetherprerequisitesareinstalled.Dependingonthetypeofprerequisitethatismissing,the installereitherstopstheinstallationprocessorcontinues,asfollows. 1 Theinstallercheckswhetherthefollowingrequiredprerequisitepackagesareinstalledonthesystem:
OpenSSL ThevCLIrequiresSSLbecausemostconnectionsbetweenthesystemonwhichyourunthecommand andthetargetvSpheresystemareencryptedwithSSL. TheOpenSSLlibrary(libssl-devpackage)isnotincludedinthedefaultLinuxdistribution. Installationinstructionsforeachplatformareincludedbelow. LibXML2 UsedforXMLparsing. Thelibxml2packageisnotincludedinthedefaultLinuxdistribution.Installationinstructionsfor eachplatformareincludedbelow. e2fsprogs Utilitiesformaintainingtheext2,ext3andext4filesystems.RequiredbytheUUIDPerlmodule.
2 3
CryptSSLeay0.55(0.550.9.7or0.550.9.8) IOCompressBase2.005 CompressZlib2.005 IOCompressZlib2.005 CompressRawZlib2.017 ArchiveZip1.26 DataDumper2.121 XMLLibXML1.63 libwwwperl5.805 XMLLibXMLCommon0.13 XMLNamespaceSupport1.09 XMLSAX0.16 DataDump1.15 URI1.37 UUID0.03 SOAPLite0.710.08 HTMLParser3.60 version0.78
IMPORTANTTheinstallerdoesnotoverwriteexistingversionsofrecommendedPerlmodules.Youmust explicitlyupdatethosemodulesyourself.
12
VMware, Inc.
Required Software
Ifrequiredsoftwareisnotinstalled,thevCLIinstallerstops.Youcaninstallprerequisitesusingyum,theRHEL packageinstaller(recommended),orfromtheinstallationDVD. Forexample,ifbothOpenSSLdevelopmentlibrariesandLibXML2aremissing,typethefollowingata commandprompt:
yum install openssl-devel libxml2-dev
Required Software
Ifrequiredsoftwareisnotinstalled,thevCLIinstallerstops.Youcaninstalltheprerequisitepackagesfromthe SLES10orSLES11SDKDVD.WhenyouinserttheDVD,itofferstoautorun.Canceltheautorundialogbox anduserpmortheyastpackageinstallertoinstallOpenSSLorothermissingrequiredpackages. Forexample,ifOpenSSLdevelopmentlibrariesaremissing,typethefollowingatacommandprompt:
yast -i openssl-devel
SomeusersmightbeauthorizedtousetheNovellCustomerCenteranduseyasttoretrievemissingpackages fromthere.
VMware, Inc.
13
Required Software
Ifrequiredsoftwareisnotinstalled,thevCLIinstallerstops.OnUbuntuyoucanuseapt(advancedpackaging tool)tokeepalocalrepositoryoflibrariesuptodate.Youcanuseapttoinstalltherequiredsoftware. To install required software on Ubuntu Desktop 9.04 1 2 ConnecttotheInternet. Updatethelocalrepositoryoflibrariesfromaterminalwindow.
sudo apt-get update
Installtherequiredlibrariesfromaterminalwindow.ForUbuntuDesktop9.0464bit,youmustinstall the32bitcompatibilitylibrariesortheresxtopandesxclicommandsdonotwork. 32bit 64bit sudo apt-get install libssl-dev perl-doc liburi-perl libxml-libxml-perl libcrypt-ssleay-perl sudo apt-get install libssl-dev perl-doc liburi-perl libxml-libxml-perl libcrypt-ssleay-perl ia32-libs
DeleteexistingversionsofvSphere-CLI.xxxx.tar.gzanddeletethevmware-vsphere-cli-distrib directory.
Avmware-vsphere-vcli-distribdirectoryiscreated. 2 Loginassuperuserandruntheinstaller:
/<location>/sudo vmware-vsphere-cli-distrib/vmware-install.pl
3 4
14
VMware, Inc.
Ifyouacceptedthedefaultsduringinstallation,youcanfindtheinstalledsoftwareinthefollowinglocations:
SeethevSphereSDKforPerldocumentationforareferencetoallutilityapplications. AfteryouinstallthevCLI,youcantesttheinstallationbyrunningacommandfromtheWindowscommand prompt. To run a vCLI command on Linux 1 2 3 Openacommandprompt. ChangetothedirectorywhereyouinstalledthevCLI(defaultis/usr/bin). Runthecommand,includingtheconnectionoptions.
<command> <conn_options> <params>
VMware, Inc.
15
To install the vCLI Package on Windows 1 DownloadthevCLIWindowsinstallerpackage. YoucanfindtheinstallerontheVMwareCommunitiespage. 2 3 Starttheinstaller. (Optional)IfpromptedtoremoveolderversionsofvSphereSDKforPerlorvCLI,youcaneitheraccept orinstallthevCLIpackageonadifferentsystem. IMPORTANTTheinstallerreplacesboththevSphereSDKforPerlandthevCLI.Tokeepanolderversion, installthispackageonadifferentsystem. 4 5 ClickNextintheWelcomepage. ToinstallthevCLIinanondefaultdirectory,clickChangeandselectthedirectory. ThedefaultlocationisC:\Program Files\VMware\VMware vCLI. 6 7 ClickNext. ClickInstalltoproceedwiththeinstallation. Theinstallationmighttakeseveralminutestocomplete. 8 Rebootyoursystem. Withoutreboot,pathsettingsmightnotbecorrectonyourWindowsplatform. AfteryouinstallthevCLIandrebootyoursystem,youcantesttheinstallationbyrunningacommandfrom theWindowscommandprompt. To run a vCLI command on Windows 1 2 Openacommandprompt. NavigatetothedirectoryinwhichthevCLIisinstalled.
cd C:\Program Files\VMware\VMware vSphere CLI\bin
Runthecommand,passinginconnectionoptionsandotheroptions. OnWindows,theextension.plisrequiredformostcommands,butnotforesxcli.
<command>.pl <conn_options> <params>
Forexample:
vicfg-nas.pl --server my_esxhost --list
Thesystempromptsyouforausernameandpassword. SeeTable 22,vCLIConnectionOptions,onpage 23foracompletelistofconnectionoptions. YoucanuninstallthevCLIpackageasyouwouldotherprograms. To uninstall the vCLI on Windows 1 2 3 FindtheoptionforaddingandremovingprogramsontheWindowsoperatingsystemyouareusing. Inthepanelthatappears,selectvSphereCLI,andclickRemove. ClickYeswhenprompted.
ThesystemuninstallsthevSphereSDKforPerl,thevCLI,andallprerequisitesoftware.
16
VMware, Inc.
Deploying vMA
Asanalternativetoapackageinstallation,youcandeployvMAonanESX/ESXihostandrunvCLIcommands fromthere.vMAisavirtualmachineyoucanusetorunscriptstomanageESX/ESXisystems.vMAincludes aLinuxenvironment,vCLI,andotherprepackagedsoftware. SettingupvMAconsistsofafewtasks.ThevSphereManagementAssistantGuidediscusseseachtaskindetail. 1 DeployvMAtoanESX/ESXisystemthatmeetsthehardwareprerequisites. SeethevSphereManagementAssistantGuideforprerequisitesanddeploymentdetails. 2 ConfigurevMA. WhenyoubootvMA,youmustspecifythefollowingrequiredconfigurationinformationwhen prompted:
VMware, Inc.
17
18
VMware, Inc.
VMware, Inc.
19
Followoneofthefollowingapproachesforprotectingpasswords.
IfyouarerunningvMA,youcansetuptargetserversandrunmostvCLIcommandsagainsttargetservers withoutadditionalauthentication.SeethevSphereManagementAssistantGuide.
20
VMware, Inc.
Ifyouspecifyaserver,butnousernameorpassword,thescriptpromptsyou. 3 WhenyourunvCLIcommands,passinthesessionfileusingthe--sessionfileoption.
<command> --sessionfile <sessionfile_location> <command_options>
PassintheconfigurationfilewhenyourunvCLIcommands,asfollows:
<command> --config <my_saved_config> <option>
VMware, Inc.
21
Forexample:
vicfg-mpath --config <my_saved_config> --list
Ifyouhavesetupyoursystemtorunthisfile,youcanrunscriptsonthespecifiedserverafterwards.
Someoptions,suchas--help,havenovalue. IMPORTANTEnclosepasswordsandothertextwithspecialcharactersinquotationmarks. OnLinux,usesinglequotes( ),onWindows,usedoublequotes( ).OnLinux,youcanalsouseabackslash (\)asanescapecharacter. Thefollowingexamplesconnecttotheserverasusersnow-whitewithpassworddwarf$.Thesystem displayshelpinformationforthecommandbecausethecommandiscalledwithnooptions. Thefirstexample(Linux)usesthebackslash(\)escapecharacter,theothertwousesinglequotes(Linux)and doublequotes(Windows). Linux
vicfg-mpath --server <server> --username snow\-white --password dwarf\$ vicfg-mpath --server <server> --username snow-white --password dwarf$
Windows
vicfg-mpath.pl --server <server> --username snow-white --password dwarf$
22
VMware, Inc.
ConnectstoaserverthathasbeensetuptouseSSPI.Whenatrusteduserrunsthecommand,thesystemcalls vicfg-mpathwiththe--listoption.Thesystemdoesnotpromptforausernameandpassword.
VMware, Inc.
23
Usetheemptystring(' 'onLinuxand onWindows)toindicateno password. Ifyoudonotspecifyausernameandpasswordonthecommandline,the systempromptsyouanddoesnotechoyourinputtothescreen. --portnumber <number> VI_PORTNUMBER=<number> --protocol <HTTP|HTTPS> VI_PROTOCOL=<HTTP|HTTPS> --savesessionfile <file> VI_SAVESESSIONFILE=<file> --server <server> VI_SERVER=<server> Usesthespecifiedporttoconnecttothesystemspecifiedby--server. Defaultis443. Usesthespecifiedprotocoltoconnecttothesystemspecifiedby--server. DefaultisHTTPS. Savesasessiontothespecifiedfile.Thesessionexpiresifithasbeenunused for30minutes. UsesthespecifiedESX/ESXiorvCenterServersystem.Defaultislocalhost. If--serverpointstoavCenterServersystem,youusethe--vihostoption tospecifytheESX/ESXihostonwhichyouwanttorunthecommand.A commandissupportedforvCenterServerifthe--vihostoptionisdefined. UsesthespecifiedservicepathtoconnecttotheESX/ESXihost.Defaultis /sdk/webService. Usesthespecifiedsessionfiletoloadapreviouslysavedsession.Thesession mustbeunexpired. ConnectstothespecifiedvSphereWebServicesSDKURL.
24
VMware, Inc.
Ifyoudonotspecifyausernameandpasswordonthecommandline,the systempromptsyouanddoesnotechoyourinputtothescreen. --vihost <host> -h <host WhenyourunavSphereCLIcommandwiththe--serveroptionpointing toavCenterServersystem,use--vihosttospecifytheESX/ESXihosttorun thecommandagainst. NOTE:Thisoptionisnotsupportedforeachcommand.Ifsupported,the optionisincludedintheindividualcommandoptionlist.
ThescriptitselfaddstheNASdatastorebycallingthedifferentconfigurationfiles.
#!bin/sh for i in {"esxi_server_a","esx_server_b","esxi_server_c"} do echo "Adding NAS datastore for $i..." vicfg-nas --config /home/admin/.visdkrc.$i -a -o mainnas.x.com -s /shared nas_ds vicfg-nas --config /home/admin/.visdkrc.$i -l done
VMware, Inc.
25
26
VMware, Inc.
Managing Hosts
SinglehostRunvicfg-hostopswith--operationshutdown.
Ifthehostisinmaintenancemode,runthecommandwithoutthe--forceoption.
vicfg-hostops <conn_options> --operation shutdown
Ifthehostisnotinmaintenancemode,use--forcetoshutdownthehostandallrunningvirtual machines.
vicfg-hostops <conn_options> --operation shutdown --force
MultiplehostsToshutdownallhostsinaclusterordatacenter,specify--clusteror--datacenter.
vicfg-hostops <conn_options> --operation shutdown --cluster <my_cluster> vicfg-hostops <conn_options> --operation shutdown --datacenter <my_datacenter>
Youcanrebootasinglehostorallhostsinadatacenterorcluster.
SinglehostRunvicfg-hostopswith--operationreboot.
Ifthehostisinmaintenancemode,runthecommandwithoutthe--forceoption.
vicfg-hostops <conn_options> --operation reboot
Ifthehostisnotinmaintenancemode,use--forcetoshutdownthehostandallrunningvirtual machines.
vicfg-hostops <conn_options> --operation reboot --force
VMware, Inc.
27
MultiplehostsYoucanspecify--clusteror--datacentertorebootallhostsinaclusteror datacenter.
vicfg-hostops <conn_options> --operation reboot --cluster <my_cluster> vicfg-hostops <conn_options> --operation reboot --datacenter <my_datacenter>
Youcandisplayinformationaboutahostbyrunningvicfg-hostopswith--operationinformation.
vicfg-hostops <conn_options> --operation info
Backup Tasks
Duringaconfigurationbackup,theserialnumberisbackedupwiththeconfiguration.Thenumberisrestored whenyourestoretheconfiguration.ThenumberisnotpreservedwhenyouruntheRecoveryCD(ESXi Embedded)orperformarepairoperation(ESXiInstallable). Thefollowingtasksarerequired(SeetheESXiInstallableandvCenterServerSetupGuide): 1 2 3 Backuptheconfigurationbyusingthevicfg-cfgbackupcommand. RuntheRecoveryCDorrepairoperation Restoretheconfigurationbyusingthevicfg-cfgbackupcommand.
Whenyourestoreaconfiguration,youmustmakesurethatallvirtualmachinesonthehostarestopped.
28
VMware, Inc.
Ifyourunthefollowingcommand,youarepromptedforconfirmation.
vicfg-cfgbackup <conn_options> -l /tmp/ESX_181842_backup.txt
Ifyourunthefollowingcommand,youarenotpromptedforconfirmation.
vicfg-cfgbackup <conn_options> -l /tmp/ESX_181842_backup.txt -q
Torestorethehosttofactorysettings,runvicfg-cfgbackupwiththe-roption:
vicfg-cfgbackup <conn_options> -r
VMware, Inc.
29
TheVIBisincludedinthesecondbulletin. TheVIBisobsoletedbyanotherVIBinthesecondbulletin.
Towardstheendofareleasecycle,bulletinsincludealargenumberofotherbulletins. Bulletinsarepackagedasbundlesoravailableindepotswithassociatedmetadata.zipfiles.
Thevihostupdate commandsupportsqueryingsoftwareinstalledonahost,listingsoftwareinapatch, scanningforbulletinsthatapplytoahost,andinstallingallorselectivebulletinsinthepatch.SeethevSphere CommandLineInterfaceReferenceforinformationonallsupportedoptions.Youcanspecifyapatchbyusinga bundleZIPfileorthemetadataZIPfilethatdescribesthelocationofadepot.Thedepotcanbeontheremote server,oryoucandownloadabundleZIPfileandusealocaldepot. vihostupdatesupportshttps://,http://,andftp://downloads.Youcanspecifytheprotocolsinthedownload URLforthebundleormetadatafile.Youcanspecifymorethanonebundlefileatthecommandlineeachtime yourunthecommand.MultiplebundlesareusuallyrequiredonlyiftheupdateincludesbothaVMware bundleandathirdpartybundle. SeetheESXiUpgradeGuide.Formoreinformationaboutinstallation,removal,andupdateof3rdParty ExtensionsinvSphere4.x,seetheESXiSetupGuideandDeployingThirdPartyBundlesonpage 31. To update a host using bundles 1 PoweroffallvirtualmachinesrunningontheESX/ESXihostbyrunningthefollowingcommandforeach virtualmachine.
vmware-cmd <conn_options> <vm-path> stop <powerop_mode>
Checkthatthehostisinmaintenancemode.Ifnecessary,shutdownormigratevirtualmachines.
vicfg-hostops <conn_options> --operation info
Findoutwhichbulletinsareinstalledonthehost.
vihostupdate <conn_options> --query
Findoutwhichbulletinsareavailableinthebundle.
vihostupdate <conn_options> --list --bundle http://<webserver>/rollup.zip
Findoutwhichbulletinsinthebundleareapplicabletoyourhost.
vihostupdate <conn_options> --scan --bundle http://<webserver>/rollup.zip
Installallorsomebulletinsfromthebundleonthehost.ThefollowingexampleinstallsbothVMware bulletinsandbulletinsmadeavailablebyapartner.
vihostupdate <conn_options> --install --bundle http://<server>/rollup.zip,http://<server>/rollupPartner1.zip
VerifythatthebulletinsareinstalledonyourESX/ESXihost.
vihostupdate <conn_options> --query
30
VMware, Inc.
Checkthatthehostisinmaintenancemode.Ifnecessary,shutdownormigratevirtualmachines.
vicfg-hostops <conn_options> --operation info
Listallbulletinsinthedepotgiventhemetadata.zipfilelocation.
vihostupdate <conn_options> --list --metadata http://<webserver>/depot/metadata.zip
Scanthedepotforbulletinsthatareapplicabletothehost.
vihostupdate <conn_options> --scan --metadata http://<webserver>/depot/metadata.zip
Installbulletinsinthedepotonthehost.
Toinstallallbulletins,runthefollowingcommand.
vihostupdate <conn_options> --install --metadata http://<webserver>/depot/metadata.zip
Toinstallselectedbulletinsinthespecifieddepotonthehost,useacommaseparatedlist.Spaces afterthecommaarenotsupported.
vihostupdate <conn_options> --install --metadata http://<webserver>/depot/metadata.zip --bulletin bulletin1,bulletin3
Checkthatthehostisinmaintenancemode.Ifnecessary,shutdownormigratevirtualmachines.
vicfg-hostops <conn_options> --operation info
Installthebundle.
vihostupdate <conn_options> --install --bundle https://<3rdParty_webserver>/Cisco_Swordfish.zip
VMware, Inc.
31
Placethehostintomaintenancemode.
vicfg-hostops <conn_options> --operation enter
Checkthatthehostisinmaintenancemode,andshutdownormigratevirtualmachinesifnecessary.
vicfg-hostops <conn_options> --operation info
DeterminewhichbulletinsareinstalledonyourESX/ESXihost.
vihostupdate <conn_options> --query
NotethebulletinIDforthebulletintouninstall. 5 Runthevihostupdatecommand,specifyingthebulletintoremove.
vihostupdate <conn_options> --remove --bulletin bulletin1
vihostupdatecanremoveonlyonebulletinatatime.
VerifiesthattheNetQueuemoduleisconfigured.
32
VMware, Inc.
Youcannowrunvicfg-authconfigtoaddthehosttothedomain.Auserwhorunsvicfg-authconfigto configureActiveDirectorysettingsmusthavetheappropriateActiveDirectorypermissions,andmusthave administrativeprivilegesontheESX/ESXihost. To set up Active Directory 1 2 3 4 InstalltheESX/ESXihost,asexplainedintheInstallationGuide. InstallWindowsActiveDirectoryonaWindowsServerrunningWindows2000,Windows2003,or Windows2008. SynchronizetimebetweentheESX/ESXisystemandWindowsActiveDirectory(AD)andmakesurethe WindowsADServerandESX/ESXisystemareinthesametimezone. TestthattheWindowsADServercanpingtheESX/ESXihostusingthehostname.
ping <ESX_hostname>
Makesurethe/etc/resolv.conffileontheESX/ESXihostcontainsthefollowingstring:
nameserver <Windows AD IP Address> search <Domain Name of Windows AD>
RunthefollowingvCLIcommand:
vicfg-authconfig --server=<ESX Server IP Address> --username=<ESX Server Admin Username> --password=<ESX Server Admin User's Password> --authscheme AD --joindomain <AD Domain Name> --adusername=<Active Directory Administrator User Name> --adpassword=<Active Directory Administrator User's Password>
SeethevSphereCommandLineInterfaceReferenceforalistofoptionsandexamples.
VMware, Inc.
33
34
VMware, Inc.
Managing Files
VMware, Inc.
35
local ethernet SCSI bre channel HBA SAN iSCSI hardware initiator LAN software initiator ethernet NIC LAN ethernet NIC LAN
VMFS
Key
physical disk
datastore VMFS fibre array VMFS iSCSI array NFS NAS appliance
virtual disk
36
VMware, Inc.
Youcanusevmkfstoolsvirtualdiskoptionstocreate,clone,manipulate,anddeletevirtualdisksandto manageRDMs(RawDeviceMappings).Table 42givesanoverview. Table 4-2. vmkfstools Virtual Disk Option Overview
Option --adaptertype -a --clonevirtualdisk -i --createrdm -r --createrdmpassthru -z --createvirtualdisk -c --deletevirtualdisk -U --diskformat -d --extendvirtualdisk -X --geometry -g --inflatedisk -j Description Usesthespecifiedtypefordisk creation.Usedwith-cand-i. Clonesthespecifiedvirtualdisk. MapsarawdisktoafileonaVMFSfile system. Mapsapassthroughrawdisktoafile onaVMFSfilesystem. Createsavirtualdisk. Deletesthespecifiedvirtualdisk. Usesthespecifiedformatfordisk creation.Usedwith-cand-i. Extendsthespecifiedvirtualdisk. Displaysvirtualdiskgeometry. Convertsathinvirtualdiskto eagerzeroedthickformat,preserving allexistingdata. See CreatingVirtualDisksonpage 41. CloningVirtualorRawDisksonpage 42. CreatingVirtualCompatibilityModeRaw DeviceMappingsonpage 45. CreatingPhysicalCompatibilityModeRaw DeviceMappingsonpage 45. CreatingVirtualDisksonpage 41. DeletingVirtualDisksonpage 42. SupportedDiskFormatsonpage 40. ExtendingVirtualDisksonpage 43. DisplayingVirtualDiskGeometryonpage 43. InflatingThinVirtualDisksonpage 41.
VMware, Inc.
37
Youmustuseanabsolutepathnamestartingwith/vmfs/volumes.For example,/vmfs/volumes/datastore1/rh9.vmdk SeevmkfstoolsFileSystemOptionsonpage 38. Disk Partition Target Specifyadiskpartitionusingnaa.<naa_ID>:P,wherenaa.<naa_ID>isthedeviceIDreturnedbythe storagearrayandPisanintegerthatrepresentsthepartitionnumber.Thepartitiondigitmustbegreaterthan zeroandmustcorrespondtoavalidVMFSpartitionoftypefb. SeevmkfstoolsVirtualDiskOptionsonpage 40. Device Target SpecifyadeviceorlogicalvolumeusingapathnameinanESX/ESXidevicefilesystem.Thenamebeginswith /vmfs/devices,whichisthemountpointofthedevicefilesystem.Eachdevicetypehassubmounts,for example:
/vmfs/devices/disks /vmfs/devices/lvm /vmfs/devices/generic
IMPORTANTWhenyourunthiscommand,youarenotpromptedforconfirmation.Checkcarefullybefore yourunthecommandtoavoiderasingimportantdata.
38
VMware, Inc.
CreateaVMFS3filesystemnamedmy_vmfswithblocksize2MB.
vmkfstools <conn_options> -C vmfs3 -b 2m -S my_vmfs -vml.<vml_ID>:1
CreateaVMFS3filesystemnamedmy_vmfsandusethedefaultblocksize(1MB).
vmkfstools <conn_options> --createfs vmfs3 --setfsname my_n /vmfs/devices/disks/naa.<naa_id>:1
IfanydevicethatisbackingaVMFSfilesystemgoesoffline,thenumberofextentsandtheavailablespace changeaccordingly.
VMware, Inc.
39
thin
With -c --createvirtualdisk,vmkfstoolsacceptszeroedthick,eagerzeroedthick,andthin. With-i clonevirtualdisk,vmkfstoolsacceptszeroedthick,thin,eagerzeroedthick, rdm:<device>,rdmp:<device>,and2gbsparse. WithNFSfiles,vmkfstoolssupportsonlythin,zeroedthick,and2gbsparse.BecausetheNFSserverand nottheESX/ESXisystemdecidestheallocationpolicy,zeroedthick,andthinusuallyhavethesameresult. ThedefaultallocationpolicyonmostNFSserversisthin. IMPORTANTIfyourunvCLI4.xagainstvCLI4.xsystems,formatsaresupportedaslisted.Supportislimited ifyourunvCLI4.xagainstvCLI3.5systems.
40
VMware, Inc.
Whenyoucreateavirtualdisk,youcanusethedefaultfileformatandadapterorspecifythemexplicitly.
Runvmkfstools -candspecifythesizeandfullpathforthevirtualdisk.Forexample:
vmkfstools <conn_options> -c 2g /vmfs/volumes/my_vmfs/myOS.vmdk
CreatesatwogigabytevirtualdiskfilenamedmyOS.vmdkontheVMFSfilesystemnamedmy_vmfs.This filerepresentsanemptyvirtualdiskthatavirtualmachinecanaccess.
Specifyafileformatandadapterforthevirtualdisk.Youchangethedefaultadapterassociatedwiththe virtualmachine(buslogic),usingthe-aoption.Choicesarelsilogicoride.
vmkfstools <conn_options> --createvirtualdisk 20m -d thin -a lsilogic /vmfs/volumes/M1/test.vmdk
Youcanrunvmkfstoolswiththe--writezerosoptiontoinitializeavirtualdisk.
vmkfstools <conn_options> --writezeros /vmfs/volumes/my_vmfs/text02.vmdk
VMware, Inc.
41
The-joptionconvertsathinvirtualdisktoeagerzeroedthickformatandpreservesallexistingdata. vmkfstoolsallocatesandzeroesoutanyblocksthatwerenotallocated.
-j --inflatedisk
Youcaninflateavirtualdiskbyrunningvmkfstoolswithconnectionoptionsandthe--inflatedisk option.
vmkfstools <conn_options> --inflatedisk /vmfs/volumes/myvmfs/thin.vmdk
Youcandeleteavirtualdiskbyrunningvmkfstoolswithconnectionoptions,the-Uoption,andthenameof thevirtualdisktobedeleted.
vmkfstools <conn_options> -U /vmfs/volumes/store/test.vmdk
The--diskformatoptionspecifiesthediskformatforthecopy.diskformatdefaultstozeroedthickifnot specified.adaptertypedefaultstobuslogicifnotspecified.SeeSupportedDiskFormatsonpage 40. IMPORTANTTomakeacopyoftheredologsofanESX/ESXihostwhilepreservingtheirhierarchy,usethe vifs -ccommandinstead. To clone a virtual or raw disk 1 2 Stopthesourcevirtualmachine. Runvmkfstools -i,specifyingthesourceandtargetandoptionaldiskformatandadaptertype.For example:
vmkfstools <conn_options> -i /vmfs/volumes/templates/gold-master.vmdk /vmfs/volumes/myVMFS/myOS.vmdk -d thin -a lsilogic
42
VMware, Inc.
Youmustpoweroffthevirtualmachinethatusesthisdiskfilebeforeyouenterthiscommand.Youmighthave toupdatethefilesystemonthedisksothattheguestoperatingsystemcanrecognizeandusethenewsizeof thediskandtakeadvantageoftheextraspace. IMPORTANTnewSizedefinestheentirenewsize,notjusttheincrementthatyouaddtothedisk. YouspecifythenewSizeoptioninkilobytes,megabytes,orgigabytesbyaddingasuffixofkorK(kilobytes), m orM(megabytes),orgorG(gigabytes).Ifyoudonotspecifyaunittype,vmkfstoolsdefaultstokilobytes. Donotextendthebasediskofavirtualmachinethathassnapshotsassociatedwithit.Ifyoudo,youcanno longercommitthesnapshotorrevertthebasedisktoitsoriginalsize. Bydefault,anydisk,regardlessofformat,isextendedaszeroedthick.Youcanspecify-d eagerzeroedthicktochangetheformattoeagerzeroedthick.Extendvirtualdiskstoeagerzeroedthick onlyiftheyareusedforfaulttoleranceandclusteringandhavetobepreallocatedandzeroed.-dallowsonly eagerzeroedthick,itdoesnotallowotherdiskformats. To extend a virtual disk 1 Shutdownthevirtualmachineassociatedwiththedisk,eitherbyusingthevSphereClientorbyusing vmware-cmd(seeManagingVirtualMachinesonpage 89).
vmware-cmd -H <vc_system> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx stop <powerop_mode>
VMware, Inc.
43
Invirtualcompatibilitymode,themappeddeviceappearstotheguestoperatingsystemexactlythesame asavirtualdiskfileinaVMFSvolume.Theactualhardwarecharacteristicsarehidden.Ifyouusearaw diskinvirtualmode,youcanrealizethebenefitsofVMFSsuchasadvancedfilelockingfordata protectionandsnapshotsforstreamliningdevelopmentprocesses.Virtualmodeisalsomoreportable acrossstoragehardwarethanphysicalmode.Avirtualmodemappeddevicepresentsthesamebehavior asavirtualdiskfile. Inphysicalcompatibilitymode,theVMkernelpassesallSCSIcommandstothedevice,withone exception:theREPORTLUNscommandisvirtualizedsothattheVMkernelcanisolatetheLUNforthe owningvirtualmachine.Otherwise,allphysicalcharacteristicsoftheunderlyinghardwareareexposed. PhysicalmodeisusefultorunSANmanagementagentsorotherSCSItargetbasedsoftwareinthevirtual machine.Physicalmodealsoallowsvirtualtophysicalclusteringforcosteffectivehighavailability.
virtual mode
virtualization VMFS
physical mode
mapped device
mapped device
44
VMware, Inc.
Whenyouspecifynaa.<naa_id>,theentirerawdiskisused.Usethefollowingformat:
/vmfs/devices/disks/naa.<naa_id>
Afterthismappingisestablished,youcanaccesstherawdiskasyouwouldanormalVMFSvirtualdisk.The filelengthofthemappingisthesameasthesizeoftherawdiskitpointsto. To create and use a virtual compatibility mode RDM 1 Runvmkfstools -r withconnectionoptions,thedevicetomapasarawdisk,andthenameoftheRDM file.
vmkfstools <conn_options> -r /vmfs/devices/disks/naa.<naa_id> /vmfs/volumes/storage1/rdm210.vmdk
VMware, Inc.
45
Host.Hostconfigurationfiles.Youmustspecifythefilesuniquenameidentifier. Specifyhostlocationsusingthehost/<path>syntax.
Temp.The/tmpdirectoryandfilesinthatdirectory. Specifytemplocationsusingthetmp/dir/subdirsyntax.
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=<name>.Forexample:
'/folder/testvms/VM1/VM1.vmx?dsName=myStorage1' (Linux) "/folder/testvms/VM1/VM1.vmx?dsName=myStorage1" (Windows)
ThetwoexamplepathsrefertoavirtualmachineconfigurationfileforthevirtualmachineVM1inthe testvms/VM1directoryofthemyStorage1datastore. Toavoidproblemswithdirectorynamesthatusespecialcharactersorspaces,enclosethepathinquotesfor bothoperatingsystems. Whenyourunvifs,youcanspecifytheoperationnameandargumentandoneofthestandardconnection optionsdiscussedinTable 22.Usealiases,symboliclinks,orwrapperscriptstosimplifytheinvocation syntax. IMPORTANTTheconceptsofworkingdirectoryandlastdirectoryorfileoperatedonarenotavailablewith vifs. Options vifscommandspecificoptionsallowyoutoretrieveanduploadfilesfromtheremotehostandperforma numberofotheroperations.Allvifsoptionsworkondatastorefilesordirectories.Someoptionsalsowork onhostfilesandfilesinthetempdirectory.Youmustalsospecifyconnectionoptions.SeevCLIConnection Optionsonpage 23.
46
VMware, Inc.
Liststhecontentsofadatastoredirectory. Overwritesthedestinationfile.Usedwith --moveand--copy. DownloadsafilefromtheESX/ESXihostto themachineonwhichyourunvCLI.This operationusesHTTP GET. Liststhedatacenterpathsavailableonan ESX/ESXisystem. ListsthedatastorenamesontheESX/ESXi system.Whenmultipledatacentersare available,usethe--dc (-Z)argumentto specifythenameofthedatacenterfromwhich youwanttolistthedatastore. Createsadirectoryinadatastore.This operationfailsiftheparentdirectoryof dst_datastore_file_pathdoesnotexist. Movesafileinadatastoretoanotherlocation inadatastore.The<source>mustbearemote sourcepath,the<target>aremotetarget pathordirectory. The--forceoptionreplacesexisting destinationfiles.
dir datastore_directory_path copy src_file_path dst_file_path [force] get src_dstore_file_path dst_local_file_path get src_d store_dir_path dst_local_file_path
--listdc -C --listds -S
mkdir dst_directory_path
Youcanlistinformationabouttheremotedirectoriesinseveralways.
Listthecurrentdatastores.
vifs <conn_options> --listds.
Thecommandliststhenamesofalldatastoresonthespecifiedserver.Forexample:
osdc-cx700-02 osdc-cx700-03 osdc-cx700-02 osdc-cx700-03 osdc-cx700-04 osdc-cx700-05
Youcanuseeachnamethathasbeenreturnedtorefertodatastorepathsusingsquarebracketnotation, asfollows:
'[my_datastore] dir/subdir/file'
VMware, Inc.
47
Listthecontentsofoneofthedatastores.
vifs <conn_options> --dir '[osdc-cx700-02]'
Thecommandliststhecompletecontentsofthedatastore.
Listthecontentsofonedirectoryinthedatastore.
vifs <conn_options> --dir '[osdc-cx700-02] winxpPro-sp2'
Thecommandliststhedirectorycontent.Inthisexample,thecommandliststhecontentsofavirtual machinedirectory.
Content Listing _________________ vmware-37.log vmware-38.log ... vmware.log ... winxpPro-sp2.vmdk winxpPro-sp2.vmx winxpPro-sp2.vmxf ...
Thefollowingexamplescenarioillustratesotherusesofvifs. To manage files and directories on the remote ESX/ESXi system 1 Createadirectoryinthedatastore.
vifs <conn_options> --mkdir '[osdc-cx700-03] vcli_test'
Moveafileintoavirtualmachinedirectory.
vifs <conn_options> --move '[osdc-cx700-03] vcli_test/test_doc' '[osdc-cx700-03] winxpPro-sp2/test_doc
Cleanupbyremovingthefileanddirectoryyoucreatedearlier.
vifs <conn_options> --rm '[osdc-cx700-03] vcli_test/test_doc' vifs <conn_options> --rmdir '[osdc-cx700-03] vcli_test'
48
VMware, Inc.
Managing Storage
Introduction to Storage
FibreChannelSANarrays,iSCSISANarrays,andNASarraysarewidelyusedstoragetechnologiessupported byVMwarevSpheretomeetdifferentdatacenterstorageneeds.Thestoragearraysareconnectedtoand sharedbetweengroupsofserversthroughstorageareanetworks.Thisarrangementallowsaggregationofthe storageresourcesandprovidesmoreflexibilityinprovisioningthemtovirtualmachines.
VMware, Inc.
49
server group 1
server group 2
server group 3
ESX/ESXi
local ethernet SCSI bre channel HBA SAN iSCSI hardware initiator LAN software initiator ethernet NIC LAN ethernet NIC LAN
VMFS
Key
physical disk
datastore VMFS fibre array VMFS iSCSI array NFS NAS appliance
virtual disk
50
VMware, Inc.
YoucanusethevCLIcommandsdiscussedinthismanualtomanagethevirtualmachinefilesystemand storagedevices.
LUNs.Usevicfg-scsidevstodisplayavailableLUNsandmappingsforeachVMFSvolumetoits correspondingpartition.SeeExaminingLUNswithvicfgscsidevsonpage 52. Pathmanagement.Usevicfg-mpathtolistinformationaboutFibreChanneloriSCSILUNsandto changeapathsstate.SeeManagingPathswithvicfgmpathonpage 53.Usetheesxclicommand toviewandmodifypathpolicies.SeeManagingPathPolicieswithesxclionpage 55. Rescan.Usevicfg-rescantoperformarescanoperationeachtimeyoureconfigureyourstorage setup.SeeRescanningStorageAdapterswithvicfgrescanonpage 63.
Storagedevices.Severalcommandsmanageonlyspecificstoragedevices.
Datastores
ESX/ESXihostsusestoragespaceonavarietyofphysicalstoragesystems,includinginternalandexternal devicesandnetworkedstorage.Ahostcandiscoverstoragedevicestowhichithasaccessandformatthemas datastores.Eachdatastoreisaspeciallogicalcontainer,analogoustoafilesystemonalogicalvolume,where thehostplacesvirtualdiskfilesandothervirtualmachinefiles.Datastoreshidespecificsofeachstorage productandprovideauniformmodelforstoringvirtualmachinefiles. Dependingonthetypeofstorageyouuse,datastorescanbebackedbythefollowingfilesystemformats:
VMware, Inc.
51
storage array
storage array
Examining LUNs
Usevicfg-scsidevstodisplayinformationaboutavailableLUNsonESX/ESXi 4.xhosts.ForESX/ESXi3.5 systems,thecorrespondingcommandisvicfg-vmhbadevs. IMPORTANTYoucanrunvicfg-scsidevs--queryandvicfg-scsidevs --vmfsagainstESX/ESXiversion 3.5.TheotheroptionsaresupportedonlyagainstESX/ESXiversion4.0andlater. YoucanrunoneofthefollowingcommandstoexamineLUNs.
Listalllogicaldevicesknownonthissystemwithdetailedinformation.
vicfg-scsidevs <conn_options> --list
Listalllogicaldeviceswithabbreviatedinformation.
vicfg-scsidevs <conn_options> --compact-list
TheinformationincludesthedeviceID,devicetype,size,plugin,anddevicedisplayname.
Listalldeviceuniqueidentifiers.
vicfg-scsidevs <conn_options> --uids
ThecommandliststheprimaryUIDforeachdevice(naa.xxxorotherprimaryname)andanyotherUIDs foreachUID(VMLname).Youcanspecify--devicetoonlylistinformationforaspecificdevice.
Listaspecificlogicaldevicewithitsdetailedinformation.
vicfg-scsidevs <conn_options> -l -d mpx.vmhba32:C0:T1:L0
PrintmappingsforVMFSvolumestothecorrespondingpartition,pathtothatpartition,VMFSuuid, extentnumber,andvolumenames.
vicfg-scsidevs <conn_options> --vmfs
PrintHBAdeviceswithidentifyinginformation.
vicfg-scsidevs <conn_options> --hbas
ThereturnvalueincludestheadapterID,driverID,adapterUID,PCI,vendor,andmodel.
PrintamappingbetweenHBAsandthedevicesitprovidespathsto.
vicfg-scsidevs <conn_options> --hba-device-list
VMware, Inc.
53
HBA2
HBA1
HBA3
HBA4
switch
switch
SP1
SP2
storage array
Listalldeviceswiththeircorrespondingpaths,stateofthepath,adaptertype,andotherinformation.
vicfg-mpath <conn_options> --list-paths
Displayashortlistingofallpaths.
vicfg-mpath <conn_options> --list-compact
Listallpathswithadapteranddevicemappings.
vicfg-mpath <conn_options> --list-map
54
VMware, Inc.
Listpathsanddetailedinformationbyspecifyingthepathruntimename.
vicfg-mpath <conn_options> -l -P vmhba32:C0:T0:L0
Thereturninformationincludestheruntimename,device,devicedisplayname,adapter,adapter identifier,targetidentifier,plugin,state,transport,andadapterandtargettransportdetails.
Listdetailedinformationforthepathsforthedevicespecifiedwith--device.
vicfg-mpath <conn_options> -l -d mpx.vmhba32:C0:T1:L0 vicfg-mpath <conn_options> --list --device naa.60060...
Thedisplayincludesinformationabouteachpathsstate. 2 SetthestateofaLUNpathtooff.
vicfg-mpath <conn_options> --state off --path vmhba32:C0:T1:L0
Ifyouarechangingapathsstate:
ThechangeoperationfailsifI/Oisactivewhenthepathsettingischanged.Reissuethecommand. YoumustissueatleastoneI/Ooperationbeforethechangetakeseffect.
Whenyouareready,setthepathstatetoactiveagain.
vicfg-mpath <conn_options> --state active --path vmhba32:C0:T1:L0
VMW_PSP_FIXED_AP VMW_PSP_MRU
VMW_PSP_RR
VMware, Inc.
55
RoundRobin
Nofailback.
Ifnecessary,changethepreferredpath.
esxcli <conn_options> nmp fixed setpreferred --device naa.xxx --path vmhba3:C0:T5:L3
Thecommandsetsthepreferredpathtovmhba3:C0:T5:L3
56
VMware, Inc.
Setthepathselection.Youcanspecifywhenthepathshouldchange,andwhetherunoptimizedpaths shouldbeincluded.
Use--bytesor--iopstospecifywhenthepathshouldchange,asinthefollowingexamples:
esxcli <conn_options> nmp roundrobin setconfig --type "bytes" -B 12345 --device naa.xxx
Setsthedevicespecifiedby--devicetoswitchtothenextpatheachtime12345byteshavebeensent alongthecurrentpath.
esxcli <conn_options> nmp roundrobin setconfig --type=iops --iops 4200 --device naa.xxx
Thecommandsetsthedevicespecifiedby--devicetoswitchafter4200I/Ooperationshavebeen performedonapath.
AddtheMASK_PATHplugintotheclaimrulewiththeIDyoudecidedtouse.
esxcli <conn_options> corestorage claimrule add --plugin MASK_PATH --rule <ruleID> --type <type> -A <adapter>
Verifythattheclaimrulewasaddedcorrectly.
esxcli <conn_options> corestorage claimrule list
Loadthepathclaimingrules.
esxcli <conn_options> corestorage claimrule load
VMware, Inc.
57
Releasethedevicefromthecurrentpluginsothatitcanbeclaimedbyanotherrule.Forexample,you mightrunthefollowingcommandforeachpath:
esxcli <conn_options> corestorage claiming unclaim -t location -A vmhba0 -C 0 -T 0 -L 149
Runthepathclaimingrules,whichincludethenewlyaddedrules.
esxcli <conn_options> corestorage claimrule run
Verifythattheclaimrulewasdeletedcorrectly.
esxcli <conn_options> corestorage claimrule list
ReloadthepathclaimingrulesfromtheconfigurationfileintotheVMkernel.
esxcli <conn_options> corestorage claimrule load
Runthepathclaimingrules.
esxcli <conn_options> corestorage claimrule run
58
VMware, Inc.
ForeachNASfilesystem,thecommandliststhemountname,sharename,andhostnameandwhether thefilesystemismounted.IfnoNASfilesystemsareavailable,thesystemreturnsthefollowing:
No NAS datastore found
AddanewNASfilesystemtotheESX/ESXihost.
vicfg-nas <conn_options --add nfsstore-dir42
DeleteoneoftheNASfilesystems.
vicfg-nas <conn_options> -d FileServerHome1
ThiscommandunmountstheNASfilesystemandremovesitfromthelistofknownfilesystems.
UpgradeESX/ESXiwithoutvirtualmachinedowntime.DuringanupgradefromESXServer2.xto ESX/ESXi3.5orlater,youcanmigraterunningvirtualmachinesfromaVMFS2datastoretoaVMFS3 datastore,andupgradetheVMFS2datastorewithnoimpactonvirtualmachines.Youcanthenuse StorageVMotiontomigratevirtualmachinesbacktotheoriginaldatastorewithnovirtualmachine downtime. Performstoragemaintenanceandreconfiguration.YoucanuseStorageVMotiontomovevirtual machinesoffastoragedevicetoallowmaintenanceorreconfigurationofthestoragedevicewithout virtualmachinedowntime. Redistributestorageload.YoucanuseStorageVMotiontomanuallyredistributevirtualmachinesor virtualdiskstodifferentstoragevolumestobalancecapacityorimproveperformance.
VMware, Inc.
59
Thevirtualmachinecannothavesnapshots. Virtualmachinedisksmustbeinpersistentmodeorberawdevicemappings(RDMs).Forphysicaland virtualcompatibilitymodeRDMs,youcanmigratethemappingfileonly.Forvirtualcompatibilitymode RDMs,youcanusethevSphereClienttoconverttothickprovisionedorthinprovisioneddisksduring migrationaslongasthedestinationisnotanNFSdatastore.Youcannotusethesvmotioncommandto performthisconversion. ThehostonwhichthevirtualmachineisrunningmusthavealicensethatincludesStorageVMotion. ESX/ESXi3.5hostsmustbelicensedandconfiguredforVMotion.ESX/ESXi4.0andlaterhostsdonot requireVMotionconfigurationtoperformmigrationwithStorageVMotion. Thehostonwhichthevirtualmachineisrunningmusthaveaccesstoboththesourceandtarget datastores. AparticularhostcanbeinvolvedinuptotwomigrationswithVMotionorStorageVMotionatonetime. vSpheresupportsamaximumofeightsimultaneousVMotion,cloning,deployment,orStorageVMotion accessestoasingleVMFS3datastore,andamaximumoffoursimultaneousVMotion,cloning, deployment,orStorageVMotionaccessestoasingleNFSorVMFS2datastore.AmigrationwithVMotion involvesoneaccesstothedatastore.AmigrationwithStorageVMotioninvolvesoneaccesstothesource datastoreandoneaccesstothedestinationdatastore.
IfyouusethevSphereClientformigrationwithsvmotion,thesystemperformsanumberofcompatibility checks.ThesechecksarenotsupportedbythesvmotionvCLI.
60
VMware, Inc.
To determine the path to the virtual machine configuration file and disk file 1 Runvmware-cmd -ltolistallvirtualmachineconfigurationfiles(VMXfiles).
vmware-cmd -H <vc_server> -U <login_user> -P <login_password> -h <esx_host> -l
ChoosetheVMXfileforthevirtualmachineofinterest. Bydefault,thevirtualdiskfilehasthesamenameastheVMXfilebuthasa.vmdkextension.
(Optional)UsevifstoverifythatyouareusingthecorrectVMDKfile.
TheexampleisforWindows.UsesinglequotesonLinux. To relocate a virtual machines configuration file, but leave virtual disks 1 2 Determinethepathtothevirtualdiskfilesandthevirtualmachineconfigurationfile. Runsvmotion,forexample:
svmotion <conn_options> --datacenter='My DC' --vm='[old_datastore] myvm/myvm.vmx:new_datastore' --disks='[old_datastore] myvm/myvm_1.vmdk:old_datastore, [old_datastore] myvm/myvm_2.vmdk: old_datastore'
VMware, Inc.
61
Thecommandreturnstothepromptorsignalsanerror. Afterresignaturing,youmighthavetodothefollowing:
62
VMware, Inc.
Thecommandreturnsanindicationofsuccessorfailure,butnodetailedinformation.
VMware, Inc.
63
64
VMware, Inc.
VMware, Inc.
65
IP network
SP
iSCSI storage
Figure 61depictstohoststhatusedifferenttypesofiSCSIinitiators.
ThehostontheleftusesanindependenthardwareiSCSIadaptertoconnecttotheiSCSIstoragesystem. ThehostontherightusesathirdpartyEthernetNICwithiSCSIoffloadcapabilities.
iSCSIstoragedevicesfromthestoragesystembecomeavailabletothehost.Youcanaccessthestoragedevices andcreateVMFSdatastoresforyourstorageneeds.
Discovery Sessions
AdiscoverysessionispartoftheiSCSIprotocol.Thediscoverysessionreturnsthesetoftargetsthatyoucan accessonaniSCSIstoragesystem.ESX/ESXisystemssupportdynamicandstaticdiscovery.
66
VMware, Inc.
TheIQNnameusesthefollowingformat:
iqn.yyyy-mm.{reversed domain name}:id_string
VMware, Inc.
67
chapDiscouraged
chapPreferred
chapRequired
EnablesoftwareiSCSIfortheHBA.
vicfg-iscsi --swiscsi --enable
(Optional)Checkthestatus.
vicfg-iscsi --swiscsi --list
Addadynamicdiscoveryaddressorastaticdiscoveryaddress. Thetwotypesoftargetdifferasfollows:
Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered. Yourunthefollowingcommand:
vicfg-iscsi <conn_options> --discovery --add --ip <ip_addr | domain_name> <adapter_name>
Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage target.Yourunthefollowingcommand:
vicfg-iscsi <conn_options> --static --add --ip <ip_addr | domain_name> --name <iscsi_name> <adapter_name>
Whenyoulaterremoveadiscoveryaddress,itmightstillbedisplayedastheparentofastatictarget.You canaddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets.
VMware, Inc. 69
Thetarget(-i)andname(-n)optiondeterminewhatthecommandappliesto.
Option -iandn Onlyi Neither-inorn Result CommandappliestopertargetCHAPforstatictargets. Commandappliestothediscoveryaddress. CommandappliestoperadapterCHAP.
(Optional)SettheiSCSInameandalias.
vicfg-iscsi vicfg-iscsi vicfg-iscsi vicfg-iscsi -I -n <iscsi_name> <adapter_name> --iscsiname --name <iscsi_name> <adapter_name> -I -a <alias_name> <adapter_name> --iscsiname --alias <alias_name> <adapter_name>
Setupportbindingbyfollowingthesesteps: a IdentifytheVMkernelportofthedependenthardwareiSCSIadapter.
esxcli <conn_options> swiscsi vmknic list -d <vmhba>
ConnectthedependenthardwareiSCSIinitiatortotheiSCSIVMkernelportsbyrunningthe followingcommandforeachport.
esxcli <conn_options> swiscsi nic add -n <port_name> -d <vmhba>
70
VMware, Inc.
VerifythattheportswereaddedtothedependenthardwareiSCSIinitiator.
esxcli <conn_options> swiscsi nic list -d <vmhba>
RescanthedependenthardwareSCSIinitiator.
vicfg-rescan <conn_options> <vmhba>
Addadynamicdiscoveryaddressorastaticdiscoveryaddress. Thetwotypesoftargetdifferasfollows:
Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered. Yourunthefollowingcommand:
vicfg-iscsi <conn_options> --discovery --add --ip <ip_addr | domain_name> <adapter_name>
Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage target.Yourunthefollowingcommand:
vicfg-iscsi <conn_options> --static --add --ip <ip_addr | domain_name> --name <iscsi_name> <adapter_name>
Thetarget(-i)andname(-n)optiondeterminewhatthecommandappliesto.
Option -iandn Onlyi Neither-inorn Result CommandappliestopertargetCHAPforstatictargets. Commandappliestothediscoveryaddress. CommandappliestoperadapterCHAP.
VMware, Inc.
71
YoucanalsosettheHBAIPv4addressandnetworkmaskandgatewayinonecommand.
--ip <ip_addr> --subnetmask <subnet_mask> --gateway <default_gateway>
(Optional)SettheiSCSInameandalias.
vicfg-iscsi vicfg-iscsi vicfg-iscsi vicfg-iscsi -I -n <iscsi_name> <adapter_name> --iscsiname --name <iscsi_name> <adapter_name> -I -a <alias_name> <adapter_name> --iscsiname --alias <alias_name> <adapter_name>
Addadynamicdiscoveryaddressorastaticdiscoveryaddress. Thetwotypesoftargetdifferasfollows:
Withdynamicdiscovery,allstoragetargetsassociatedwithanIPaddressarediscovered.Runthe followingcommand:
vicfg-iscsi <conn_options> --discovery --add --ip <ip_addr> <adapter_name>
Withstaticdiscovery,youmustspecifytheIPaddressandtheiSCSInameofthestoragetargettobe added.Runthefollowingcommand:
vicfg-iscsi <conn_options> --static --add --ip <ip_addr> --name <iscsi_name> <adapter_name>
Whenyoulaterremoveadiscoveryaddress,itmightstillbedisplayedastheparentofastatictarget.You canlateraddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets.
72
VMware, Inc.
Thetarget(-i)andname(-n)optiondeterminewhatthecommandappliesto.
Option -iandn Onlyi Neither-inorn Result CommandappliestopertargetCHAPforstatictargets. Commandappliestothediscoveryaddress. CommandappliestoperadapterCHAP.
Thefollowingoptionsaresupported:
-D --discovery -S --static -A --authentication -P --phba -T --target -L --lun -N --network(IndependenthardwareiSCSIonly) -p --pnp(IndependenthardwareiSCSIonly) -I --iscsiname -W --parameter -E --swiscsi -H --adapter
Suboptionisoneofthefollowingoperations:
VMware, Inc.
73
Youcanuse--listtofindtheadaptername.
vicfg-iscsi --adapter --list vicfg-iscsi -H -l
-A --authentication -c <level> -m <auth_method> -b -u <ma_username> -w <ma_password> [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]] <adapter_name> --level <level> --method <auth_method> --mutual --auth_username <ma_username> --auth_password <ma_password> [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name>]] <adapter_name> -A --authentication -c <level> -m <auth_method> -u <auth_u_name> -w <a_password> [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]] <adapter_name> --level <level> --method <auth_method> --auth_username <auth_u_name> --auth_password <auth_password> [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name>]] <adapter_name> -A --authentication -l <adapter_name> --list <adapter_name> -D --discovery -a -i <stor_ip_addr|stor_hostname[:<portnum>] <adapter_name> --add --ip <stor_ip_addr|stor_hostname> [:<portnum>] <adapter_name> -D --discovery -l <adapter_name> --list <adapter_name> -D --discovery -r -i <stor_ip_addr|stor_hostname>[:<portnum>] <adapter_name> --remove --ip <stor_ip_addr|stor_hostname> [:<portnum>] <adapter_name> -H -l [<adapter_name>] --list [<adapter_name>] -L --lun -l <adapter_name> --list <adapter_name> ListsLUNinformation. ListsalliSCSIadaptersora specifiedadapter. Removesadynamicdiscovery address. Listsdynamicdiscovery addresses. Addsadynamicdiscovery address. Listssupportedauthentication methods. Enablesauthenticationusingthe specifiedoptions. Enablesmutualauthentication. Youmustenableauthentication beforeyoucanenablemutual authentication.
74
VMware, Inc.
VMware, Inc.
75
-S --static -a -i <stor_ip_addr|stor_hostname> [:<portnum>] -n <target_name> <adapter_name> --add --ip <stor_ip_addr|stor_hostname> [:<portnum>] -name <target_name> <adapter_name> -P --phba -l <adapter_name> --list <adapter_name> -T --target -l <adapter_name> --list <adapter_name> -W parameter -l [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name]] <adapter_name> --list [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name]] <adapter_name> -W parameter -l -k [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name]] <adapter_name> --list --detail [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name]] <adapter_name> -W parameter -W -j <name>=<value> -i <stor_ip_addr|stor_hostname> [:port_num>] [-n <iscsi_name>]] <adapter_name> --parameter --set <name>=<value> --ip <stor_ip_addr|stor_hostname> [:port_num>] [--name <iscsi_name>]] <adapter_name> -W parameter -W -o <param_name> -i <stor_ip_addr|stor_hostname> [:port_num>] [-n <iscsi_name>]] <adapter_name> -parameter --reset <param_name> -ip <stor_ip_addr|stor_hostname> [:port_num>] [-name <iscsi_name>]] <adapter_name> -z --reset_auth -a -z -m <auth_method> -b [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]] <adapter_name> --authentication --reset_auth --method <auth_method> [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name>]] <adapter_name> Resetstargetlevelauthentication propertiestobeinheritedfrom adapterlevel.Usedwiththe --authenticationoption. Returnsparametersindiscovery targetorsendtargettodefault inheritancebehavior. SetsiSCSIparameters. ListsiSCSIparameterdetails. ListsiSCSIparameter information. Liststargetinformation. Listsexternal,vendorspecific propertiesofaniSCSIadapter. Addsastaticdiscoveryaddress.
76
VMware, Inc.
Runvicfg-iscsi -P|--phbatolistexternal(vendorspecific)propertiesofaniSCSIadapter.
vicfg-iscsi -P -l <adapter_name> vicfg-iscsi --phba --list <adapter_name>
Thesystemreturnsinformationaboutthevendor,model,description,andserialnumberoftheHBA.
Runvicfg-iscsi -L|--luntolistLUNinformation.
vicfg-iscsi -L -l <adapter_name> vicfg-iscsi --lun --list <adapter_name>
Thecommandreturnstheoperatingsystemdevicename,busnumber,targetID,LUNID,andLUNsize fortheLUN.
Runvicfg-iscsi -Lwith-ttolistonlyLUNsonaspecifiedtarget.
vicfg-iscsi -L -l -t <target_ID> <adapter_name> vicfg-iscsi --lun --list --target_id <target_id> <adapter_name>
ThesystemreturnstheLUNsonthespecifiedtargetandthecorrespondingdevicename,devicenumber, LUNID,andLUNsize.
ThesystemreturnsinformationabouttheMACaddress,MTU,andcurrenttransferrate.
Runvicfg-iscsi -p -MtosettheMTUfortheadapter.Youspecifythesizeandadaptername.
vicfg-iscsi -p -M <mtu_size> <adapter_name> vicfg-iscsi --pnp --mtu <mtu-size> <adapter_name>
VMware, Inc.
77
Youcanusethefollowingvicfg-iscsioptionstolistparameteroptions.
Runvicfg-iscsi -W -ltolistparameteroptionsfortheHBA.
vicfg-iscsi -W -l [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]] <adapter_name> vicfg-iscsi --parameter --list [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name>]] <adapter_name>
Thetarget(-i)andname(-n)optiondeterminewhatthecommandappliesto.
Option -iandn Onlyi Neither-inorn Result Commandappliestostatictargets. Commandappliestothediscoveryaddress. Commandappliestoperadapterparameters.
Runvicfg-iscsi -W -l -k tolistiSCSIparametersandwhethertheyaresettable.
vicfg-iscsi -W -l -k [-i <stor_ip_addr|stor_hostname>[:<port_num>] [-n <iscsi_name>]] <adapter_name>
78
VMware, Inc.
Runvicfg-iscsi -W -jtosetiSCSIparameteroptions.
vicfg-iscsi -W -j <name>=<value> -i <stor_ip_addr|stor_hostname>[:port_num>][-n <iscsi_name>]] <adapter_name> vicfg-iscsi --parameter --set <name>=<value> --ip <stor_ip_addr|stor_hostname>[:port_num>][--name <iscsi_name>]] <adapter_name>
Thetarget(-i)andname(-n)optiondeterminewhatthecommandappliesto.
Option -iandn Onlyi Neither-inorn Result CommandappliestopertargetCHAPforstatictargets. Commandappliestothediscoveryaddress. CommandappliestoperadapterCHAP.
Thespecifiedusernameandpasswordmustbesupportedonthestorageside. 2 EnablemutualauthenticationontheESX/ESXihost.
vicfg-iscsi -A -c <level> -m <auth_method> -b -u <ma_username> -w <ma_password> [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name]] <adapter_name>
Makesurethefollowingrequirementsaremet.
VMware, Inc.
79
ConnectthesoftwareiSCSIordependenthardwareiSCSIinitiatortotheiSCSIVMkernelportsbyrunning thefollowingcommandforeachport.
esxcli <conn_options> swiscsi nic add -n <port_name> -d <vmhba>
VerifythattheportswereaddedtotheiSCSIinitiatorbyrunningthefollowingcommand:
esxcli <conn_options> swiscsi nic list -d <vmhba>
RescantheiSCSIinitiator.
vicfg-rescan <conn_options> <vmhba>
5 6
ListasoftwareiSCSIsessionattheadapterlevel.
esxcli <conn_options> swiscsi session list -d <iscsi_adapter>
Forexample:
esxcli --config /host-config-file swiscsi session list -d vmhba36
ListasoftwareiSCSIsessionatthetargetlevel.
esxcli <conn_options> swiscsi session list -t <iqn.xxxxx> -d <iscsi_adapter>
Forexample:
esxcli --config /host-config-file swiscsi session list -t iqn.xxx -d vmhba36
80
VMware, Inc.
LogintoasessiononthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationatthe adapterlevel.
esxcli <conn_options> swiscsi session add -d <iscsi_adapter>
Forexample:
esxcli --config /host-config-file swiscsi session add -d vmhba36
LogintoasessiononthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationatthetarget level.
esxcli <conn_options> swiscsi session add -t <iqn> -d <iscsi_adapter>
Forexample:
esxcli --config /host-config-fileswiscsi session add -t iqn.xxx -d vmhba36
AddduplicatesessionswithtargetandsessionIDsincurrentsoftwareiSCSIordependenthardware iSCSIconfiguration.
esxcli <conn_options> swiscsi session add --target <iqn.xxxx> --isid <session_id> --adapter <iscsi_adapter>
iqn.xxxxisthetargetIQN,whichyoucandeterminebylistingallsessions.session_idisthesessions iSCSIID.Forexample:
esxcli --config /host-config-file swiscsi session add -t iqn.xxx -s '00:02:3d:00:00:01' -d vmhba36
RemovesessionsfromthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationatthe adapterlevel.
esxcli <conn_options> swiscsi session remove -d <iscsi_adapter>
Forexample:
esxcli --config /host-config-file swiscsi session remove -d vmhba36
RemovesessionsfromthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationatthetarget level.
esxcli <conn_options> swiscsi session remove -t <iqn> -d <iscsi_adapter>
Forexample:
esxcli --config /host-config-file swiscsi session remove -t iqn.xxx -d vmhba38
RemovesessionsfromthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationwithtarget andsessionID.
esxcli <conn_options> swiscsi session remove --target <iqn.xxxx> --isid <session id> --adapter <iscsi_adapter>
VMware, Inc.
81
82
VMware, Inc.
Managing Users
IMPORTANTIfyoucreateauserwithoutspecifyingtherole(--role),theuserhasnopermissions.
VMware, Inc. 83
ManageESX/ESXidefineduserswiththevSphereClient,thevSphereWebServicesSDK,orvicfg-user. ManagevCenterServeruserswiththevSphereClientorthevSphereWebServicesSDK.
84
VMware, Inc.
EveniftheuserlistsofahostandavCenterServersystemappeartohavecommonusers(forinstance,auser calleddevuser),theseusersareseparateuserswiththesamename.TheattributesofdevuserinvCenter Server,includingpermissions,passwords,andsoforth,areseparatefromtheattributesofdevuseronthe ESX/ESXihost.IfyoulogintovCenterServerasdevuser,youmighthavepermissiontoviewanddeletefiles fromadatastore.IfyoulogintoanESX/ESXihostasdevuser,youmightnothavethesepermissions. UsersauthorizedtoworkdirectlyonanESX/ESXihostareaddedtotheinternaluserlistwhenESX/ESXiis installedorcanbeaddedbyasystemadministratorafterinstallation.Youcanusevicfg-usertoaddusers, removeusers,changepasswords,setgroupmembership,andconfigurepermissions. CAUTIONSeetheAuthenticationandUserManagementchapteroftheESXConfigurationGuideorESXi ConfigurationGuideforinformationaboutrootusersbeforeyoumakeanychangestothedefaultusers. Mistakesregardingrootuserscanhaveseriousaccessconsequences. EachESX/ESXihosthasanumberofdefaultusers:
Thelistdisplaysallusersthatarepredefinedbythesystemandallusersthatwereaddedlater. 2 Addanewuser,specifyingaloginIDandpassword.
vicfg-user <conn_options> -e user -o add -l user27 -p 27_password
Modifythepasswordforuseruser27.
vicfg-user <conn_options> -e user -o modify -l user27 -p 27_password2
VMware, Inc.
85
Assignreadonlyprivilegestotheuser(whichcurrentlyhasnoaccess).
vicfg-user <conn_options> -e user -o modify -l user27 --role read-only
Thesystempromptswhetheryouwanttochangethepassword,whichmightbeadvisableiftheuserdoes notcurrentlyhaveapassword.Answeryorn.Thesystemthenupdatestheuser.
Updated user user27 successfully. Assigned the role read-only
Listtheexistinggroups.
vicfg-user <conn_options> -e group -o list
Thesystemprintsanextensivelistofallgroupsandtheusersineachgroup. 7 Createagroup.
vicfg-user <conn_options> -e group -o add -d test
Thesystemaddsthegroup,andassignsagroupID.Whenyounowlistallgroups,thenewgroupis included.
---------Group Information: Principal -: test Full Name -: GID -: 500 ----------
Adduseruser27tothenewgroup.
vicfg-user <conn_options> -e user -o modify -l user27 -g test
Thesystemassignstheusertothegrouptest.Whenyounowlistallgroups,thenewgroupandthe assigneduserareincluded.
---------Group Information: Principal -: test Full Name -: GID -: 500 Users in group test: Principal -: user27 Full Name -: ___________
RemovetheuserwithloginIDuser27
vicfg-user <conn_options> -e user -o delete -l user27
Thesystemremovestheuserandprintsamessage.
Removed the user user27 successfully.
86
VMware, Inc.
Addgroup40totheexistinggroups.IfyoudonotspecifyagroupID,thesystemassignsanIDforthe group.
vicfg-user <conn_options> -e group -o add -d group40 -D 55
Createagroupwithpredefinedreadonlyprivilegesthatyoucanlaterusetoassignreadonlyprivileges tomultipleusers.
vicfg-user <conn_options> --entity group --operation add --group group42 --groupid 4242 --role read-only
Youmustspecifytheusernametoaddausertoagroup.TheuserIDisnotacceptable. 2 Adduserswithusernamesu1,u2,andu3togroup45,whichhasreadonlyprivileges.
vicfg-user <conn_options> -e group -o modify -d group42 --adduser u1,u2,u3
Removetheuserwithusernameu3fromthegroup.
vicfg-user <conn_options> -e group -o modify -d group42 --removeuser u3
Removethegroupwithgroupnamegroup45.
vicfg-user <conn_options> -e group -o delete -d group42
VMware, Inc.
87
88
VMware, Inc.
SomevirtualmachinemanagementutilityapplicationsareincludedinthevSphereSDKforPerl.
vmware-cmd Overview
vmware-cmdwasincludedinearlierversionoftheESXServiceConsole.Avmware-cmdvCLIhasbeen availablesinceESXiversion3.0. IMPORTANTOlderserviceconsoleversionsofvmware-cmdsupportasetofconnectionoptionsandgeneral optionsthatdifferfromtheoptionsinothervCLIcommands.Thevmware-cmdvCLIcommandsupports theseoptions.ThevCLIcommandalsosupportsthestandardvCLI--server,--username,--password,and --vihostoptions.vmware-cmddoesnotsupportotherconnectionoptions.
VMware, Inc.
89
Datastoreprefixstyle:'[ds_name] relative_path',forexample:
'[myStorage1] testvms/VM1/VM1.vmx'(Linux)
UUIDbasedpath: folder/subfolder/file,forexample:
'/vmfs/volumes/mystorage/testvms/VM1/VM1.vmx'(Linux)
"/vmfs/volumes/mystorage/testvms/VM1/VM1.vmx"(Windows)
ThecommandliststheVMXfileforeachvirtualmachine.
/vmfs/volumes/<storage>/winxpPro-sp2/winxpPro-sp2.vmx /vmfs/volumes/<storage>/RHEL-lsi/RHEL-lsi.vmx /vmfs/volumes/<storage>/VIMA0809/VIMA0809.vmx .....
90
VMware, Inc.
Runvmware-cmd -s unregistertoremoveavirtualmachinefromtheinventory.
vmware-cmd -H <vc_server> -U <login_user> -P <login_password> --vihost <esx_host> -s unregister /vmfs/volumes/Storage2/testvm/testvm.vmx
Thesystemreturns0toindicatesuccess,1toindicatefailure. NOTEWhenyourunagainstavCenterServersystem,youmustspecifythedatacenterandtheresource pooltoregisterthevirtualmachinein.Thedefaultdatacenterisha-datacenterandthedefaultresource poolisResources. WhenyourunagainstanESX/ESXihost,youusuallydonotspecifytheresourcepoolanddatacenter. However,iftwovirtualmachineswiththesamenameexistintworesourcepools,youmustspecifythe resourcepool. 3 4 Runvmware-cmd -lagaintoverifythatthevirtualmachinewasremovedfromtheinventory. Runvmware-cmd -s registertoaddthevirtualmachinebacktotheinventory.
vmware-cmd -H <vc_server> -U <login_user -P <login_password --vihost <esx_host> -s register /vmfs/volumes/Storage2/testvm/testvm.vmx
Thesystemreturns0toindicatesuccess,1toindicatefailure.
Thegetuptimeoptionretrievestheuptimeoftheguestoperatingsystemonthevirtualmachine,in seconds.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getuptime getuptime() = 17921
Thegetproductinfo productoptionliststheVMwareproductthevirtualmachinerunson.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getproductinfo product
Thereturnvalueisesx(VMwareESX),embeddedESX(VMwareESXi),orunknown.
Thegetproductinfo platformoptionliststheplatformthevirtualmachinerunson.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getproductinfo platform
Thereturnvalueiswin32-x86(x86basedWindowssystem,linux-x86(x86basedLinuxsystem),or vmnix-x86(x86basedESX/ESXimicrokernel).
VMware, Inc.
91
ThegettoolslastactiveoptionindicateswhetherVMwareToolsisinstalledandwhethertheguest operatingsystemisrespondingnormally.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx gettoolslastactive
Taking Snapshots
Youcantakeasnapshotwhileavirtualmachineisrunning,shutdown,orsuspended.Ifyouareintheprocess ofsuspendingavirtualmachine,waituntilthesuspendoperationhasfinishedbeforetakingasnapshot. Ifavirtualmachinehasmultipledisksindifferentdiskmodes,youmustshutdownthevirtualmachinebefore takingasnapshot.Forexample,ifyouhaveaspecialpurposeconfigurationthatrequiresyoutousean independentdisk,youmustshutdownthevirtualmachinebeforetakingasnapshot. To take a snapshot 1 (Optional)Ifthevirtualmachinehasmultipledisksindifferentdiskmodes,shutdownthevirtual machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx stop soft
92
VMware, Inc.
(Optional)Checkthattheshutdownoperationhasbeencompleted.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx getstate
Runvmware-cmdwiththecreatesnapshotoption. Youmustspecifythedescription,quiesceflag(0or1)andmemoryflag(0or1).
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx createsnapshot VM1Aug09 test snapshot August 09 0 0
Checkthatthevirtualmachinehasasnapshotusingthehassnapshotoption. Thecallreturns1ifthevirtualmachinehasasnapshotandreturns0otherwise.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx hassnapshot hassnapshot () = 1
Runvmware-cmdwiththeremovesnapshotsoptiontoremoveallsnapshotsassociatedwithavirtual machine.Ifnosnapshotexists,thecommanddoesnothing.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx removesnapshots
Softpoweroperations.Whenyouspecifysoftasthepowerop_modevalue,theresultofthecalldepends ontheoperation.
Operation Stop Reset Suspend Result vmware-cmdattemptstoshutdowntheguestoperatingsystem,andthenpowersoffthe virtualmachine. vmware-cmdattemptstoshutdowntheguestoperatingsystem,andthenrebootsthe virtualmachine. vmware-cmdattemptstorunascriptintheguestoperatingsystembeforesuspendingthe virtualmachine.
Hardpoweroperations.vmware-cmdimmediatelyandunconditionallyshutsdown,resets,orsuspends thevirtualmachine.
VMware, Inc.
93
Thefollowingexamplesillustratehowtousevmware-cmd.
StartUsethestartoptiontopoweronavirtualmachineortoresumeasuspendedvirtualmachine. Thepowerop_mode,eitherhardorsoft,isrequired.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx start soft
IfVMwareToolsisnotcurrentlyinstalledonthevirtualmachine,youcanperformonlyahardreset operation.
SuspendYouhavetwooptionsforsuspendingavirtualmachine.
Thesuspendoptionwiththehardpoweropmodeunconditionallyshutsdownavirtualmachine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx suspend hard
Thefollowingexamplesillustrateconnectinganddisconnectingavirtualdevice.
TheconnectdeviceoptionconnectsthevirtualIDEdeviceCD/DVDDrive2tothespecifiedvirtual machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx connectdevice "CD/DVD Drive 2"
Thedisconnectdeviceoptiondisconnectsthevirtualdevice.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/testvm.vmx disconnectdevice "CD/DVD Drive 2"
94
VMware, Inc.
Stopthevirtualmachinebyrunningthefollowingcommand.
esxcli vms vm kill --type <kill_type> --world-id <ID>
Thecommandsupportsthree--typeoptions.Trythetypessequentially(softbeforehard,hardbefore force).Thefollowingtypesaresupportedthroughthe--typeoption:
Ifallthreeoptionsdonotwork,rebootyourESX/ESXihosttoresolvetheissue.
VMware, Inc.
95
96
VMware, Inc.
Theesxclicommandisavailableasaserviceconsolecommand(noauthentication)onESXhostsandasa vCLIforbothESXandESXihosts.Thenamespacesandcommandsthatesxclimakesavailabledepend entirelyonthesystemonwhichitisinstalled.Runesxcli--helpforinformationonavailabilityonyour system.Becauseesxclioptionsdependcompletelyontheenvironment,nomanpageisavailable. IMPORTANTThischapterdiscussesthirdpartystoragemanagementoptions.Itisnotacompletereferenceto esxcli.SeeManagingPathPolicieswithesxclionpage 55,MaskingPathswithesxclicorestorage claimruleonpage 57,andManagingiSCSISessionsonpage 80foradditionalusesofesxcli.Seeesxcli CommandOverviewonpage 136foracompletereference. esxcliisnotincludedinthevSphereCommandLineReference.Usetheinformationinthismanualorthe commandlinehelpforinformation. ThischapterexplainshowtouseesxcliforPSA(pluggablestoragearchitecture)management.TheESX ConfigurationGuideandtheESXiConfigurationGuidediscussPSAfunctionalityindetail.Thosedocuments explainhowtousethevSphereClienttomanagethePSA,theassociatednativemultipathingplugin(NMP) andthirdpartypluginswiththevSphereClient. Thischapterusesthefollowingacronyms.
Acronym PSA NMP PSP SATP Meaning PluggableStorageArchitecture. NativeMultipathingPlugin.GenericVMwaremultipathingmodule. PathSelectionPlugin.Handlespathselectionforagivendevice. StorageArrayTypePlugin.Handlespathfailoverforagivenstoragearray.
Thechapterincludesthesetopics:
VMware, Inc.
97
<namespace>
Displayshelpforsupported optionsforthiscommand.
98
VMware, Inc.
TosetthepathpolicyforthespecifieddevicetoVMW_PSP_FIXED,runthefollowingcommand:
esxcli <conn_options> nmp device setpolicy --device naa.xxx --psp VMW_PSP_FIXED
Onlyshowpathstoasingedevice(esxcli nmp path list --device <device>). Onlyshowinformationforasinglepath(esxcli nmp path list --path <path>andesxcli nmp path --device <device>).
VMware, Inc.
99
RetrievethePSPconfigurationforthespecifiedpath.
esxcli <conn_options> nmp psp getconfig --path vmhba4:C1:T2:L23
100
VMware, Inc.
Toreturnthepathconfiguredasthepreferredpathforthespecifieddevice,runthefollowingcommand:
esxcli <conn_options> nmp device getpreferred --device naa.xxx
Tosetthepreferredpathforthespecifieddevicetovmhba3:C0:T5:L3,runthefollowingcommand:
esxcli <conn_options> nmp fixed setpreferred --device naa.xxx --path vmhba3:C0:T5:L3
Setsthedevicespecifiedby--devicetoswitchtothenextpatheachtime12345byteshavebeensent alongthecurrentpath.
esxcli <conn_options> nmp roundrobin setconfig --type=iops --iops 4200 --device naa.xxx
Setsthedevicespecifiedby--devicetoswitchafter4200I/Ooperationshavebeenperformedonapath.
VMware, Inc.
101
Bydefault,thedefaultSATPforanactiveactiveFCarraywithavendorandmodelnotlistedintheSATPrules isVMW_SATP_DEFAULT_AA.
102
VMware, Inc.
Description TransportstringtosetwhenaddingtheSATPclaimrule.DescribesthetypeofstorageHBA, forexample,iscsiorfc. VendorstringtosetwhenaddingtheSATPclaimrule. SATPforwhichtheruleisadded. ClaimoptionstringtosetwhenaddingtheSATPclaimrule. DescriptionstringtosetwhenaddingtheSATPclaimrule. OptionstringtosetwhenaddingtheSATPclaimrule. DefaultPSPfortheSATPclaimrule. PSPoptionsfortheSATPclaimrule.
ThefollowingexamplesillustrateaddingSATPrules.
AddaSATPrulethatspecifiesthatdiskswithvendorstringVMWAREandmodelstringVirtualshouldbe addedtoVMW_SATP_LOCAL.
esxcli <conn_options> nmp satp addrule --satp="VMW_SATP_LOCAL" --vendor="VMWARE" --model="Virtual" --description="VMware virtual disk"
AddaSATPrulethatspecifiesthatdiskswiththedriverstringsomedrivershouldbeaddedto VMW_SATP_LOCAL.
esxcli <conn_options> nmp satp addrule --satp="VMW_SATP_LOCAL" --driver="somedriver"
AddarulethatspecifiesthatallstoragedeviceswithvendorstringABCandamodelnamethatstartswith 120shoulduseVMW_SATP_DEFAULT_AA(VMW_SATP_DEFAULT_AAisanexample).
esxcli <conn_options> nmp satp addrule --satp VMW_SATP_DEFAULT_AA --vendor="ABC" --model="^120*
IMPORTANTNotallSATPssupportgetconfigfordevicesorgetconfigforpaths.
VMware, Inc.
103
UsethiscommandtoretrieveperdeviceorperpathSATPconfigurationparameters,andtoseewhetheryou cansetcertainconfigurationparametersforadeviceorpath.Forexample:
# esxcli --config /my-config-file nmp satp getconfig --device naa.60019b9000dd21c500002d974a0acfa0 SATP VMW_SATP_LSI does not support device configuration. # esxcli --config /my-config-file nmp satp getconfig -path vmhba1:C0:T0:L8 INIT,AVT OFF,v5.4,DUAL ACTIVE,ESX FAILOVER
Youcanspecifyoneofthefollowingdeviceconfigurationstrings:
--device -d --path -p
DevicetosetSATPconfigurationfor.NotallSATPssupportthesetconfigoptionondevices. PathtosetSATPconfigurationfor.NotallSATPssupportthesetconfigoptiononpaths.
VMware, Inc.
105
--channel <channel> -C <channel> --driver <driver> -D <driver> --force -f --lun <lun_number> -L <lun_number> --model <model> -M <model> --plugin -P
106
VMware, Inc.
blockblockstorageconnection fcFibreChanneltransmission iscsivendoriSCSIconnection iscsinotcurrentlyused ideIDEstorageconnection sasSASstorageconnection sataSATAstorageconnection usbUSBstorageconnection parallelparalleltransmission unknown
Thefollowingexamplesillustrateaddingclaimrules:
Addrule321,whichclaimsthepathonadaptervmhba0,channel0,target0,LUN0fortheNMPplugin.
esxcli <conn_options> corestorage claimrule add -r 321 -t location -A vmhba0 -C 0 -T 0 -L 0 -P NMP
Addrule429,whichclaimsallpathsprovidedbyanadapterwiththemptscsidriverfortheMASK_PATH plugin.
esxcli <conn_options> corestorage claimrule add -r 429 -t driver -D mptscsi -P MASK_PATH
Addrule914,whichclaimsallpathswithvendorstringVMWAREandmodelstringVirtualfortheNMP plugin.
esxcli <conn_options> corestorage claimrule add -r 914 -t vendor -V VMWARE -M Virtual -P NMP
Addrule1015,whichclaimsallpathsprovidedbyFCadaptersfortheNMPplugin.
esxcli <conn_options> corestorage claimrule add -r 1015 -t transport -R fc -P NMP
VMware, Inc.
107
WhenyouconvertLUNmaskingtotheclaimruleformatafteranupgradefromESX/ESXi3.5toESX/ESXi4.x, thiscommandconvertsthe/adv/Disk/MaskLUNsadvancedconfigurationentryintheesx.conffiletoclaim ruleswithMASK_PATHastheplugin. IMPORTANTThisconversiondoesnotworkforallinputMaskLUNvariations.Forexample,roleconversion forsoftwareiSCSILUNsisnotsupported. Inspectthelistofgeneratedclaimrulescarefullybeforeyoucommitthembyusing--commit. Table 9-1. esxcli corestorage claimrule convert Options
Options --commit -C Description ForcesLUNmaskconfigurationchangestobesaved.Ifyoucallthecommandwithoutthis parameter,changesarenotsaved,andyoucanfirstinspectthegeneratedclaimrules.
Thefollowingexampledeletesrule1015.
esxcli <conn_options> corestorage claimrule delete -r 1015
Youcanrunthecommandasfollows.Theequalsignisoptional,sobothformsofthecommandhavethesame result.
esxcli --config /vmc-store09 corestorage claimrule list -c Filter esxcli --config /vmc-store09 corestorage claimrule list --claimrule-class=Filter
108
VMware, Inc.
Thefollowingexamplerenamesrule1016torule1015anddeletesrule1016.
esxcli <conn_options> corestorage claimrule move -r 1015 -n 1016
VMware, Inc.
109
110
VMware, Inc.
10
10
IntroductiontovSphereNetworkingonpage 111 SettingUpvSphereNetworkingwithvNetworkStandardSwitchesonpage 113 SettingUpvSphereNetworkingwithvNetworkDistributedSwitchonpage 118 ManagingStandardNetworkingServicesinthevSphereEnvironmentonpage 119 UsingvicfgipsecforSecureNetworkingonpage 121
VirtualswitchesallowyourESX/ESXihosttomigratevirtualmachineswithVMwareVMotionandtouseIP storagethroughVMkernelnetworkinterfaces.
VMware, Inc.
111
C vSwitch
port groups
C vSwitch
3
Host2 virtual
Host2 physical
physical network
AssociatedwitheachESX/ESXihostareoneormoreuplinkadapters(1).Uplinkadaptersrepresentthe physicalswitchestheESX/ESXihostusestoconnecttothenetwork.Youcanmanageuplinkadapters usingthevicfg-nicsvCLIcommand.SeeManagingUplinkAdapterswithvicfgnicsonpage 116. EachuplinkadapterisconnectedtoavSS(2).YoucanmanageavSSandassociateitwithuplinkadapters byusingthevicfg-vswitchvCLIcommand.SeeSettingUpVirtualSwitchesandAssociatingaSwitch withaNetworkInterfaceonpage 114. AssociatedwiththevSSareportgroups(3).Portgroupisauniqueconceptinthevirtualenvironment. Youcanconfigureportgroupstoenforcepoliciesthatprovideenhancednetworkingsecurity,network segmentation,betterperformance,highavailability,andtrafficmanagement.Youcanusethe vicfg-vswitchcommandtoassociateavSSwithaportgroup,andthevicfg-vmkniccommandto associateaportgroupwithaVMkernelnetworkinterface. TheVMkernelTCP/IPnetworkingstacksupportsiSCSI,NFS,andVMotionandhasanassociated VMkernelnetworkinterface.YouconfigureVMkernelnetworkinterfaceswithvicfg-vmknic.See AddingandModifyingVMkernelNetworkInterfaceswithvicfgvmkniconpage 117.Separate VMkernelnetworkinterfacesareoftenusedforseparatetasks,forexample,youmightdevoteone VMkernelNetworkinterfacecardtoVMotiononly.VirtualmachinesruntheirownsystemsTCP/IP stacksandconnecttotheVMkernelattheEthernetlevelthroughvirtualswitches.
112
VMware, Inc.
3
dvUplinkB
Host2
virtual
Host2 physical
1
physical network adapters
physical network
Eachphysicaladapter(1)onthehostispairedwithadvUplinkadapter(2),whichrepresentstheuplink tothevirtualmachine.WithvDS,thevirtualmachinenolongerdependsonthehostsphysicaluplinkbut onthe(virtual)dvUplink.YoucanmanageadvUplinkusingthevSphereClientorvicfg-vswitch. ThevDSitself(3)functionsasasinglevirtualswitchacrossallassociatedhosts.Becausetheswitchisnot associatedwithasinglehost,virtualmachinescanmaintainconsistentnetworkconfigurationasthey migratefromonehosttoanother. LikeavSS,eachvDSisanetworkhubthatvirtualmachinescanuse.AvDScanroutetrafficinternally betweenvirtualmachinesorlinktoanexternalnetworkbyconnectingtophysicalnetworkadapters.You createavDSusingthevSphereClientUI,butcanmanagesomeaspectsofavDSusingvicfg-vswitch. SeeSettingUpVirtualSwitchesandAssociatingaSwitchwithaNetworkInterfaceonpage 114.
2 3 4 5
VMware, Inc.
Whentwoormorevirtualmachinesareconnectedtothesamevirtualswitches,networktrafficbetweenthem isroutedlocally.Ifanuplinkadapterisattachedtothevirtualswitches,eachvirtualmachinecanaccessthe externalnetworkthattheadapterisconnectedto. ThissectiondiscussesworkinginastandardvSwitch(vSS)environment.SeeManagingvNetwork DistributedSwitchesonpage 119forinformationaboutvDSenvironments. Whenworkingwithvirtualswitchesandportgroups,performthefollowingtasks: 1 2 3 Findoutwhichvirtualswitchesareavailableand(optionally)whattheassociatedMTUandCDP(Cisco DiscoveryProtocol)settingsare.SeeRetrievingInformationaboutVirtualSwitchesonpage 114. Addavirtualswitch.SeeAddingandDeletingVirtualSwitchesonpage 115. Foranewlyaddedswitch,performthesetasks: a b c d Addaportgroup.SeeChecking,Adding,andRemovingPortGroupsonpage 115. (Optional)SettheportgroupVLANID.SeeSettingthePortGroupVLANIDonpage 116. Addanuplinkadapter.SeeLinkingandUnlinkingUplinkAdaptersonpage 116. (Optional)ChangetheMTUorCDPsettings.SeeSettingSwitchAttributesonpage 115.
CheckwhethervSwitch1exists.
vicfg-vswitch <conn_options> -c vSwitch1
Thecommandreturns1iftheswitchexists,0iftheswitchdoesnotexist.
Listallvirtualswitchesandassociatedportgroups.
vicfg-vswitch <conn_options> -l
114
VMware, Inc.
Addavirtualswitch.
vicfg-vswitch <conn_options> --add vSwitch2
Deleteavirtualswitch.
vicfg-vswitch <conn_options> --delete vSwitch1
SettheMTUforavSwitch.
vicfg-vswitch <conn_options> -m 9000 vSwitch1
TheMTUisthesize(inbytes)ofthelargestprotocoldataunittheswitchcanprocess.Whenyousetthis option,itaffectsalluplinksassignedtothevirtualswitch.
SettheCDPvalueforavSwitch.Youcansetstatustodown,listen,advertise,orboth.
vicfg-vswitch <conn_options> --set-cdp listen
CheckwhetherportgroupsarecurrentlyassociatedwithavSwitch.
vicfg-vswitch <conn_options> --check-pg <port_group> vSwitch1
Addaportgroup.
vicfg-vswitch <conn_options> --add-pg <port_group_name> vSwitch1
Deleteoneoftheexistingportgroups.
vicfg-vswitch <conn_options> --del-pg <port_group_name> vSwitch1
Connectaportgroupwithanuplinkadapter.
vicfg-vswitch --add-pg-uplink <adapter_name> --pg <port_group> <vswitch_name>
Thiscommandfailssilentlyiftheuplinkadapterdoesnotexist.
Removeaportgroupfromanuplinkadapter.
vicfg-vswitch --del-pg-uplink <adapter_name> --pg <port_group> <vswitch_name>
VMware, Inc.
115
SettheVLANIDto4095toallowaportgrouptoreachportgroupslocatedonotherVLAN. SettheVLANIDto0todisabletheVLANforthisportgroup.
AllowallportgroupstoreachportgroupslocatedonotherVLANs.
vicfg-vswitch <conn_options> --vlan 4095 --pg ALL vSwitch2
DisableVLANforportgroupg42
vicfg-vswitch <conn_options> --vlan 0 --pg g42 vSwitch2
Addanewuplinkadaptertoavirtualswitch.
vicfg-vswitch <conn_options> --link vmnic15 vSwitch0
Removeanuplinkadapterfromavirtualswitch.
vicfg-vswitch <conn_options> --unlink vmnic15 vSwitch0
Liststheuplinksinthesystem,theircurrentandconfiguredspeed,andtheirduplexsetting. 2 Setthesettingsforvmnic0tofullandthespeedto100.
vicfg-nics <conn_options> -d full -s 100 vmnic0
116
VMware, Inc.
Setvmnic2toautonegotiateitsspeedandduplexsettings.
vicfg-nics <conn_options> -a vmnic2
ForIPv4,chooseoneofthefollowingformats:
<X.X.X.X>StaticIPv4address. DHCPUseIPv4DHCP.
TheVMkernelsupportsDHCPonlyforESX/ESXi4.0andlater. 3 (Optional)EnableVMotion.Bydefault,VMotionisdisabled.
vicfg-vmknic <conn_options> --enable-vmotion VMSF-VMK-363
Youcanlateruse--disable-vmotiontodisableVMotionforthisVMkernelnetworkinterface. 4 ListinformationaboutallVMkernelnetworkinterfacesonthesystem.
vicfg-vmknic <conn_options> --list
Thecommanddisplaysthenetworkinformation,portgroup,MTU,andcurrentstateforeachvirtual networkadapterinthesystem.
VMware, Inc.
117
To add and configure a VMkernel Network Interface with IPv6 1 Runvicfg-vmknic --addtoaddaVMkernelnetworkinterface.YoumustspecifytheIPaddressusing --ip,thenetmask,andtheportgroupname.Forthefollowingexamples,assumethatVMSFVMK363 isaportgrouptowhichyouwanttoaddaVMkernelnetworkinterface. YoucanspecifytheMTUsettingwhenaddingaVMkernelnetworkinterface.Youcannotchangethat settingatalatertime. Whenthecommandcompletessuccessfully,thenewlyaddedVMkernelnetworkinterfaceisenabled. 2 EnableIPv6.
vicfg-vmknic <conn_options> --enable-ipv6 true VMSF-VMK-363
SupplyanIPv6address.
vicfg-vmknic <conn_options> --ip <ip_address> VMSF-VMK-363
ForIPv6,theIPaddresscanhaveoneofthefollowingformats:
(Optional)EnableVMotion.Bydefault,VMotionisdisabled.
vicfg-vmknic <conn_options> --enable-vmotion VMSF-VMK-363
Youcanlateruse--disable-vmotiontodisableVMotionagain. 5 ListinformationaboutallVMkernelnetworkinterfacesonthesystem.
vicfg-vmknic <conn_options> --list
118
VMware, Inc.
AddadvUplink.
vicfg-vswitch --add-dvp-uplink <adapter_name> --dvp <DVPort_id> <dvswitch_name>
RemoveadvUplink.
vicfg-vswitch --del-dvp-uplink <adapter> --dvp <DVPort_id> <dvswitch_name>
IfDNSisnotsetupforthetargetserver,thecommandreturnsanerror. 2 Tochangethesettings,usevicfg-dnswith--dns,--domain,or--hostname.
SpecifytheDNSserverusingthe--dnsoptionandacommaseparatedlistofhosts,inorderof preference.
vicfg-dns <conn_options --dns <dns1,dns2>
ConfiguretheDNShostnamefortheserverspecifiedby--server(or--vihost).
vicfg-dns <conn_options> -n dns_host_name
ConfiguretheDNSdomainnamefortheserverspecifiedby--server(or--vihost).
vicfg-dns <conn_options> -d mydomain.biz
ToturnonDHCP,usethe--DHCPoption.
vicfg-dns <conn_options> --dhcp yes
VMware, Inc.
119
ForESXhosts,v_nicmustbeoneoftheserviceconsolenetworkadapters. ForESXihosts,v_nicmustbeoneoftheVMkernelnetworkadapter.
OverridetheexistingDHCPsettingasfollows:
vicfg-dns <conn_options> --dhcp yes --v_nic <vnic>
Runvicfg-ntp --starttostarttheservice.
vicfg-ntp <conn_options> --start
Runtovicfg-ntp --listtolisttheservice.
vicfg-ntp <conn_options> --list
Runvicfg-ntp --stoptostoptheservice.
vicfg-ntp <conn_options> --stop
Runvicfg-ntp --deletetoremovethespecifiedNTPserverfromthehostspecifiedin<conn_options>.
vicfg-ntp <conn_options> --delete 192.XXX.XXX.XX
ForIPv4networks,noadditionaloptionsarerequired.
vicfg-route <conn_options> --add <network_ip> <netmask_IP> <gateway_ip>
Forexample,toaddarouteto192.168.100.0through192.168.0.1:
vicfg-route -a 192.168.100.0/24 192.168.0.1
or
vicfg-route -a 192.168.100.0 255.255.255.0 192.168.0.1
120
VMware, Inc.
ForIPv6networks,use--family v6
vicfg-route -f V6 --add <network_ip_and_mask> <gateway_ip>
Forexample:
vicfg-route -f V6 --add 2001:10:20:253::/64 2001:10:20:253::1
Listrouteentriestocheckthatyourroutewasaddedbyrunningthecommandwithoutoptions.
vicfg-route <conn_options>
Theoutputlistsallnetworksandcorrespondingnetmasksandgateways. 3 Setthedefaultgateway.
ForIPv4,usethissyntax:
vicfg-route 192.168.0.1 or vicfg-route -a default 192.168.0.1
ForIPv6,usethissyntax:
vicfg-route -f V6 -a default 2001:10:20:253::1
Runvicfg-route --deletetodeletetheroute.Specifyfirstthegateway,andthenthenetwork.
vicfg-route <conn_options> -d 192.168.100.0/24 192.168.0.1
Youcannotrunvicfg-ipsecwithavCenterServersystemasthetarget(usingthe--vihostoption). TheVMwareimplementationofIPsecadherestothefollowingIPv6RFCs:
VMware, Inc.
121
Theactionisspecifiedbythefollowingoptionstovicfg-ipsec.
BecauseIPsecallowsyoutotargetpreciselywhichtrafficshouldbeencrypted,itiswellsuitedforsecuring yourvSphereenvironment.Forexample,youcansetuptheenvironmentsoallVMotiontrafficisencrypted.
122
VMware, Inc.
YoucanperformthesemaintaskswithSAs:
ListanSAwithvicfg-ipsec --list-sa.ThiscommandreturnsSAscurrentlyavailableforusebyan SP.ThelistincludesSAsyoucreatedusingvicfg-ipsec. RemoveasingleSAwithvicfg-ipsec --remove-sa.IftheSAisinusewhenyourunthiscommand, thecommandcannotperformtheremoval. RemoveallSAswithvicfg-ipsec --flush-sa.ThisoptionremovesallSAsevenwhentheyareinuse. CAUTIONRunningvicfg-ipsec --flush-saremovesallSAsonyoursystemandmightleaveyour systeminaninconsistentstate.
VMware, Inc.
123
Mode,eithertunnelortransport. NameoftheSAtousebythisSP.
YoucanperformthesemaintaskswithSPs:
ListanSPwithvicfg-ipsec --list-sp.ThiscommandreturnsSPscurrentlyavailable.AllSPsare createdbytheadministrator. RemoveanSPwithvicfg-ipsec --remove-sp.IftheSPisinusewhenyourunthiscommand,the commandcannotperformtheremoval.Youcanrunvicfg-ipsec --flush-spinsteadtoremovetheSP evenwhenitisinuse. CAUTIONRunningvicfg-ipsec --flush-spremovesallSPsonyoursystemandmightleaveyour systeminaninconsistentstate.
124
VMware, Inc.
11
11
UsingresxtopforPerformanceMonitoringonpage 125 ManagingDiagnosticPartitionswithvicfgdumppartonpage 125 ConfiguringSyslogonESXiHostsonpage 126 ManagingESX/ESXiSNMPAgentswithvicfgsnmponpage 127 ESX,ESXi,andVirtualMachineLogsonpage 129 EnablingandDisablingCIMProvidersonpage 129
VMware, Inc.
125
Youcanusethevicfg-dumppartcommandtoquery,set,andscananESX/ESXihostsdiagnosticpartitions. TheESXConfigurationGuideandtheESXiConfigurationGuideexplainhowtosetupdiagnosticpartitionswith thevSphereClient.TheFibreChannelSANConfigurationGuideandtheiSCSISANConfigurationGuideexplain howtomanagediagnosticpartitionsonaFibreChannelorhardwareiSCSISAN. Diagnosticpartitionscaninclude,inorderofsuitability,paralleladapter,blockadapter,FibreChannel,or hardwareiSCSIpartitions. IMPORTANTWhenyoulistdiagnosticpartitions,softwareiSCSIpartitionsareincluded.However,VMware recommendsthatyounotusesoftwareiSCSIpartitionsasdiagnosticpartitions. Thefollowingexamplescenariochangesthediagnosticpartition. To manage a diagnostic partition 1 ShowthediagnosticpartitiontheVMkerneluses.
vicfg-dumppart <conn_options> -t
Displayinformationaboutallpartitionsthatcanbeusedasdiagnosticpartitions.Use-lforbasic information,-ffordetailedinformation.
vicfg-dumppart <conn_options> -f
Theoutputmightlookasfollows.
Partition name on vml.mpx.vmhba36:C0:T0:L0:7 -> mpx.vmhba36:C0:T0:L0:7
Deactivatethediagnosticpartition.
vicfg-dumppart <conn_options> -d
TheESX/ESXisystemisnowwithoutadiagnosticpartition,andyoumustimmediatelysetanewone. 4 Settheactivepartitiontonaa.<naa_ID>.
vicfg-dumppart <conn_options> -s naa.<naa_ID>
Runvicfg-dumppart -tagaintoverifythatadiagnosticpartitionisset.
vicfg-dumppart <conn_options> -t
Ifadiagnosticpartitionisset,thecommanddisplaysinformationaboutit.Otherwise,thecommand informsyouthatnopartitionisset.
126
VMware, Inc.
Runvicfg-syslog --setservertosetaremoteserverasthesyslogserver.
vicfg-syslog <conn_options> -s mysyslogserver
ESX/ESXi4.0andlaterincludesanSNMPagentembeddedinthehostdaemon(hostd)thatcansendtraps andreceivepollingrequestssuchasGETrequests.
VersionsofESXreleasedbeforeESX/ESXi4.0includedaNetSNMPbasedagent.Youcancontinuetousethis NetSNMPbasedagentinESX4.xwithMIBssuppliedbyyourhardwarevendorandotherthirdparty managementapplications.However,tousetheVMwareMIBfiles,youmustusetheembeddedSNMPagent. TousetheNETSNMPbasedagentandembeddedSNMPagentatthesametime,makeoneoftheagentslisten onanondefaultport.Bydefault,bothagentsusethesameport. TheembeddedSNMPagentisdisabledbydefault.Configuringandenablingtheagentrequiresthatyou performthefollowingtasks: 1 2 ConfigureSNMPCommunities.SeeConfiguringSNMPCommunitiesonpage 127. ConfiguretheSNMPAgent.Youhavethefollowingchoices:
Eachtimeyouspecifyacommunitywiththiscommand,thesettingsthatyouspecifyoverwritetheprevious configuration.
VMware, Inc.
127
(Optional)EnabletheSNMPagentifitisnotyetrunning.
vicfg-snmp <conn_options> --enable
(Optional)Sendatesttraptoverifythattheagentisconfiguredcorrectly.
vicfg-snmp <conn_options> --test
TheagentsendsawarmStarttraptotheconfiguredtarget.
(Optional)IftheSNMPagentisnotenabled,enableit.
vicfg-snmp <conn_options> --enable
Runvicfg-snmp --testtovalidatetheconfiguration.
Thefollowingexampleshowshowthecommandsareruninsequence:
vicfg-snmp c public t example.com@162/private --enable # next validate your config by doing these things: vicfg-snmp test walk v1 c public esx-host
128
VMware, Inc.
Thefollowingprovidergroupsareavailable:
VMware, Inc.
129
130
VMware, Inc.
12
12
VMware, Inc.
131
vicfg-iscsi vicfg-module
ManagingiSCSIStorageonpage 65. ManagingVMkernelModuleswith vicfgmoduleonpage 32. ManagingPathswithvicfgmpathon page 53. ManagingNFS/NASDatastoreswith vicfgnasonpage 58. ManagingUplinkAdapterswithvicfgnics onpage 116. AddingandStartinganNTPServeron page 120. RescanningStorageAdapterswith vicfgrescanonpage 63. ManagingtheIPGatewayonpage 120. ExaminingLUNswithvicfgscsidevson page 52. ManagingESX/ESXiSNMPAgentswith vicfgsnmponpage 127. UsingSNMPinavSphereenvironmentis discussedindetailintheDatacenter AdministrationGuide.
vicfg-syslog
Specifiesthesyslogserverandtheportto connecttothatserverforESXihosts.
vicfg-user
Creates,modifies,deletes,andlistslocaldirect accessusersandgroupsofusers.
ManagingUsersonpage 83 SeetheDatacenterAdministrationGuidefor discussionsofcustomrolesandofsecurity implicationsofusermanagement. AddingandModifyingVMkernelNetwork Interfaceswithvicfgvmkniconpage 117 ManagingDuplicateVMFSDatastoreswith vicfgvolumeonpage 61.
vicfg-vmknic vicfg-volume
132
VMware, Inc.
vihostupdate vihostupdate35
vmware-cmd
Youcannotrunthevihostupdateandvicfg-mpathcommandsthatareinavCLI4.xinstallationagainst ESX/ESXi3.5orvCenter2.5systems.Instead,runvihostupdate35andvicfg-mpath35,includedinthevCLI 4.xinstallation,againstthosesystems.vihostupdate35issupportedforESXibutnotESX. IMPORTANTIfyourunvCLI4.xcommandsagainstESX/ESXi3.5systems,youcanuseonlytheoptions supportedbythosesystems. SeetheVMwareInfrastructureRemoteCommandLineInterfaceInstallationandReferenceGuideforESX/ESXi Update2foralistofsupportedoptions.Toaccessthatdocument,selectResources,thenDocumentationfrom theVMwarewebsite.FindthevSpheredocumentationsetandopenthearchive.AsmallnumberofvCLI4.x optionsaresupportedagainsthostsrunningESX/ESXi3.5Update2orlatereventhoughtheywerenot supportedinRCLIversion3.5. RunavCLI4.xcommandwith--helpforinformationonoptionsupportwithESX/ESXi3.5Update 2,orsee theVMwareknowledgebasearticleathttp://kb.vmware.com/kb/1008940formoredetail.
VMware, Inc.
133
Table 122listsplatformsupportforthedifferentvCLI4.xcommands.Thesecommandshavenotbeentested againstVirtualCenter2.5Update2systems.Youcan,however,connecttoavCenterServer4.xsystemand targetESX/ESXi3.5Update2hosts. Table 12-2. Platform Support for vCLI 4.x Commands
Command esxcli resxtop svmotion vicfg-advcfg vicfg-authconfig vicfg-cfgbackup vicfg-dns vicfg-dumppart vicfg-hostops vicfg-ipsec vicfg-iscsi vicfg-module vicfg-mpath vicfg-nas vicfg-nics vicfg-ntp vicfg-rescan vicfg-route vicfg-scsidevs vicfg-snmp vicfg-syslog vicfg-user vicfg-vmhbadevs vicfg-vmknic vicfg-volume vicfg-vswitch vifs vihostupdate vmkfstools vmware-cmd vicfg-mpath35 vihostupdate35 ESXi 4.x Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes ESX 4.x Yes Yes No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes VC 4.x No Yes Yes Yes Yes No Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No ESXi 3.5 U2+ No Yes No Yes No Yes Yes Yes No No No Yes ESX 3.5 U2+ No Yes No Yes No No Yes Yes No No No Yes
Usevicfg-mpath35instead. Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes No Yes Yes Usevihostupdate35 instead Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes Yes Yes No Yes Yes No Yes Yes Yes No
NotincludedinvCLI4.x.Usevicfg-scsidevs instead. Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes No No No Yes No No
134
VMware, Inc.
VMware, Inc.
135
<namespace>
136
VMware, Inc.
esxcli --server S1 nmp device --help esxcli --server S1 nmp device -? esxcli --server S1 nmp device setpolicy --help esxcli --server S1 nmp device setpolicy -?
Displayshelpforsupported commandsforthisapp.
Displayshelpforsupportedoptions forthiscommand.
Thissectionisareferencetoesxclicommands,organizedonapernamespacebasis.Thereferencepointsto placesinthismanualthatdiscussusingthecommand.
claiming Commands
Theesxcli corestorage claimingcommandsapplytothepluggablestoragedirectpathclaimingsystem. Theseoperationsallowausertodirectlycontroltheclaimingandunclaimingprocess.Theresultsofthese operationsaretemporary.Claimingoperationsthatneedtopersistafterarebootshoulduseclaimrules instead(seeclaimruleCommandsonpage 138). Youcanspecifythefollowingclaimingcommands.
Command autoclaim reclaim Description DonotusethiscommandunlessinstructedtodosobyVMwaresupportstaff. Attemptstounclaimallpathstoadeviceandrunstheloadedclaimrulesoneachofthe unclaimedpathstoreclaimthem.Supportsthefollowingoptions:
-d|--deviceNameofadeviceonwhichallpathswillbeunclaimedandthenreclaimed. -h|--helpShowthehelpmessage.
VMware, Inc.
137
Command unclaim
Description Unclaimsapathorsetofpaths,disassociatingitfromaPSAplugin.Itisnormalforpath claimingtofailespeciallywhenunclaimingbypluginoradapter.Onlyinactivepathswithno I/Ocanbeunclaimed.TypicallytheESXiUSBpartitionanddeviceswithVMFSvolumeson themarenotunclaimable. Unclaimingdoesnotpersistandperiodicpathclaimingreclaimsunclaimedpathsashorttime aftertheunclaimoperationsunlessclaimrulesareconfiguredtomaskthepath.SeeMasking Pathswithesxclicorestorageclaimruleonpage 57. Seeesxclicorestorageclaimingunclaimonpage 105foralistofoptions.
claimrule Commands
Theesxcli corestorage claimrulecommandsoperateontherulesusedtodeterminewhichPSAplugin isusedtoclaimstoragepaths.Youcanalsousethesecommandstomaskpaths,seeMaskingPathswithesxcli corestorageclaimruleonpage 57. Thefollowingcommandsaresupported.
Command add convert Description Addsaclaimruletothesetofclaimrulesonthesystem.SupportsoptionslistedinAdding ClaimRuleswithesxclicorestorageclaimruleaddonpage 106. ConvertsESX3.xstyle/adv/Disk/MaskLUNsLUNmaskstoclaimruleformat. ThisconversiondoesnotworkforallinputMaskLUNsvariations.Aftertheconvertoperation hasgeneratedalistofclaimrules,inspectthoserulesfirst.IfthesuggestedLUNmaskclaim rulesarecorrect,usethe--commitoptiontowritethelisttotheconfigurationfile. SeeConvertingESX3.5LUNMaskstoClaimRuleFormatonpage 107. delete list load move run Deletesaclaimrule.SeeDeletingClaimRuleswithesxclicorestorageclaimruledeleteon page 108. Listsallclaimrulesonthesystem. LoadspathclaimingrulesfromtheconfigurationfileintotheVMkernel.SeeLoadingClaim Ruleswithesxclicorestorageclaimruleloadonpage 108. Movesaclaimrulefromoneruleidtoanother.SeeMovingClaimRuleswithesxclicorestorage claimrulemoveonpage 109. Runspathclaimingrules.Seeesxclicorestorageclaimrulerunonpage 109.
device Commands
Theesxcli corestorage device list commandappliestothepluggablestoragearchitectureslogical devicesonthesystem.Thecommandisusedinconjunctionwithhardwareacceleration,discussedintheFibre ChannelSANConfigurationGuideandtheiSCSISANConfigurationGuide.
Command list Description FordevicescurrentlyregisteredwiththePSA,liststheattachedfilters.Supportsthefollowing options:
-d|--deviceFilterstheoutputofthiscommandtoonlyshowasingledevice. -h|--helpShowsthehelpmessage.
138
VMware, Inc.
plugin commands
Theesxcli corestorage plugin listcommandworksonPSAplugins.Thecommandisusedin conjunctionwithhardwareacceleration,discussedintheFibreChannelSANConfigurationGuideandtheiSCSI SANConfigurationGuide.
Command list Description ListsPSApluginsavailableonthespecifiedsystem.Supportsthefollowingoptions:
VMware, Inc.
139
device Commands
Theesxcli nmp devicecommandscanbeusedforinspectingandmanagingthedevicesthatarecurrently claimedbytheVMwareNMP.Thefollowingcommandsaresupported.
Command Description ListsthedevicescurrentlycontrolledbyVMwareNMPandshowstheSATPandPSP informationassociatedwiththosedevices.
list
-d|--deviceFilterstheoutputofthiscommandtoonlyshowasingledevice. -h|--helpShowsthehelpmessage.
setpolicy
AllowssettingofthePSPforthegivendevicetooneofthepoliciesloadedonthesystem.
fixed Commands
The esxcli nmp fixedcommandsapplytotheFixedPSP.Thefollowingcommandsaresupported.
Command getpreferred Description RetrievesfixedPSPsettingsforthespecifieddevice.
-d|--deviceDeviceyouwishtogetthepreferredpathfor. -h|--helpShowsthehelpmessage.
setpreferred
Setsthepreferredpathonaspecifieddevicecontrolledbythefixedpathselectionpolicy.
path Commands
Theesxcli nmp pathlistcommandliststhepathsthatarecurrentlyclaimedbyVMwareNMP.
Command Description ListthepathscurrentlyclaimedbyVMwareNMPandshowtheSATPandPSPinformation associatedwiththatpath.
list
psp Commands
Theesxcli nmp pspcommandsapplytothePSPfortheNMP.Thefollowingcommandsaresupported.
Command getconfig Description RetrievesperpathorperdevicePSPconfigurationparameters.
list
ListsthePSPthatarecurrentlyloadedintotheNMPsystemanddisplayinformationaboutthosePSPs.
140
VMware, Inc.
Command setconfig
-c|--config Configurationstringyouwishtosetforthegivenpathordevice. -d|--device DeviceyouwishtosetPSPconfigurationfor.Ifyouspecify--device,youcannot specify --path. -h|--help Showthehelpmessage. -p|--path PathyouwishtosetPSPconfigurationfor.Ifyouspecify--path,youcannotspecify --device.
roundrobin Commands
esxcli nmp roundrobincommandsapplytotheroundrobinPSP.Thefollowingcommandsaresupported:
Command getconfig Description AllowsretrievalofroundrobinPSPsettingsforagivendevice.
-d|--deviceDeviceyouwishtogetthesettingsfor. -h|--helpShowsthehelpmessage.
setconfig
satp Commands
esxcli nmp satp commandsapplytotheSATPsfortheVMwareNMP.Thefollowingcommandsare supported:
Command addrule deleterule getconfig list listrules setconfig setdefaultpsp Description AddsaruletothelistofclaimrulesforthegivenSATP.SeeAddingSATPRulesonpage 102 DeletesarulefromthelistofclaimrulesforthegivenSATP.SeeDeletingSATPRulesonpage 103 AllowsretrievalofperpathorperdeviceSATPconfigurationparameters. ListstheSATPsthatarecurrentlyloadedintotheNMPsystemanddisplayinformationaboutthose SATPs.SeeRetrievingInformationAboutSATPsonpage 102. ListstheclaimingrulesforSATPs. AllowssettingofperpathorperdeviceSATPconfigurationparameters.Seeesxclinmp roundrobinsetconfigonpage 101. SetsthedefaultPSPforagivenSATP.SeeSettingtheDefaultPSPonpage 104.
nic Commands
esxcli swiscsi niccommandsallowyoutoperformoperationsoniSCSInetworkinterfaces.Youcanbind anexistingVMkernelnetworkinterfaceforusebyiSCSI,removeaVMkernelnetworkinterfacefromthe currentiSCSIconfiguration,andlistnetworkportbindings.Thefollowingcommandsaresupported.
Command add Description BindsanexistingVMkernelnetworkinterfacethatisnotusedforotherpurposestothecurrent softwareiSCSIconfiguration.Supportsthefollowingoptions:
VMware, Inc.
141
Command list
Description ListsnetworkportbindingsfortheVMkernelnetworkinterface.Supportsthefollowingoptions:
remove
RemovesaVMkernelnetworkinterfacefromthecurrentsoftwareiSCSIconfiguration.Supportsthe followingoptions:
session Commands
esxcli swiscsi sessioncommandsallowyoutoadd,list,andremoveiSCSIloginsessions.SeeManaging iSCSISessionsonpage 80.Thefollowingcommandsaresupported.
Command add Description AddsaloginsessiontothecurrentiSCSIconfiguration.Supportsthefollowingoptions:
-d | --adapter NameofthesoftwareiSCSIadapteryouwanttoaddasessionto. -h | --help Showsthehelpmessage. -s | --isid iSCSIIDofthesessionyouwanttoduplicateforlogin.Runesxcli swiscsi session listforthatdevicetoseethesessioniSCSIID(session_isid). -t | --target Nameofthetargettologinto.
list
Listsinformationaboutsessionsforaspecifiedadapterortarget.Youneedthisinformationwhenyou wanttoremoveasessionfromanadapter.Supportsthefollowingoptions:
remove
RemovesthespecifiediSCSIsessionorsessionsfromtheiSCSIconfiguration.Supportsthefollowing options:
-d | --adapter NameofthesoftwareiSCSIadapteryouwanttoremoveasessionfrom. -h | --help Showsthehelpmessage. -s | --isid TheiSCSIIDofthesessionyouwanttoremove.Runesxcli swiscsi session listforthatdevicetoseethetargetiSCSIID(session_isid) -t | --target Nameofthetargettoremove.Runesxcli swiscsi session listforthat devicetoseethetarget.
vmknic Commands
Theesxcli swiscsi vmkniclistcommandallowsyoutolistVMkernelnetworkinterfacesavailablefor bindingtoaparticulariSCSIadapter.
Command list Description ListsallVMkernelnetworkinterfaces.Supportsthefollowingoptions: -d|--adapter TheiSCSIadaptername(vmhba#)forwhichyouwanttolistVMkernel networkinterface. -h|--help Showthehelpmessage.
vmnic Commands
Theesxcli swiscsi vmnic listcommandallowsyoutolistavailableuplinkadaptersforusewitha specifiediSCSIadapter.
Command list Description -d|--adapter TheiSCSIadaptername(vmhba#). -h|--help Showsthehelpmessage.
142
VMware, Inc.
vm Commands
Command kill Description Allowsyoutoforciblystopvirtualmachinesthatdonotrespondtonormalstopoperations. Supportsthefollowingoptions:
Ifallthreeoptionsdonotstopthevirtualmachine,reboottheESX/ESXisystem.
list
Listsinformationaboutallrunningvirtualmachines,includingtheWorldIDofthevirtual machine,neededbythekillcommand.
VMware, Inc.
143
144
VMware, Inc.
Index
Index
Numerics
2gbsparse disk format 40 3.5 LUN masks 107
A
Active Directory 32, 33 active path 55 ARP redirect 72 authentication algorithm (IPsec) 123 default inheritance 69 information 20 key (IPsec) 123 returning to default inheritance 69 AUTOCONF 118
B
backing up configuration data 29 bulletins uninstall 32 vihostupdate 30 bundles 30, 31
commands with esxcfg prefix 131 configuration data backing up 29 restoring 29 configuration files for authentication 21 path 61 usage 21 connection options 20, 23 copying files 47 cp936 encoding 24 creating directories 47 creating session files 21 creating VMFS 39 credential store esxcli 98, 136 precedence 20
D
datastores mounting 62 overview 51 default inheritance 69, 79 default port groups 114 deleting virtual disks 42 dependent hardware iSCSI 65, 70 deploying vMA 17 depots 31 device management 53, 99 device mappings 53 device naming 51 device target 38 Device UID 51 DHCP 119, 120 DHCPV6 118 diagnostic partitions example 126 managing 53 vicfg-dumppart 53 directory management 48 discovery sessions 66 discovery targets 67 disk file path 61 disk formats supported by vmkfstools 40 disk partition target 38 disks, cloning 42
C
CDP 114, 115 Challenge Handshake Authentication Protocol 68 changing IP gateway 120 CHAP 68 chapDiscouraged 68 chapPreferred 68 chapProhibited 68 chapRequired 68 CIM providers 129 Cisco Discovery Protocol 114 claim rules adding 106 converting 107 deleting 108 from 3.5 systems 107 from LUN mask 107 listing 108 loading 108 moving 109 running 109 cloning virtual disks 42 command-line connection parameters 22
VMware, Inc.
145
displaying virtual disks 43 distributed virtual switch 111 DNS 119, 120 downloading files 47 dump partitions, vicfg-dumppart 53 duplicate datastores 61 dynamic discovery 66
E
eagerzeroedthick disk format 40 encoding cp936 24 ISO-8859-1 24 Shift_JIS 24 encryption algorithm (IPsec) 122 encryption key (IPsec) 123 ESX/ESXi logs 129 esxcfg prefix 131 esxcfg-nics 116 esxcfg-snmp 127 esxcli command syntax 98 credential store authentication 98, 136 help 137 esxcli corestorage claiming reclaim command 104 unclaim command 105 esxcli corestorage claimrule add command 106 convert command 107 delete command 108 list command 108 load command 108 move command 109 run command 109 esxcli network connections list command 139 neighbors show command 139 esxcli nmp boot restore command 139 esxcli nmp device list command 99 setpolicy command 99 esxcli nmp fixed getpreferred command 100 setpreferred command 101 esxcli nmp psp 100 setconfig command 100 esxcli nmp roundrobin 56, 101 getconfig command 101 setconfig command 101 esxcli nmp satp 102
esxcli swiscsi session commands 142 vmknic commands 142 esxcli swiscsi nic 104 esxcli swiscsi session 80 esxcli vaai 143 device list Command 143 esxcli vms 143 EUI name 54, 67 examples iSCSI storage setup 69, 70 VMFS file system 39 execution options 23 extending file system partition, vmkfstools 39 extending virtual disks 43 external HBA properties 77
F
failover 53 FC LUNs 51 Fibre Channel LUNs 51 file management introduction 35 vifs 36, 48 file path, configuration file 61 file system targets 38 file systems NAS 59 VMFS 39 fixed path selection policy 100
G
gateway, IP 120 getting help for esxcli 137 groups 83, 86, 87 GSX Server 43
H
hard power operations 93 hardware iSCSI setup tasks 72 HBA mappings 53 HBA properties 77 help for esxcli 137 host updates 29 hosts managing 27 shutdown or reboot 27 updates 29
I
independent hardware iSCSI definition 65 setup tasks 72
146
VMware, Inc.
Index
inflating thin virtual disks 41 inheritance 79 initializing virtual disks 41 installing vCLI Linux 11, 20 Windows 15 installing vMA 17 IP gateway 120 IP storage 111 IPsec 121, 122 IPv4 117 IPv6 118 IQN name 67 iSCSI authentication 69, 79 default inheritance 79 dependent hardware iSCSI 70 discovery target names 67 independent hardware iSCSI 72 LUNs 51 mutual authentication 79 options 77 overview 65 parameters 77 parameters, returning to default inheritance 79 path masking 57 port binding 70 ports for multipathing 80 remove sessions 81 securing ports 68 security 67 sessions 80, 81 setup examples 69, 70 ISO-8859-1 encoding 24
M
maintenance mode 28 managing diagnostic partitions 53 managing NMP 99 managing physical network interfaces 116 MASK_PATH plugin 57 masking a path 57 Microsoft Windows Security Support Provider Interface 22 migrating virtual machines GSX Server 43 svmotion 59 vmkfstools 43 VMware Workstation 43 mount datastores 62 MTU 115 multipathing 53 mutual authentication 79 mutual CHAP 70, 71, 79
N
naa.xxx device name 54 NAS file systems 59 NetQueue VMkernel modules 32 network adapters duplex value 116 managing 116 speed 116 vicfg-nics 116 vicfg-vmknic 117 network interfaces 114, 116 networking IPsec 121 list connections 139 vDS 118 vSS 113 NFS, capabilities 58 NIC binding 104 NMP 53, 99 NTP server 120
K
Kerberos 120 kill command 143
L
LibXML2 14 license 60 Linux installing vCLI 11, 20 running vCLI commands 15, 22 vCLI 11 listing available LUNs 52 listing IP gateway 120 listing VMFS volume attributes 39 loading claim rules 108 lockdown mode 23 logs 129 LUN masks, convert to claim rule 107
VMware, Inc.
O
offload iSCSI 65 OpenSSL 14 options 23 order of precedence 20 orphaned virtual machine 90
147
P
parameters command line 22 default inheritance (iSCSI) 79 partitions, diagnostic 126 path operations 99 path policies 55, 100, 101 path state, changing 55 paths active 55 disabling 55 identifier 51 information 54 masking 57 preferred 56, 100 unmasking 58 vicfg-mpath 53 performance monitoring 125 Perl 11 physical compatibility mode RDM 40, 45 physical network adapters 116 physical network interfaces 116 platform support 133 port binding 70, 80 port groups 116 adding 115 and uplink adapter 115 default 114 removing 115 ports, iSCSI multipathing 80 power operations 93 powerop_mode 93 precedence 20 preferred path 56, 100, 101 prerequisites Red Hat Enterprise Linux 5.2 13 SLES 10 and SLES 11 13 Ubuntu Desktop 9.04 13 PSA acronym 97 managing claim rules 106 PSP acronym 97 information 100 operations 100
RDM format 40 RDMs disk format 40 physical compatibility mode 45 virtual compatibility mode 45 rebooting hosts 27 Red Hat Enterprise Linux 5.2 13 register virtual machines 90 removing snapshots 93 renaming virtual disks 42 required parameters 20 rescanning storage 51, 63 resignature VMFS copy 62 restoring configuration data 29 resxtop 125, 131 reverting snapshots 93 RFCs (vicfg-ipsec) 121 roles 83 round robin operations 56, 101 round robin path policy 101 route entry 120 rule IDs 57 rules 103 claim rules 106 SATP rules 103 running commands from vMA 17 Linux 11, 20 Windows 15
S
SATP commands 141 configuration parameters 103 deleting rules 103 retrieve settings 102 rules, adding 102 scripts with vCLI commands 25 secure networking 121 securing iSCSI ports 68 security associations (IPsec) 122 security policies (IPsec) 123 session files 20, 21 sessions, iSCSI 81 setting preferred path 101 Shift_JIS encoding 24 Simple Network Management Protocol 127 SLES 10 13 SLES 11 13 snapshots 43, 92, 93 SNMP communities 127 management 127
VMware, Inc.
R
raw device mapping physical compatibility mode 45 virtual compatibility mode 45 raw disks cloning 42
148
Index
polling 128 traps 128 soft power operations 93 software iSCSI setup tasks 69, 70 spanning partitions, vmkfstools 39 special characters, vicfg-iscsi 79 SSPI protocol 22 standard networking services 119 starting NTP server 120 state of path, changing 55 static discovery 66 stop virtual machine 95 stopping virtual machines 143 storage creating directories with vifs 47 overview 49 rescanning 51, 63 virtual machines 50 storage array target 52 storage device naming 51 supported disk formats 40 supported platforms 133 svmotion 59 interactive Mode 60 license 60 limitations 60 noninteractive mode 60 requirements 60 special characters 60 switch attributes 115 syslog server specification 126 syslog service 127
unmasking paths 58 unregister virtual machines 90 update using bundles 30 using depots 31 updating hosts 29 uplink adapter and port groups 115 setup 116 uplink adapters vicfg-nics 116 useANO (round robin) 57 user input 95 users adding to groups 87 creating 85 in vSphere environment 83 modifying 85 removing from groups 87 using session files 21
V
vaai namespace (esxcli) 143 vCLI command-line 22 configuration files 21 environment variables 21 execution options 23 installing on Linux 11, 20 installing on Windows 15 vicfg-iscsi 49, 65 vCLI package installing on Linux 11 installing on Windows 16 uninstalling 15 unpacking 14 vDS 111, 113 vicfg-advcfg 129 vicfg-authconfig 32 vicfg-cfgbackup 28, 29 vicfg-dumppart 53 vicfg-hostops 27, 28 vicfg-ipsec 121, 122, 123 vicfg-iscsi command syntax 73 default inheritance for authentication 69 default inheritance for parameters 79 iscsi parameter options 78 vicfg-module 32 vicfg-mpath 53 vicfg-nas 58 vicfg-nics 116 vicfg-ntp 120
149
T
target, for vmkfstools 38 TCP/IP 72, 111 TCP/IP stack 111 thin virtual disks format 40 inflating 41 vmkfstools 41 third-party bundle 31 third-party bundles 31 transport mode 122 tunnel mode 122
U
Ubuntu Desktop 9.04 13 uninstalling bulletin (vihostupdate) 32 Linux 15 on Linux 15 on Windows 16
VMware, Inc.
vicfg-rescan 63, 70, 71 vicfg-scsidevs 52, 58 3.5 support 52 vicfg-snmp 127 vicfg-syslog 126 vicfg-user 83, 84, 86 vicfg-vmhbadevs 52 vicfg-vmknic 117 vicfg-volume 61 vicfg-vswitch 114 vifs 36, 46 vihostupdate bulletins 30 bundles 30 depots 31 protocols 30 third-party bundles 31 uninstall bulletin 32 virtual compatibility mode RDM 45 virtual devices 94 virtual disks cloning 42 creating 41 deleting 42 extending 43 geometry 43 inflating 41 initializing 41 options 40 renaming 42 thin 41 virtual machine configuration file path 61 virtual machines attributes 91 file management 35 listing 90 logs 129 managing 91 migration with svmotion 59 network settings 113 orphaned 90 path 90 registering 90 starting 93 stopping 95, 143 storage VMotion 59 vmware-cmd 91 virtual switches 114 MTU 115 vicfg-vswitch 114 VLAN ID 116
vMA 17 environment variables 21 installing 17 multiple configuration files 22 VMFS creating with vmkfstools 38, 39 duplicate datastores 61 listing attributes 39 resignature 62 resignature copy 62 volume attributes 39 VMkernel modules 32 VMkernel NIC 117 enable VMotion 117 IPv4 117 IPv6 118 VMkernel NICs 117 vmkfstools 36 command syntax 36 command-specific options 37 creating virtual disk 41 creating VMFS 38 creating VMFS example 39 deleting virtual disk 42 device target 38 disk formats 40 disk partition target 38 display disk geometry 43 extending virtual disk 43 file system options 38 file system targets 38 inflating thin virtual disk 41 initializing virtual disk 41 options 38 renaming virtual disk 42 snapshots 43 supported targets 38 syntax 36 target 38 virtual disk options 40 VMFS volume attributes 39 VML LUN names 54 VMotion 112, 117 VMW_PSP_FIXED 55 VMW_PSP_FIXED_AP 55 VMW_PSP_MRU 55 VMW_PSP_RR 55 VMware DRS and vicfg-hostops 28 VMware Workstation 43 vmware-cmd connection options 89 general options 90
150
VMware, Inc.
Index
server options 90 snapshots 92 virtual machine options 91 VMware Tools 94 vNetwork distributed switches 111, 113, 118, 119 vNetwork standard switches 112, 113 vSphere Management Assistant 17 vSphere SDK for Perl 11 vSS 111 vStorage APIs for Array Integration 143
W
Windows Active Directory 33 executing commands 22 installing vCLI 15 running vCLI commands 16 using vCLI 15 Workstation virtual machines, migrating 43
Z
zeroedthick disk format 40
VMware, Inc.
151
152
VMware, Inc.