Você está na página 1de 90

Remote Command-Line Interface Installation and Reference Guide

Update 2 and later for ESX Server 3.5, ESX Server 3i version 3.5, VirtualCenter 2.5

Remote Command-Line Interface Installation and Reference Guide

Remote Command-Line Interface Installation and Reference Guide Revision: 20090313 Item: EN-000082-01

You can find the most up-to-date technical documentation on our 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

20072009 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, the VMware boxes logo and design, Virtual SMP and VMotion are registered trademarks or trademarks 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. 3401 Hillview Ave. Palo Alto, CA 94304 www.vmware.com


2 VMware, Inc.

Contents

AboutThisBook

5
5

ProductNamingConventions

1 RemoteCLIInstallationandExecution 9
ListofAvailableCommands 10 UsingtheVMwareRemoteCLI 12 InstallingandExecutingRemoteCLICommandsonLinux 13 UnpackingandInstallingtheRemoteCLIPackage 13 ExecutingRemoteCLICommands 14 UninstallingtheRemoteCLIPackage 15 InstallingandExecutingRemoteCLICommandsonWindows 15 InstallingtheRemoteCLIPackage 15 ExecutingRemoteCLICommands 16 UninstallingtheRemoteCLIPackage 16 InstallingandRunningtheRemoteCLIVirtualAppliance 17 ImportingtheVirtualAppliance 17 RunningtheVirtualAppliance 18 SpecifyingOptionsforRemoteCLICommands 19 UsingaSessionFile 19 SettingEnvironmentVariables 20 UsingaConfigurationFile 20 PassingParametersattheCommandLine 21 UsingMicrosoftWindowsSecuritySupportProviderInterface(SSPI) 21 AvailableOptionsforRemoteCLIExecution 22 ExamplesforSpecifyingConnectionOptions 24 UsingRemoteCLICommandsinScripts 25 Example:EditingFilesontheESXServerHost 26 Example:AddingaNASDatastoretoMultipleESXServerHosts 26

2 RemoteCLIReference 27
StorageManagementCommands 28 ManagingDiagnosticPartitionswithvicfgdumppart ConfiguringStorageArrayswithvicfgmpath 30 28

VMware, Inc.

Remote Command-Line Interface Installation and Reference Guide

ManagingNASFileSystemswithvicfgnas 33 Rescanningwithvicfgrescan 34 FindingAvailableLUNswithvicfgvmhbadevs 35 NetworkingCommands 36 SpecifyingtheDNSConfigurationwithvicfgdns 36 ManagingPhysicalNICswithvicfgnics 38 SpecifyingtheNTPServerwithvicfgntp 39 ManipulatingtherouteEntrywithvicfgroute 40 ManagingVMkernelNICswithvicfgvmknic 41 ManagingVirtualSwitcheswithvicfgvswitch 42 SystemManagementCommands 45 UsingresxtopforPerformanceMonitoring 45 UsingvicfgcfgbackupforConfigurationInformation 45 SettingUpSNMPwithvicfgsnmp 47 SpecifyingthesyslogServerwithvicfgsyslog 49 PerformingMaintenancewithvihostupdate 50 VirtualMachineManagementCommands 51 MigratingVirtualMachinesUsingsvmotion 52 MiscellaneousManagementCommands 54 UsingvicfgadvcfginSpecialCircumstances 55 EnablingVMkernelModuleOptionswithvicfgmodule 55 ManagingUsersandGroupswithvicfguser 56 PerformingFileSystemOperationswithvifs 58 CommandswithanesxcfgPrefix 61

3 ManagingStoragewithvmkfstools 63
vmkfstoolsCommandSyntax 64 SpecifyingOptions 64 SpecifyingtheTarget 66 vmkfstoolsFileSystemOptions 67 vmkfstoolsVirtualDiskOptions 69

4 ManagingVirtualMachineswithvmwarecmd 77
ConnectionOptionsforvmwarecmd 78 GeneralOptionsforvmwarecmd 78 ServerOptionsforvmwarecmd 79 VirtualMachineOptionsforvmwarecmd 79 Valuesforpowerop_mode 81 vmwarecmdExamples 83

Index 85
4 VMware, Inc.

About This Book

Thisbook,theRemoteCommandLineInterfaceInstallationandReferenceGuide,explains howtoinstallandusetheVMwareRemoteCommandLineInterface(RemoteCLI) andincludesreferencedocumentationandexamplesforeachcommand. Chapter 1explainshowtoinstallRemoteCLIpackages,howtoimporttheRemote CLIappliance,andhowtoexecuteRemoteCLIcommandsonWindowsorLinux. Thechapteralsoincludesareferencetoconnectionoptionsandotheroptionsyou canusewitheachoftheRemoteCLIcommands. Chapter 2providesreferencedocumentationformostoftheRemoteCLI commands,organizedbysubjectarea.Foreachcommand,thechapterlistsand discusseseachoptionandgivesexamples. Chapter 3andChapter 4providereferencedocumentationfortwoofthemore complexRemoteCLIcommands. Chapter 3discussesvmkfstools.Itincludesinformationaboutthecommand syntax,filesystemoptions,andvirtualdiskoptions. Chapter 4discussesvmware-cmd.Itincludesinformationaboutconnection options,generaloptions,serveroptions,andvirtualmachineoptions.

Product Naming Conventions


ThisbookcoversbothESXServer3.5andESXServer3iversion3.5.Foreaseof discussion,thisbookusesthefollowingproductnamingconventions: FortopicsspecifictoESXServer3.5,thisbookusesthetermESXServer3. FortopicsspecifictoESXServer3iversion3.5,thisbookusestheterm ESX Server 3i.
VMware, Inc. 5

Remote Command-Line Interface Installation and Reference Guide

Fortopicscommontobothproducts,thisbookusesthetermESXServer. Whentheidentificationofaspecificreleaseisimportanttoadiscussion,thisbook referstotheproductbyitsfull,versionedname. WhenadiscussionappliestoallversionsofESXServerforVMware Infrastructure 3,thisbookusesthetermESXServer3.x.

Intended Audience
Thisbookisintendedforadministratorswhowanttousecommandlineinterfaces insteadoftheVMwareInfrastructureClient(VIClient)tomanageandmonitorthe VMwareInfrastructureenvironment.Theinformationinthisbookiswrittenfor experiencedWindowsorLinuxsystemadministratorswhoarefamiliarwithvirtual machinetechnologyanddatacenteroperationsandknowhowtousecommandsin scripts.

Document Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhave comments,sendyourfeedbackto: docfeedback@vmware.com

Related Documentation
TheVMwareInfrastructuredocumentationconsistsofthecombinedVMware VirtualCenterandESXServerdocumentationset.Thedocumentationsetexplainsalot ofthebackgroundinformationforthecommandsdiscussedinthisdocument,for example,storage,networking,andsoon. TheVIPerlToolkitdocumentationexplainshowyoucanusetheVIPerlToolkitand relatedutilityapplicationstomanageyourVMwareInfrastructureenvironment.You canusetheRemoteCLIcommandsinconjunctionwiththeVIPerlToolkit.

Technical Support and Education Resources


Thefollowingsectionsdescribethetechnicalsupportresourcesavailabletoyou.To accessthecurrentversionsofthisbookandotherbooks,goto: http://www.vmware.com/support/pubs.

VMware, Inc.

About This Book

Online and Telephone Support


Useonlinesupporttosubmittechnicalsupportrequests,viewyourproductand contractinformation,andregisteryourproducts.Goto: http://www.vmware.com/support Customerswithappropriatesupportcontractsshouldusetelephonesupportforthe fastestresponseonpriority1issues.Goto: http://www.vmware.com/support/phone_support.html

Support Offerings
FindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds.Goto: http://www.vmware.com/support/services

VMware Education Services


VMwarecoursesofferextensivehandsonlabs,casestudyexamples,andcourse materialsdesignedtobeusedasonthejobreferencetools.Formoreinformationabout VMwareEducationServices,goto: http://mylearn1.vmware.com/mgrreg/index.cfm

VMware, Inc.

Remote Command-Line Interface Installation and Reference Guide

VMware, Inc.

Remote CLI Installation and Execution

ThischapterexplainshowtoinstallandexecuteRemoteCLIcommandsandincludes alistofallsupportedcommandsthatpointstowhereeachcommandisdiscussed. RemoteCLIcommandsallowyoutoperformmanyoftheoperationsyoumight currentlyperformusingtheESXServer3serviceconsole.RemoteCLIcommandsare especiallyusefulforanESXServer3ihostbecauseitdoesnotincludeaserviceconsole. YoucanuseRemoteCLIcommandsinscriptsthatrunonESXServer3iandESXServer 3version3.5hosts.YoucanalsouseRemoteCLIcommandsforconsoleaccesstoESX Serverhosts. RemoteCLIcommandsrunontopofftheVMwareInfrastructurePerlToolkit(VIPerl Toolkit),whichdependsonPerlandanumberofotherlibraries.Prerequisitesoftware isincludedwiththeinstallationpackageonWindowsandonsupportedLinux distributions.YoucanuseaninstallablepackageortheRemoteCLIappliancetorun RemoteCLIandVIPerlToolkitcommands. Thischapterincludesthefollowingtopics: ListofAvailableCommandsonpage 10 UsingtheVMwareRemoteCLIonpage 12 InstallingandExecutingRemoteCLICommandsonLinuxonpage 13 InstallingandExecutingRemoteCLICommandsonWindowsonpage 15 InstallingandRunningtheRemoteCLIVirtualApplianceonpage 17 SpecifyingOptionsforRemoteCLICommandsonpage 19 AvailableOptionsforRemoteCLIExecutiononpage 22 UsingRemoteCLICommandsinScriptsonpage 25
VMware, Inc. 9

Remote Command-Line Interface Installation and Reference Guide

List of Available Commands


Table 11listsallRemoteCLIcommandsinalphabeticalorderandpointstotheRemote CLIdiscussioninthisdocument. Table 1-1. Remote CLI commands supported by ESX Server 3
Command resxtop Description MonitorsinrealtimehowESXServer hostsuseresources.Runsininteractive orbatchmode. See SeeUsingresxtopforPerformance Monitoringonpage 45foran introduction.SeetheResource ManagementGuideforadetailed reference. SeeMigratingVirtualMachinesUsing svmotiononpage 52foran introduction.SeetheBasicSystem Administrationguideforanindepth discussionthatincludesexamples. SeeUsingvicfgadvcfginSpecial Circumstancesonpage 55. SeeUsingvicfgcfgbackupfor ConfigurationInformationonpage 45. SeetheESXServer3iEmbeddedSetup Guideforanindepthdiscussionthat includesstepbystepinstructions. SeeSpecifyingtheDNSConfiguration withvicfgdnsonpage 36. SeeManagingDiagnosticPartitions withvicfgdumppartonpage 28. SeeEnablingVMkernelModule Optionswithvicfgmoduleonpage 55 SeeConfiguringStorageArrayswith vicfgmpathonpage 30. SeeManagingNASFileSystemswith vicfgnasonpage 33. SeeManagingPhysicalNICswith vicfgnicsonpage 38. SeeSpecifyingtheNTPServerwith vicfgntponpage 39. SeeRescanningwithvicfgrescanon page 34.

svmotion

Movesavirtualmachinesconfiguration fileandoptionallyitsdiskswhilethe virtualmachineisrunning. RunsonaVirtualCenterServer.

vicfgadvcfg vicfgcfgbackup

Performsadvancedconfiguration.Use thiscommandasinstructedbyVMware. Backsuptheconfigurationdataofan ESXServer3isystemandrestores previouslysavedconfigurationdata.

vicfgdns vicfgdumppart vicfgmodule

SpecifiesanESXServerhostsDNS (DomainNameSystem)configuration. Managesdiagnosticpartitions. EnablesVMkerneloptions.Usethis commandwiththeoptionslistedinthis document,orinstructedbyVMware. Configuresstoragearrays. ManagesNASfilesystems. ManagestheESXServerhostsphysical NICs. SpecifiestheNTP(NetworkTime Protocol)server. Rescansthestorageconfiguration.

vicfgmpath vicfgnas vicfgnics vicfgntp vicfgrescan

10

VMware, Inc.

Chapter 1 Remote CLI Installation and Execution

Table 1-1. Remote CLI commands supported by ESX Server 3 (Continued)


Command vicfgroute vicfgsnmp Description ManipulatestheESXServerhostsroute entry. SetsupSNMP(SimpleNetwork ManagementProtocol). See SeeManipulatingtherouteEntrywith vicfgrouteonpage 40. SeeSettingUpSNMPwith vicfgsnmponpage 47.UsingSNMPin aVMwareInfrastructureenvironmentis discussedindetailintheBasicSystem Administrationmanual. SeeSpecifyingthesyslogServerwith vicfgsyslogonpage 49.TheBasic SystemAdministrationdocument discussessystemlogsinmoredetailand explainshowtosetthemupusingtheVI Client. SeeManagingUsersandGroupswith vicfguseronpage 56. SeeFindingAvailableLUNswith vicfgvmhbadevsonpage 35. SeeManagingVMkernelNICswith vicfgvmkniconpage 41. SeeManagingVirtualSwitcheswith vicfgvswitchonpage 42. SeePerformingFileSystemOperations withvifsonpage 58. SeePerformingMaintenancewith vihostupdateonpage 50.Discussedin detailintheESXServer3iEmbedded SetupGuide. SeeManagingStoragewith vmkfstoolsonpage 63.

vicfgsyslog

Specifiesthesyslogserverandtheport toconnecttothatserverforESXServer 3ihosts.

vicfguser vicfgvmhbadevs vicfgvmknic vicfgvswitch vifs

Creates,modifies,deletes,andlistslocal directaccessusersandgroupsofusers. FindsavailableLUNsontheESXServer host. Adds,deletes,andmodifiesvirtual networkadapters(VMkernelNICs). Addsorremovesvirtualswitchesor modifiesvirtualswitchsettings. Performsfilesystemoperationssuchas retrievinganduploadingfilesonthe remoteserver. PerformsmaintenanceonESXServer3i hosts.

vihostupdate

vmkfstools

Createsandmanipulatesvirtualdisks, filesystems,logicalvolumes,and physicalstoragedevicesonanESX Serverhost. Performsvirtualmachineoperations remotely.Thisincludes,forexample, creatingasnapshot,poweringthe virtualmachineonoroff,andgetting informationaboutthevirtualmachine.

vmwarecmd

SeeManagingVirtualMachineswith vmwarecmdonpage 77.

VMware, Inc.

11

Remote Command-Line Interface Installation and Reference Guide

Using the VMware Remote CLI


YoucaninstallaRemoteCLIpackageoneitherLinuxorMicrosoftWindows,orimport avirtualappliancethatincludestheRemoteCLIandallprerequisitesoftwareintoyour ESXServerhost. RemoteCLIpackagesYoucaninstallaRemoteCLIpackageononeserver,which couldbecometheadministrationserverforallESXServerhosts.SeeInstalling andExecutingRemoteCLICommandsonLinuxonpage 13andInstallingand ExecutingRemoteCLICommandsonWindowsonpage 15. Afteryouhaveinstalledthepackage,whichincludestheVIPerlToolkit,youcan runRemoteCLIcommandsorinvokescriptsfromtheoperatingsystemcommand line.Eachtimeyourunacommand,youspecifytheconnectionparameters directlyorindirectly.SeeSpecifyingOptionsforRemoteCLICommandson page 19. RemoteCLIvirtualapplianceDownloadtheRemoteCLIvirtualapplianceand importitintoaVirtualCenterServerorESXServerhost.TheRemoteCLIvirtual applianceisavirtualmachineprepackagedwithapareddownLinuxoperating system,theVIPerlToolkit,andallRemoteCLIcommands.WhentheRemoteCLI virtualapplianceisavailableonyourESXServerhost,youcanrunRemoteCLI commandsfromtheLinuxconsoleofthevirtualappliance.SeeInstallingand RunningtheRemoteCLIVirtualApplianceonpage 17. YoucanusetheRemoteCLIcommandsinteractivelyorinscripts,asfollows: OpenoraccessaLinuxconsoleonthevirtualappliance,andenterRemoteCLI commandsthere. OpenacommandpromptonaLinuxorWindowssystemwhereyouinstalledthe RemoteCLIandentercommandsthere. PreparescriptswithsetsofRemoteCLIcommands.Thenrunthescriptsfroman administrationserverthathastheRemoteCLIpackageinstalledorfromaRemote CLIvirtualapplianceLinuxconsole.SeeUsingRemoteCLICommandsin Scriptsonpage 25.

12

VMware, Inc.

Chapter 1 Remote CLI Installation and Execution

Whenyouexecutecommands,youmustspecifytheESXServerhostonwhichyou wanttorunthecommandandtheusernameandpassword,asdiscussedin SpecifyingOptionsforRemoteCLICommandsonpage 19. CAUTIONSpecifyingthepasswordinplaintextrisksexposingthepasswordtoother users.Thepasswordmightalsobecomeexposedinbackupfiles.Provideaplaintext passwordonlyonclientsystemsthatyouconsidersecure.Providingplaintext passwordsonproductionsystemsisnotrecommended.Youhavetwochoices: IfyouuseaRemoteCLIinteractivelyanddonotspecifyausernameand password,youareprompted.Whatyoutypeisnotechoedtothescreen. Fornoninteractiveuse,youcancreateasessionfileusingthesave_session.pl scriptincludedintheapps/sessiondirectoryoftheVIPerlToolkit.SeeUsinga SessionFileonpage 19.

Installing and Executing Remote CLI Commands on Linux


ThePerlinstallationscriptfortheRemoteCLIissupportedondefaultinstallationsof thefollowingLinuxdistributions: RedHatEnterpriseLinux(RHEL)5.1 UbuntuDesktop7.10 RemoteCLIvirtualappliance Anumberofprerequisitelibrariesareincludedinthedefaultinstallationofeach supportedLinuxdistribution. TheRemoteCLIpackageinstallerinstallstheRemoteCLIscriptsandtheVIPerl Toolkit.IfyouarenotusingoneofthesupportedLinuxdistributions,youmustmake sureyoursystemhasallrequiredlibrariesinstalled.SeetheVIPerlToolkitInstallation Guideforinformationaboutrequiredlibraries.

Unpacking and Installing the Remote CLI Package


To download and unpack the Remote CLI Package 1 Downloadtheinstallerpackagefrom: http://www.vmware.com/go/remotecli. 2 3 Openashellpromptandnavigatetothedirectorytowhichyoudownloadedthe package. Unpackthedownloadedpackage.

VMware, Inc.

13

Remote Command-Line Interface Installation and Reference Guide

To install the Remote CLI Package 1 Starttheinstaller(vmware-install-rcli.pl). Theinstallerpromptsyoutoacceptthetermsofthelicenseagreement. 2 TypeyesattheprompttoacceptthelicensetermsandpressEntertocontinue.If youdonottypeyesinfullandpressEnter,theinstallercannotcontinue. Theinstallerpromptsyoutoprovideaninstallationlocationortoacceptthe default,whichis/usr/bin. 3 Specifyaninstallationdirectory,orpressEntertoacceptthedefault. TheinstallercheckswhetherthecorrectversionoftheVIPerlToolkitisinstalled onyoursystemandofferstoreplaceit. Whentheinstallationprocesscompletes: Asuccessmessageappears. Theinstallerlistsdifferentversionnumbersforrequiredmodules(ifany). Thepromptreturnstotheshellprompt. YoucanexecuteaRemoteCLIcommandtoverifythatinstallationwassuccessful. SeeExecutingRemoteCLICommandsonpage 14. AnumberofVIPerlutilityapplicationsandsamplescriptsthatperformcommon operationsonESXServerhostsandvirtualmachinesareincludedwiththeinstallation. SeetheVIPerlToolkitdocumentationforareferencetoallutilityapplications.

Executing Remote CLI Commands


AfteryouhaveinstalledtheRemoteCLI,youcanexecutecommandsfromtheLinux commandpromptorincludetheminscripts(seeUsingRemoteCLICommandsin Scriptsonpage 25). To execute a Remote CLI command from a Linux command prompt 1 2 Openacommandprompt. Executethecommandincludingtheconnectionparameters.
<command> <conn_params> <params>

Specifyconnectionparametersinaconfigurationorpassthemonthecommand line.Theextension.plisnotrequiredonLinux.

14

VMware, Inc.

Chapter 1 Remote CLI Installation and Execution

Forexample:
vicfg-nas --server my_vcserver --username u42 --password mypwd --vihost my_esxhost --list

SeeConnectionOptionsonpage 22foracompletelistofconnectionparameters.

Uninstalling the Remote CLI Package


To uninstall the Remote CLI on a Linux system 1 2 ConnecttothedirectorywhereyouinstalledtheRemoteCLI. Executethevmware-uninstall-rcli.pl script. ThecommanduninstallsboththeRemoteCLIandtheVIPerlToolkit.

Installing and Executing Remote CLI Commands on Windows


WhenyouinstalltheRemoteCLIpackageonWindows,theinstallationpackage includesallprerequisitesoftware.TheRemoteCLIpackageissupportedonthe followingWindowsoperatingsystems: WindowsVistaSP1 WindowsXPSP2

Installing the Remote CLI Package


To install the Remote CLI Package on Windows 1 DownloadtheRemoteCLIWindowsinstallerfrom http://www.vmware.com/go/remotecli. 2 Starttheinstaller. Awarningmessageabouttheinstallersdigitalsignaturemightappear. 3 ClickYestoignorethewarningmessageandcontinuewiththeinstallation. IfapreviousversionoftheVIPerlToolkitortheRemoteCLIpackageexistsonthe targetWindowssystem,theinstallerofferstorepairoruninstalltheprevious version. 4 Ifprompted,accepttheoffer,orclickNextintheWelcomepagetocontinue.

VMware, Inc.

15

Remote Command-Line Interface Installation and Reference Guide

IfyoudonotwanttoinstalltheRemoteCLIinthedefaultdirectory,clickChange andchooseadifferentdirectory. ThedefaultlocationisC:\Program Files\VMware\VMware VI Remote CLI\bin.

6 7

ClickNexttocontinue. ClickInstalltoproceedwiththeinstallation. Theinstallationmighttakeseveralminutestocomplete.

Whentheinstallationwizardfinishes,youcantesttheinstallationbyexecutinga RemoteCLIcommandorbyrunningoneoftheVIPerlToolkitsamplescriptsorutility applications.

Executing Remote CLI Commands


AfteryouinstalltheRemoteCLI,youcanexecutecommandsfromtheWindows commandpromptorincludetheminscripts(seeUsingRemoteCLICommandsin Scriptsonpage 25). To execute a Remote CLI command from a Windows command prompt 1 2 Openacommandprompt. NavigatetothedirectoryinwhichtheRemoteCLIisinstalled.
cd C:\Program Files\VMware\VMware VI Remote CLI\bin

Executethecommand,passingintheconnectionparametersandanyother options.
<command>.pl <conn_params> <params>

Theextension.plisrequired.Forexample:
vicfg-nas.pl --server my_vcserver --username u42 --password mypwd --vihost my_esxhost --list

SeeConnectionOptionsonpage 22foracompletelistofconnectionparameters.

Uninstalling the Remote CLI Package


YoucanuninstalltheRemoteCLIpackagelikeanyotherpackage.

16

VMware, Inc.

Chapter 1 Remote CLI Installation and Execution

To uninstall the Remote CLI on a Windows system 1 2 3 ChooseStart>Settings>ControlPanel>AddorRemovePrograms. Inthepanelthatappears,chooseVMwareVIRemoteCLI,andclickRemove. ClickYeswhenprompted.

ThesystemuninstallsboththeVIPerlToolkitandtheRemoteCLIpackage.

Installing and Running the Remote CLI Virtual Appliance


Avirtualapplianceisapreconfiguredvirtualmachinethatpackagesapplicationswith theoperatingsystemtheyrequire.Whenyoupowerontheappliance,aLinuxshell promptallowsyoutorunthecommandsonanESXServer3hosttowhichyouconnect remotely.TheshellisaLinuxbashshellinapareddownCentOSLinuxenvironment. Allcommandslistedinthischapteraresupported. InstallingandusingtheRemoteCLIvirtualapplianceconsistsofthesetasks: Task1:ImportingtheVirtualApplianceonpage 17 Task2:RunningtheVirtualApplianceonpage 18

Importing the Virtual Appliance


YoucanimportthevirtualappliancefromafileordirectlyfromaURLortheVMware virtualappliancemarketplace.Toimportfromafile,downloadthevirtualappliance beforeyoustarttheimportprocessfromhttp://www.vmware.com/go/remotecli. To import the virtual appliance 1 2 3 UsingaVIClient,connecttoaVirtualCenterServeroranESXServerhost. Intheinventorypane,selecttheimporthostfortheappliance. ChooseFile>VirtualAppliance>Import. TheImportVirtualAppliancewizardstarts.Youhavetheseoptions: ClickImportfromtheVMwareVirtualApplianceMarketplaceandclick Next.ClickRemoteCLIApplianceanddownloadtheappliance. ClickImportfromFile,browsetoanOVFfileyoualreadydownloaded,and clickNext. ClickImportfromURL,supplythevirtualapplianceslocationandclick Next. 4
VMware, Inc.

Acceptthelicenseagreement.
17

Remote Command-Line Interface Installation and Reference Guide

Specifyaname(optional),andchoosealocationforthevirtualmachinewhen prompted. Thewizarddisplaysalldatastoresthatareavailableandappropriate.

6 7

ChoosethedatastoretostorethevirtualmachineonandclickNext. ReviewtheinformationandclickFinish. ThewizardcreatesanappliancevirtualmachineonthehostyouselectedinStep 2. Thismighttakeafewminutes.

Running the Virtual Appliance


AftertheImportVirtualMachinewizardfinishes,anappliancevirtualmachine appearsintheVIClientinventorypane. To run the virtual appliance 1 2 3 Selectandpoweronthevirtualmachine. AccepttheEndUserLicenseAgreementandprovideapasswordfortheroot accounttologintothemachine. (Optional)IfyouwanttogivethevirtualmachineastaticIPaddress,youcanlog intothevirtualmachineconsoleastheusernetwork(samepasswordasroot)and settheIPaddressfromthere.Bydefault,thevirtualmachinehasaDHCPaddress. AftersettingtheIPaddress,runRemoteCLIcommandsorRemoteCLIscripts fromtheconsole. Youmustsupplyconnectioninformationeachtimeyourunacommand.See ConnectionOptionsonpage 22.

18

VMware, Inc.

Chapter 1 Remote CLI Installation and Execution

Specifying Options for Remote CLI Commands


WhenyouexecuteaRemoteCLIcommand,youneedtospecifyataminimumthe nameoftheexecutionserverandthenameofauserwithloginprivilegesandthe correspondingpassword.Youcanprovidetherequiredparametersinseveraldifferent ways. Atruntime,theapplianceorRemoteCLIpackagefirstprocessesanyoptionsthatare setintheconfigurationfile,nextanyenvironmentvariables,andfinallycommandline entries.Thisorderofprecedencealwaysapplies.Thatmeans,forexample,thatyou cannotoverrideanenvironmentvariablesettinginaconfigurationfile. Thissectiondiscusseshowyoucanspecifyconnectionoptionsusingasessionfile, usingenvironmentvariables,usingaconfigurationfile,orpassingparametersatthe commandline.ItalsoexplainsbrieflyhowtouseWindowsSecuritySupportProvider Interface(SSPI),whichallowsyoutoconnectwithoutspecifyingausernameor password.

Using a Session File


Youcancreateasessionfileusingthesave_session.plscriptincludedinthe apps/sessiondirectoryoftheVIPerlToolkit.Youcanthenusethatsessionfile,which doesnotrevealpasswordinformation,whenyouinvoketheRemoteCLIcommand.If thesessionfileisnotusedfor30minutes,itexpires. TheVIPerlToolkitisinstalledwhenyouinstallaRemoteCLIpackageandisalso includedintheRemoteCLIappliance. To create and use a session file 1 Connecttothedirectorywherethescriptislocated.Forexample,ifrunningon Windows:
cd C:\Program Files\VMware\VMware VI Remote CLI\Perl\apps\session

Callsave_session.plwhichhasthefollowingsyntax.
save_session.pl --savesessionfile <location> --server <vc_server> --vihost <esx_host>

Youmustsupplyconnectionparametersandthenameofasessionfileinwhichthe scriptsavesanauthenticationcookie.Forexample:
save_session.pl --savesessionfile C:\Temp\my_session --server my_vc_server --vihost myserver

Ifyouspecifyaserverbutnousernameorpassword,thescriptpromptsyou.

VMware, Inc.

19

Remote Command-Line Interface Installation and Reference Guide

Passinthesessionfileusingthe--sessionfileparameterwhenyouexecute RemoteCLIcommands,asfollows:
<command> --sessionfile <sessionfile_location> <command_options>

Forexample:
vicfg-mpath.pl --sessionfile C:\Temp\my_session --list

Ifyouuseasessionfile,anyotherconnectionparametersareignored.

Setting Environment Variables


YoucansetenvironmentvariablesinaLinuxprofile,intheEnvironmentproperties dialogboxoftheMicrosoftSystemcontrolpanel,or,forthecurrentsession,atthe commandline.Forexample:
set VI_SERVER=<your_server_name>

NOTEDonotuseescapecharactersinenvironmentvariables. SeeExample:AddingaNASDatastoretoMultipleESXServerHostsonpage 26.

Using a Configuration File


Youuseatextfilethatcontainsvariablenamesandsettingsasaconfigurationfile. VariablescorrespondingtotheparametersshowninTable 12,RemoteCLI ConnectionOptions,onpage 22. CAUTIONLimitreadaccesstoaconfigurationfilethatcontainsusercredentials.

PassintheconfigurationfilewhenyouexecuteRemoteCLIcommands,asfollows:
<command> --config <my_saved_config> --list

Forexample:
vicfg-mpath --config <my_saved_config> --list

IfyouhavemultipleVirtualCenterServerorESXServersystemsandyouadminister eachsystemindividually,youcancreatemultipleconfigurationfileswithdifferent names.Toexecuteacommandorasetofcommandsonaserver,youpassinthe --configoptionwiththeappropriatefilenameatthecommandline. Use--configtosavetheconfigurationinformationinadifferentfilethan./visdkrc. Ifyouspecify--config,thesystemignoresthe./visdkrcsettings.

20

VMware, Inc.

Chapter 1 Remote CLI Installation and Execution

Passing Parameters at the Command Line


Youcanpassparametersatthecommandlineusingoptionnameandoptionvalue pairs(someoptionshavenovalue).
--<optionname optionvalue>

Thefollowingsyntaxresults:
<command> --server <vc_server> --username <privileged_user> --password <pw> --vihost <esx_host> <--option_name option_value>

NOTEEnclosepasswordsandothertextwithspecialcharactersinquotationmarks. OnLinux,usesinglequotes( ),onWindows,usedoublequotes( ).OnLinux,you canalsouseabackslash(\)beforespecialcharacters.

Using Microsoft Windows Security Support Provider Interface (SSPI)


Youcanusethe--passthroughauthcommandlineargumenttologintoa VirtualCenterServer(VirtualCenterversion2.5Update2orlater).Using --passthroughauthpassesthecredentialsoftheexecutingusertotheserver.Ifthe executinguserisknownbyboththemachinefromwhichyouaccesstheVirtualCenter ServerandthemachinerunningtheVirtualCenterServer,noadditionalauthentication isrequired. IfRemoteCLIcommandsandtheVirtualCenterServerrunonthesamemachine,a localaccountfortheexecutinguserworks.Iftheyrunondifferentmachines,thenthe executingusermustbeanaccountinadomaintrustedbybothmachines. SSPIsupportsanumberofprotocols.Bydefault,itchoosestheNegotiateprotocol, whichindicatesthatclientandserverattempttoresolveamutuallysupportedprotocol. Alternatively,youcanuse--passthroughauthpackagetospecifyanotherprotocol supportedbySSPI.Kerberos,theWindowsstandardfordomainlevelauthentication, iscommonlychosen.IftheVirtualCenterServerisconfiguredtoacceptonlyaspecific protocol,specifyingtheprotocoltoRemoteCLIcommandswith --passthroughauthpackagemightberequiredforsuccessfulauthenticationtothe server. Ifyouuse--passthroughauth,youdontneedtospecifyauthenticationinformation inanyotherway.Youusethefollowingatthecommandline:
<command> <login_params> --passthroughauth

SeetheMicrosoftWebsiteforadetaileddiscussionofSSPI.

VMware, Inc.

21

Remote Command-Line Interface Installation and Reference Guide

Available Options for Remote CLI Execution


Table 12listsoptionsthatareavailableforallRemoteCLIcommands.Youusethe parameteronthecommandlineandthevariableinconfigurationfiles.

Connection Options
Table 12listsconnectionoptionsinalphabeticalorder.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19forthedifferentapproachesforspecifyingthe parameters.Table 13listsasmallnumberofcommonparametersthatdonotspecify logininformation. Table 1-2. Remote CLI Connection Options
Parameter and Environment Variable --config <config_file> VI_CONFIG=<config_file> --encoding <encoding> VI_ENCODING=<encoding> Description Usestheconfigurationfileatthespecifiedlocation. Specifyapaththatisreadablefromthecurrentdirectory. Specifytheencodingtobeused.Oneofcp936(SimplifiedChinese) ISO-8859-1(German),orShift_JIS(Japanese). Youcanuse--encodingtospecifytheencodingtheRemoteCLI shouldmaptowhenitisrunonaforeignlanguagesystem. --passthroughauth VI_PASSTHROUGHAUTH Ifyouspecifythisoption,thesystemusestheMicrosoftWindows SecuritySupportProviderInterface(SSPI)forauthentication.Youare notpromptedforausernameandpassword.SeetheMicrosoftWeb siteforadetaileddiscussionofSSPI. ThisoptionissupportedonlyifyouarerunningtheRemoteCLIona WindowssystemandconnectingtoaVirtualCenterServer. --passthroughauthpackage <package> VI_PASSTHROUGHAUTHPACKAGE= <package> Usethisparameterwith--passthroughauthtospecifya domainlevelauthenticationprotocoltobeusedbyWindows.By default,SSPIusestheNegotiateprotocol,whichmeansthatclient andserverattempttonegotiateaprotocolthatbothsupport. IftheVirtualCenterServertowhichyouareconnectingisconfigured touseaspecificprotocol,youcanspecifythatprotocolusingthis parameter. ThisoptionissupportedonlyifyouarerunningtheRemoteCLIona WindowssystemandconnectingtoaVirtualCenterServer.

22

VMware, Inc.

Chapter 1 Remote CLI Installation and Execution

Table 1-2. Remote CLI Connection Options (Continued)


Parameter and Environment Variable --password <passwd> VI_PASSWORD=<passwd> Description Usethespecifiedpassword(usedwith--username)tologintothe server. IfserverspecifiesaVirtualCenterServer,theusernameand passwordapplytothatserver.Youneednoauthenticationto executecommandsontheESXServerhoststhatservermanages. IfserverspecifiesanESXServerhost,theusernameand passwordapplytothatserver. Usetheemptystring(' 'onLinuxand onWindows)toindicate nopassword. Ifyoudonotspecifyausernameandpasswordonthecommandline, thesystempromptsyouanddoesnotechoyourinputtothescreen. --portnumber <number> VI_PORTNUMBER=<number> --protocol <HTTP|HTTPS> VI_PROTOCOL=<HTTP|HTTPS> --savesessionfile <file> VI_SAVESESSIONFILE=<file> --server <server> VI_SERVER=<server> UsethespecifiedporttoconnecttotheESXServerhost.Defaultis 443. UsethespecifiedprotocoltoconnecttotheESXServerhost.Default isHTTPS. Saveasessiontothespecifiedfile.Thesessionexpiresifithasbeen unusedforthirtyminutes. UsethespecifiedESXServerhostorVirtualCenterServerhost. Defaultislocalhost. If--serverpointstoaVirtualCenterServer,youusethe--vihost optiontospecifytheESXServerhostonwhichyouwanttoexecute thecommand.AcommandissupportedforVirtualCenterifthe --vihostoptionisdefined. --servicepath <path> VI_SERVICEPATH=<path> --sessionfile <file> VI_SESSIONFILE=<file> --url <url> VI_URL=<url> --username <u_name> VI_USERNAME=<u_name> Usethespecifiedusername. If--serverspecifiesaVirtualCenterServer,theusernameand passwordapplytothatserver.Youneednoauthenticationto executecommandsontheESXServerhoststhatservermanages. If--serverspecifiesanESXServerhost,theusernameand passwordapplytothatserver. Ifyoudonotspecifyausernameandpasswordonthecommandline, thesystempromptsyouanddoesnotechoyourinputtothescreen. UsethespecifiedservicepathtoconnecttotheESXServerhost. Defaultis/sdk/webService. Usethespecifiedsessionfiletoloadapreviouslysavedsession.The sessionmustbeunexpired. ConnecttothespecifiedVISDKURL.

VMware, Inc.

23

Remote Command-Line Interface Installation and Reference Guide

Other Common Options


Table 13listsasmallnumberofparametersyoucanusewheninvokingaRemoteCLI commandthatarenotusedasloginparameters. Table 1-3. Remote CLI Common Parameters
Parameter --help --verbose --version Description Printabriefusagemessage.Themessagelistsfirsteach commandspecificoptionandtheneachofthecommonoptions. Displayadditionaldebugginginformation. Displayversioninformation.

Examples for Specifying Connection Options


Thefollowingexamplesillustrateusingasessionfile,usingenvironmentvariablesina .visdkrcfile,executingaRemoteCLIcommandonthecommandline,andusingSSPI.

Example for Using a Session File


Thefollowingexamplefirstsavesasessionfile,andthencallsvicfg-mpathwithits --listoption.ThisexampleisforaLinuxenvironment.SeeTocreateandusea sessionfileonpage 19foraWindowsexample.
perl cd /usr/share/doc/vmware-viperl/samples/session perl save_session.pl --savesessionfile /tmp/vimsession --server <my_vc_server> --username <username> --password <password> --vihost <my_server> vicfg-mpath --sessionfile /tmp/vimsession --list

Youcanusethesave_session.plandload_session.plscriptsasexamplesforuse ofsessionfilesfromscripts.

Example for Using a Configuration File


Thefollowingexampleshowsthecontentsofaconfigurationfile:
VI_SERVER = 10.17.211.138 VI_USERNAME = root VI_PASSWORD = <root_password> VI_PROTOCOL = https VI_PORTNUMBER = 443

24

VMware, Inc.

Chapter 1 Remote CLI Installation and Execution

Ifyouhavesetupyoursystemtorunthisfile,youcanexecutescriptsonthespecified serverafterwards. NOTEThepasswordisinplaintext,soyoumustlimitaccesstothisfile.

Example for Using the Command Line


Thisexampleconnectstotheserverasusersnow-whitewithpassworddwarf$.This examplecallsvicfg-mpathwithnooptions.Thesystemdisplayshelpinformationfor thecommandinthatcase. Thefirstexample(Linux)usesthe\escapecharacter,theothertwousesinglequotes (Linux)anddoublequotes(Windows). Linux:
vicfg-mpath --server <server> --user snow\-white --password dwarf\$ vicfg-mpath --server <server> --user snow-white --password dwarf$

Windows

vicfg-mpath.pl --server <server> --user snow-white --password dwarf$

Example for Using an SSPI Protocol


ThefollowingexampleconnectstoaserverthathasbeensetuptouseSSPI.Whenyou runthecommand,thesystemcallsvicfg-mpathwiththe--listoption.Thesystem doesnotpromptyouforausernameandpassword.
vicfg-mpath --server <vc_server> --passthroughauth --passthroughauthpackage Kerberos

SeeUsingMicrosoftWindowsSecuritySupportProviderInterface(SSPI)onpage 21.

Using Remote CLI Commands in Scripts


Mostadministratorsrunscriptstoperformthesametaskrepeatedlyortoperforma taskonmultiplehosts.Thissectionpresentsafewtypicalscenariosandthe correspondingscripts.

VMware, Inc.

25

Remote Command-Line Interface Installation and Reference Guide

Example: Editing Files on the ESX Server Host


YoucannoteditafileontheESXServer3ihostdirectlybecauseyouhavenoservice consoleaccess.Youmustretrievethefilefromthehost,makethechangeorchanges, andthenplacethefileontheESXServer3ihost. Forexample,tochangethehostagentloglevel,youmusteditthe hostAgentConfig.xmlfile.Thefollowingscriptusesvifstodownloadthehostagent configurationfile,usessedtoreplacetheloglevelwithausersuppliedstring,and replacesthefileontheESXServerhostwiththechangedconfigurationfile.Thescript thendeletestemporaryfilesitgeneratedaspartoftheprocess.
HOST=your.hostname.com vifs --server $HOST --username admin --password xxyyzz --get /host/hostAgentConfig.xml /tmp/ha.xml sed -e "s#<level>.*</level>#<level>$1</level>#" < /tmp/ha.xml > /tmp/ha_new.xml vifs --server $HOST --username admin --password xxyyzz --put /tmp/ha_new.xml /host/hostAgentConfig.xml rm /tmp/ha.xml rm /tmp/ha_new.xml

Example: Adding a NAS Datastore to Multiple ESX Server Hosts


Whenanewdatastorebecomesavailableinyourenvironment,youmustmakethat datastoreavailabletoeachESXServerhost.Thefollowingsamplescriptillustrateshow tomakeaNASdatastoreavailabletothreehosts(esxi_server_a,esxi_server_b,and esxi_server_c). Thesampleassumesthataconfigurationfile/home/admin/.visdkrc.<hostname> existsforeachhost.Forexample,theconfigurationfileforesxi_server_ahasthe followingcontents:
VI_SERVER = esxi_server_a VI_USERNAME = root VI_PASSWORD = xysfdjkat

ThescriptitselfaddstheNASdatastorebycallingthedifferentconfigurationfiles.
#!bin/sh for i in {"esxi_server_a","esxi_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

26

VMware, Inc.

Remote CLI Reference

ThischapterisareferencetomostoftheRemoteCLIcommandsyoucanusefor administeringyourESXServerhosts.Somecommandswithmanyoptionsare discussedinseparatechapters(Chapter 3,ManagingStoragewithvmkfstools,on page 63andChapter 4,ManagingVirtualMachineswithvmwarecmd,onpage 77). Thischapterincludesthefollowingtopics: StorageManagementCommandsonpage 28 NetworkingCommandsonpage 36 SystemManagementCommandsonpage 45 VirtualMachineManagementCommandsonpage 51 MiscellaneousManagementCommandsonpage 54 PerformingFileSystemOperationswithvifsonpage 58 CommandswithanesxcfgPrefixonpage 61

VMware, Inc.

27

Remote Command-Line Interface Installation and Reference Guide

Storage Management Commands


Table 21liststheRemoteCLIstoragemanagementcommandsdiscussedinthis section. Table 2-1. Storage Management Commands
Command vicfg-dumppart vicfg-mpath vicfg-nas vicfg-rescan vicfg-vmhbadevs Description Managesdiagnostic partitions. Configuresstorage arrays. ManagesNASfile systems. Rescansthestorage configuration. FindsavailableLUNs ontheESXServerhost. See ManagingDiagnosticPartitionswithvicfgdumppart onpage 28. ConfiguringStorageArrayswithvicfgmpathon page 30. ManagingNASFileSystemswithvicfgnason page 33. Rescanningwithvicfgrescanonpage 34. FindingAvailableLUNswithvicfgvmhbadevson page 35.

Managing Diagnostic Partitions with vicfg-dumppart


Thevicfg-dumppartcommandcanquery,set,andscananESXServerhosts diagnosticpartitions.SeeCreatingaDiagnosticPartitionintheESXServer3i ConfigurationGuideandtheESXServer3ConfigurationGuide. Whenyourunvicfg-dumppart,thepartitionsconsolenameisnotdisplayed.Because thechosenpartitionisactivated,theactiveandconfiguredstatesareredundantandare notdisplayed.

Options for vicfg-dumppart


Table 22liststhecommandspecificoptionsforvicfg-dumppart.Youmustalso specifyconnectionoptions.SeeRemoteCLIConnectionOptionsonpage 22.

28

VMware, Inc.

Chapter 2 Remote CLI Reference

Table 2-2. Options for vicfg-dumppart


Option --activate <partition> -a <partition> --deactivate [<partition>] -d [<partition>] Description Activatestheconfigureddiagnosticpartitionspecifiedby <partition>.Thisoptionhasthesameeffectas--set. Deactivatesthecurrentlyactivediagnosticpartition.The optionalsounsetsthedumppartition.Specifyingthe nameofthepartitionisoptional. WARNING:Ifyourunvicfg-dumppartwiththisoption, yoursystemcannotwriteerrorstoafileuntilanother partitionisactivated.Youloseanyerrorrecordiferrors occur. --find -f FindsalldiagnosticpartitionsontheESXServerhostand printstheminthisorder:Paralleladapter,blockadapter, FibreChannel,hardwareiSCSI,softwareiSCSI.The partitionswellsuitedasdiagnosticpartitionsarelisted beforethelesssuitablepartitions. Displaystheactivediagnosticpartitionforthissystem. Runningvicfg-dumppartwiththisoptionreturnsthe internalnameofthepartition(vmbhaX:X:X:X)ornoneif nopartitionisset. Listsallpartitionsonthesystemthathavetheappropriate partitiontypetoactasanESXServerdiagnosticpartition. CAUTION:Executionmighttakeseveralminutesand slowdownyourESXServerhostbecausethecommand scansallLUNsonthesystem. --set vmbha<X:X:X:X> -s vmbha<X:X:X:X> Setstheactiveandconfigureddiagnosticpartitionforthis systemusingthevmhbanameofthepartitiontouse. Whenyousetthediagnosticpartition,itisactivated. Thereisnodistinctionbetweenanactiveandaconfigured diagnosticpartition.The--activateoptionisincluded onlyforbackwardcompatibility. --vihost <host> -h <host WhenyouexecuteaRemoteCLIwiththe--server optionpointingtoaVirtualCenterServerhost,use --vihosttospecifytheESXServerhosttoexecutethe commandon.

--get-active -t

--list -l

Examples for vicfg-dumppart


Thefollowingexamplesforvicfg-dumppartrequireconnectionoptions.See SpecifyingOptionsforRemoteCLICommandsonpage 19.
vicfg-dumppart.pl <conn_params> -t

ShowsthecurrentdiagnosticpartitiontheVMkerneluses.

VMware, Inc.

29

Remote Command-Line Interface Installation and Reference Guide

vicfg-dumppart.pl <conn_params> -s vmhba1:0:0:6

Setstheactivepartitiontovmhba1:0:0:6.Afterthecommandhasbeenexecuted,c reportsvmhba1:0:0:6astheactivepartition.
vicfg-dumppart.pl <conn_params> -l

Displaysinformationonallpartitionsthatcouldbeusedasdiagnosticpartitions.
vicfg-dumppart.pl <conn_params> -d

Deactivatesthediagnosticpartition.Afterthiscommandhasexecuted,nodiagnostic partitionisset.
vicfg-dumppart.pl <conn_params> -f

Findsallpartitionsthatcouldbeusedasdiagnosticpartitionsanddisplaysdetailed information.Theoutputmightlookasfollows.
Partition number 5 on vml.01000000005550543650334130314844334d4150333336 -> vmhba1:0:0:5 -> /dev/sda5 Partition number 6 on vml.01000000005550543650334130314844334d4150333336 -> vmhba1:0:0:6 -> /dev/sda6 Partition number 7 on vml.01000000005550543650334130314844334d4150333336 -> vmhba1:0:0:7 -> /dev/sda7 Partition number 1 on vml.010000000033485a394757375a535433373333 -> vmhba1:3:0:1 -> /dev/sdb1

Configuring Storage Arrays with vicfg-mpath


Thevicfg-mpathcommandcanconfiguremultipathsettingsforFibreChannelor iSCSILUNs.Formoreinformationonmultipathing,seeManagingMultiplePathsin theESXServer3ConfigurationGuideandtheESXServer3iConfigurationGuide.TheFibre ChannelSANConfigurationGuideandtheiSCSISANConfigurationGuidediscusssome storagespecificaspectsofmultipathing. NamesofvirtualmachineHBAsarenotguaranteedtobevalidacrossreboots.Use VMLLUNnamestobesureofconsistency.TheVMLnameofaLUNistheunique namegiventothatLUNbyVMware.ThisnameisgloballyuniquetoaLUNand remainsassociatedwithaLUNacrossreboots.

Options for vicfg-mpath


Table 23liststhecommandspecificoptionsforvicfg-mpath. NOTEIfyouarechangingthepreferredpathorifyouchangeapathsstate: ThechangeoperationfailsifI/Oisactivewhenthepathsettingischanged.Reissue thecommand. YoumustissueatleastoneI/Ooperationbeforethechangetakeseffect.
30 VMware, Inc.

Chapter 2 Remote CLI Reference

Youmustalsospecifyconnectionoptions.SeeConnectionOptionsonpage 22. Table 2-3. Options for vicfg-mpath


Option --bulk -b --detailed -d Description ShowsallLUNsandpathsinaformatthatscriptscanparseeasily. ShowsallinformationaboutaLUNanditspathsincludingtheLUNs VMLname. ALUNsVMLnameisauniquenameVMwareassignstotheLUN.This nameisgloballyuniquetoaLUNandremainsassociatedwithaLUN acrossreboots. --hbas -a --list -l --lun=<lun> -L=<lun> --path=<path> -P=<path> PrintsthelistofHBAsthatareidentifiablebyauniqueID.Thisincludes FibreChannelandiSCSIdevices.Parallelandblockdevicesdonotappear inthislist. ListsallLUNsonthesystemandthepathstotheseLUNsthrough adapters.ForeachLUN,thiscommanddisplaysthetype,internalname, consolename,size,paths,andpathselectionpolicy. RequiredtospecifytheLUNtouseinoperations.Thisoptionisarequired parameterforotheroptionsandisnotusedbyitself. Requiredtospecifythepathtouseinoperations.Thisoptionisarequired parameterforotheroptionsandisnotusedbyitself. ThepathnamecanbeeitherthelongpathUIDortheshorterruntime nameofthepath.Youcanuse--pathtofilterwhatthelistcommands return. --policy [mru|fixed] -p [mru|fixed] SetthepolicyforagivenLUNtomruorfixed.Thisoptionrequiresthe --lunoption. MostRecentlyUsed(mru)selectsthemostrecentlyusedpathtosend I/Otoadevice. Fixed(fixed)usesonlytheactivepath. Twoadditionalpolicies,roundrobin(rr)andcustomareavailableonan experimentalbasis.SeethetechnicalnoteRoundRobinLoadBalancing. --preferred -f --query -q --state [on|off] -s [on|off] --vihost <host> -h <host> SetthespecifiedpathtobethepreferredpathforaspecifiedLUN.When yousetthisoption,youmustalsosetthe--lunand--pathoptions. QueryaspecificLUNforitsinformationandprinttheinformation.When yousetthisoption,youmustalsosetthe--lunoption. SetthestateofagivenLUNpathtoeitheronoroff. Thisoptionrequiresthatboththe--lunand--pathoptionsarealsoset. WhenyouexecuteaRemoteCLIwiththe--serveroptionpointingtoa VirtualCenterServerhost,use--vihosttospecifytheESX Server 3host toexecutethecommandon.

VMware, Inc.

31

Remote Command-Line Interface Installation and Reference Guide

Examples for vicfg-mpath


Thefollowingexamplesforvicfg-mpathrequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vicfg-mpath.pl <conn_params> -l

Displaysallavailablepaths.
vicfg-mpath.pl <conn_params> -q --lun=vml.123456

Displaysthepathsfordiskvml.123456.
vicfg-mpath.pl <conn_params> --policy=mru --lun=vmhba0:0:1

Setsthepathpolicyfordiskvmhba0:0:1tomru.
vicfg-mpath.pl <conn_params> --path=vmhba1:0:1 --lun=vmhba0:0:1 --state=on

Enablesapathfordiskvmhba0:0:1.
vicfg-mpath.pl <conn_params> --path=vmhba0:1:1 --state=off --lun=vmhba0:0:1 -p fixed

Disablesapathandsetsthepolicytofixedfordiskvmhba0:0:1.
vicfg-mpath.pl <conn_params> -l

ListsallLUNsonthesystemandthepathstotheseLUNsthroughadapters.
vicfg-mpath.pl <conn_params> -a

DisplaysLUNinformation.Resultsinoutputlikethefollowing.
vmhba2 2305843973628581845 42:2.0 vmhba3 2305843973628747050 4c:00.0 vmhba4 2306125448607554858 4c:00.1 vmhba5 50:1.1 vicfg-mpath.pl <conn_params> -b

Returnsabulkpathlistsuitableforparsing.
vicfg-mpath.pl <conn_params> --policy fixed --path vmhba2:0:1 --lun vmhba2:0:1 --preferred

Setsthepreferredpath.Resultsinoutputlikethefollowing:
Setting vmhba2:0:1 -- vmhba2:0:1 as preferred path Setting vmhba2:0:1 policy to fixed

32

VMware, Inc.

Chapter 2 Remote CLI Reference

Managing NAS File Systems with vicfg-nas


Thevicfg-nascommandcanmanipulateNASfilesystemsassociatedwithyourESX Serverhost.FormoreinformationonworkingwithNASfilesystems,seeNetwork AttachedStorageintheESXServer3ConfigurationGuideandtheESXServer3i ConfigurationGuide.

Options for vicfg-nas


Table 24liststhecommandspecificoptionsforvicfg-nas.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-4. Options for vicfg-nas
Option --add <name> -a <name> Description AddsanewNASfilesystemtotheESXServerhost. Whenyouusethisoption,youmustalsousethe-oand-s options,andmustspecifyalabelnameforthenewfilesystem. DeletesaNASfilesystem. ThiscommandunmountstheNASfilesystemandremovesit fromthelistofknownfilesystems. ListsallknownNASfilesystemswiththeirmountname,share name,andhostnameandindicatesforeachfilesystemwhether itismounted. Usedwiththe-aoptiontosupplythehostnameforanewNAS filesystem. Usedwiththe-aoptiontosupplythesharenameforanew NASfilesystem. WhenyouexecuteaRemoteCLIwiththe--serveroption pointingtoaVirtualCenterServerhost,use--vihosttospecify theESXServerhosttoexecutethecommandon.

--delete -d

--list -l --nasserver <n_host> -o <n_host> --share <share> -s <share> --vihost <host> -h <host>

Examples for vicfg-nas


Thefollowingexamplesforvicfg-nasrequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vicfg-nas.pl <conn_params> -l

ListsallknownNASfilesystemswiththeirmountname,sharename,andhostname. Indicatesforeachfilesystemwhetheritismounted.
vicfg-nas.pl <conn_params> -a

AddsanewNASfilesystemtotheESXServerhost.Thiscommandaddsanentryto theknownNASfilesystemlist.
VMware, Inc. 33

Remote Command-Line Interface Installation and Reference Guide

vicfg-nas.pl <conn_params> -d

DeletesaNASfilesystem.ThiscommandunmountstheNASfilesystemandremoves itfromthelistofknownfilesystems.
vicfg-nas.pl <conn_params> -a -s new_share

AddsanewNASfilesystemtotheESXServerhost.Thiscommandaddsanentryto theknownNASfilesystemlistandsuppliesthesharenameofthenewNASfile system.

Rescanning with vicfg-rescan


Aftercertainstoragemanagementoperations,youmustperformarescanoperation usingvicfg-rescan.SeePerformingaRescanintheESXServer3iConfiguration GuideandtheESXServer3ConfigurationGuide.TheFibreChannelSANConfiguration GuidediscussesrescanonFibreChannelstorageindetail. WhenyouperformarescanonanESXServerhost,thecommandreturnsonlyan indicationofsuccessorfailureandnodetailedinformation.

Options for vicfg-rescan


Table 25liststhecommandspecificoptionsforvicfg-rescan.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-5. Options for vicfg-rescan
Option <vmkernel_SCSI_adapter_name> --vihost <host> -h <host> Description Nameoftheadaptertoscan,forexample,vmhba0. WhenyouexecuteaRemoteCLIwiththe--server optionpointingtoaVirtualCenterServerhost,use --vihosttospecifytheESXServerhosttoexecutethe commandon.

Example for vicfg-rescan


Thefollowingexampleforvicfg-rescanrequiresconnectionoptions.See ConnectionOptionsonpage 22.
vicfg-rescan.pl <conn_params> vmbha0

Resultsinoutputlikethefollowing:
Scan operation succeeded

34

VMware, Inc.

Chapter 2 Remote CLI Reference

Finding Available LUNs with vicfg-vmhbadevs


Thevicfg-vmhbadevscommandcandisplayinformationaboutavailableLUNson ESXServerhosts.

Options for vicfg-vmhbadevs


Table 26liststhecommandspecificoptionsforvicfg-nas.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-6. Options for vicfg-vmhbadevs
Option --query -q --vihost <host> -h <host> --vmfs -m Description Printstheoutputin2.5compatibilitymode. WhenyouexecuteaRemoteCLIwiththe--serveroptionpointingto aVirtualCenterServerhost,use--vihosttospecifytheESXServer hosttoexecutethecommandon. PrintstheVMFSUUIDaswellasthevmhbaand/devnamesifthe LUNisaVMFSvolume.

Examples for vicfg-vmhbadevs


Thefollowingexamplesforvicfg-vmhbadevsrequireconnectionoptions.See SpecifyingOptionsforRemoteCLICommandsonpage 19.Theexamplesillustrate theoutputthatmightresultfromexecutingvicfg-vmhbadevs.
#vicfg-vmhbadevs.pl <conn_params> -q vmhba0:1:1 /vmfs/devices/disks/vml.0100000005550543650334330323656424d4150333336 #vicfg-vmhbadevs.pl <conn_params> --vmfs /vmfs/devices/disks/vml.0100000005550543650334330323656424d4150333336 46f14706-2083a0f5-491f-001b7803ba96 #vicfg-vmhbadevs.pl <conn_params> -m vmhba1:0:0:2 vmhba1:0:0:2 /vmfs/devices/disks/vml.0100000005550543650334330323656424d4150333336 46f14706-2083a0f5-491f-001b7803ba96

VMware, Inc.

35

Remote Command-Line Interface Installation and Reference Guide

Networking Commands
Table 27listsRemoteCLInetworkingcommandsdiscussedinthissection.Foran introductiontonetworkingintheVirtualInfrastructure,seeChapter2,Networking, intheESXServer3iConfigurationGuideandtheESXServer3ConfigurationGuide. Table 2-7. Remote CLI Networking Commands
Command vicfg-dns vicfg-nics vicfg-ntp vicfg-route vicfg-vmknic vicfg-vswitch Description SpecifiesanESXServerhostsDNS configuration. ManagestheESXServerhosts physicalNICs. SpecifiestheNTPserver. ManipulatestheESXServerhosts routeentry. Adds,deletes,andmodifies VMkernelNICs. Addsorremovesvirtualswitches ormodifiesvirtualswitchsettings. See SpecifyingtheDNSConfigurationwith vicfgdnsonpage 36 ManagingPhysicalNICswithvicfgnicson page 38 SpecifyingtheNTPServerwithvicfgntpon page 39 ManipulatingtherouteEntrywith vicfgrouteonpage 40 ManagingVMkernelNICswith vicfgvmkniconpage 41 ManagingVirtualSwitcheswith vicfgvswitchonpage 42

Specifying the DNS Configuration with vicfg-dns


Thevicfg-dnscommandcanlistandspecifyyourESXServerhostsDNS configuration.Callthecommandwithoutanycommandspecificoptionstolistthe existingDNSconfiguration.

Options for vicfg-dns


Table 28liststhecommandspecificoptionsforvicfg-dns.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22.

Table 2-8. Options for vicfg-dns


Option --hostname <h_name> -n <h_name> --domain <d_name> -d <d_name> --dhcp yes|no -H yes|no Description HumanreadablehostnameportionoftheDNSname. DomainnameportionforthisESXServerhost. IndicateswhetherornottheESXServerhostusesDHCP(dynamic hostcontrolprotocol)toautomaticallydetermineDNS configuration.Youmustspecifythestringyesorthestringno.

36

VMware, Inc.

Chapter 2 Remote CLI Reference

Table 2-8. Options for vicfg-dns (Continued)


Option --dns <server_list> -D <server_list> --vihost -h --vmnic -V Description DNSserverorserverstobeused.Specifyacommaseparatedlist ofDNSservers,inorderofpreference. WhenyouexecuteaRemoteCLIwiththe--serveroption pointingtoaVirtualCenterServerhost,use--vihosttospecify theESXServerhosttoexecutethecommandon. Thevirtualnetworkadaptertousewhenoverridingthesystem DNS. Thisparameterisrequiredwhen--dhcpisyes.ForESXServer hosts,itmustbeoneoftheServiceConsolenetworkadaptersand forESXServer3ihosts,itmustbeoneoftheVMkernelnetwork adapter. ThespecifiedvirtualnetworkadaptermusthaveDHCP configured.

Examples for vicfg-dns


Thefollowingexamplesforvicfg-dnsrequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vicfg-dns.pl <conn_params> -n dns_host_name

Configuresthehostnameforthespecifiedserver.
vicfg-dns.pl <conn_params> -d mydomain.biz

Configuresthedomainnameforthespecifiedserver.
vicfg-dns.pl <conn_params> -H yes

SpecifiesthatthehostshoulduseDHCPtodeterminetheDNSconfiguration.
vicfg-dns.pl <conn_params>

DisplaysDNSpropertiesforthespecifiedserver.Theinformationincludesthehost name,domainname,DHCPsetting(trueorfalse),andDNSserversontheESXServer host.Forexample:


Host Name Domain Name DHCP DNS Servers localhost localdomain true 10.17.XXX.1 10.17.XXX.2

VMware, Inc.

37

Remote Command-Line Interface Installation and Reference Guide

Managing Physical NICs with vicfg-nics


Thevicfg-nicscommandcanmanagephysicalNICs,thatis,theEthernetswitches usedbyanESXServerhost.The--listoptionprintstheVMkernelnameforthe networkadapter,itsPCIID,driver,linkstate,speed,duplex,andashortPCI descriptionofthecard. Youcanalsousevicfg-nicstospecifyspeedandduplexsettingsforaNIC.

Options for vicfg-nics


Table 29liststhecommandspecificoptionsforvicfg-nics.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-9. Options for vicfg-nics
Option --auto -a --duplex [full|half] <nic> -d [full|half] <nic> Description Setsthespecifiednetworkadaptertoautonegotiateits speedandduplexsettings. Setstheduplexvalueatwhichagivennetworkadapter shouldruntoeitherfull(transmitdatainbothdirections atthesametime)orhalf(transmitdatainonedirection atatime). Liststhenetworkadaptersinthesystem,andprintstheir currentandconfiguredspeedandduplexinformation. Setsthespeedatwhichagivennetworkadaptershould run.Validvaluesfor<speed>are10,100,1000,or10000. WhenyouexecuteaRemoteCLIwiththe--server optionpointingtoaVirtualCenterServerhost,use --vihosttospecifytheESXServerhosttoexecutethe commandon.

--list -l --speed <speed> <nic> -s <speed> <nic> --vihost <host> -h <host>

Examples for vicfg-nics


Thefollowingexamplesforvicfg-nicsrequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vicfg-nics.pl <conn_params> -d full -s 100 vmnic0

Setstheduplexsettingofvmnic0tofullandthespeedto100.
vicfg-nics.pl <conn_params> -a vmknic2

Setsvmknic2toautonegotiateitsspeedandduplexsettings.
vicfg-nics.pl <conn_params> -l

ListstheNICsinthesystem,andprinttheircurrentandconfiguredspeedandduplex.
38 VMware, Inc.

Chapter 2 Remote CLI Reference

Thesystemreturnsatablethatincludesthename,PCI,Driver,linkspeed,duplexMTU, anddescriptioninformation,forexample: Name


vmnic1 vmnic2 vmnic0

PCI
02:02.0 e1000 02:04.0 e1000 00:02.0 e1000

Driver Link
Up Down Up

Speed
1000Mbps

Duplex
Full

MTU 1500

Description
<desc> <desc>

1000Mbps

Full

1500

<desc>

Specifying the NTP Server with vicfg-ntp


Thevicfg-ntpcommandallowsyoutospecifytheNTP(NetworkTimeProtocol) serverforanESXServerhost.Someprotocols,suchasKerberos,musthaveaccurate informationaboutthecurrenttime. To set up NTP for your ESX Server 1 2 Callvicfg-ntp --add toaddtheNTPserver. Callvicfg-ntp --starttostarttheserviceorvicfg-ntp --listtolistthe service.

Options for vicfg-ntp


Table 210liststhecommandspecificoptionsforvicfg-ntp.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-10. Option for vicfg-ntp
Option --add <ntp_server> -a <ntp_server> --delete <server> -d <server> --list -l --start -r --stop -s --vihost <host> -h <host> Description AddstheNTPserverthatthehostnameorIPaddressspecify. DeletestheNTPserverthatthehostnameorIPaddressspecify. DisplaysalistofallNTPserversusedbythishost. StartstheNTPserviceonthehost. StopstheNTPserviceonthehost. WhenyouexecuteaRemoteCLIwiththe--serveroption pointingtoaVirtualCenterServerhost,use--vihosttospecify theESXServerhosttoexecutethecommandon.

VMware, Inc.

39

Remote Command-Line Interface Installation and Reference Guide

Examples for vicfg-ntp


Thefollowingexamplesforvicfg-ntprequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vicfg-ntp.pl <conn_params> -l

DisplaysalistofNTPserversusedbythishost,orNo NTP Servers configured.


vicfg-ntp.pl <conn_params> --start

StartstheNTPserviceonthespecifiedhost.
vicfg-ntp.pl <conn_params> -a 192.168.XXX.XXX

Addsthehostspecifiedby192.168.XXX.XXXasaremoteNTPserver.

Manipulating the route Entry with vicfg-route


Thevicfg-routecommandcanlistorsetthedefaultIPgateway.Changingthe gatewaymightberequiredifyoumoveyourESXServerhosttoanewphysical location.ThecommandsupportsasubsetoftheLinuxroutecommandsoptions. Ifnooptionsarespecified,thecommandprintsthedefaultgateway.Youcansetthe defaultgatewaybyexecutingvicfg-route <gateway>.

Options for vicfg-route


Table 211liststhecommandspecificoptionsforvicfg-route.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-11. Options for vicfg-route
Option <gateway> --vihost <host> -h <host> Description TheIPaddressorthehostnameofthemachinethatshouldbesetas thegatewayfortheVMkernelIPstack. WhenyouexecuteaRemoteCLIwiththe--serveroptionpointing toaVirtualCenterServerhost,use--vihosttospecifytheESX Serverhosttoexecutethecommandon.

Examples for vicfg-route


Thefollowingexamplesforvicfg-routerequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vicfg-route.pl <conn_params>

ListstheVMkernelIPstacksdefaultgatewayentry.

40

VMware, Inc.

Chapter 2 Remote CLI Reference

vicfg-route.pl <conn_params> 10.17.XXX.XXX

SetsthedefaultgatewayfortheESXServerhostspecifiedin<conn_params>to 10.17.XXX.XXX.

Managing VMkernel NICs with vicfg-vmknic


Thevicfg-vmkniccommandcanconfigurevirtualnetworkadapters. The<port_group>argumentusedwiththe--deland--enableoptionsspecifiesthe portgrouptheVMkernelNICisassociatedwith.

Options for vicfg-vmknic


Table 212liststhecommandspecificoptionsforvicfg-vmknic.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-12. Options for vicfg-vmknic
Option <port-group> --add -a Description Requiredargument.Specifiestheportgroup.Thenameisthe sameastheVMkernelNICname. Addsavirtualnetworkadaptertothesystem.Youmust specifyIPparametersandaportgroupname.Thenewly addedvirtualnetworkadapterisenabledwhenthe commandcompletessuccessfully. Deletesthevirtualnetworkadapteronthespecifiedport group. SetstheIPaddress(X.X.X.X)tobeusedforthevirtual networkadapter.WhenyousetanIPaddress,youmust specifythe--netmaskoptioninthesamecommand. IfyouspecifyDHCPinsteadofanIPaddress,DHCPmustbe supportedintheVMkernel. --list -l --netmask <netmask> -n --vihost <host> -h <host> Listsvirtualnetworkadaptersonthesystem.Thelist containsthenetworkinformation,portgroup,MTU,and currentstateforeachvirtualnetworkadapterinthesystem. IPnetmask(X.X.X.X)tobeusedforthevirtualnetwork adapter.Whenyousetanetmask,youmustspecifythe--ip optioninthesamecommand. WhenyouexecuteaRemoteCLIwiththe--serveroption pointingtoaVirtualCenterServerhost,use--vihostto specifytheESXServerhostonwhichyouwanttoexecutethe command.

--delete <port_group> -d <port_group> --ip <ipaddress> | DHCP -i <ipaddress> | DHCP

VMware, Inc.

41

Remote Command-Line Interface Installation and Reference Guide

Examples for vicfg-vmknic


Thefollowingexamplesforvicfg-vmknicrequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vicfg-vmknic.pl <conn_params> -a -ip 192.168.XXX.XXX -n 255.255.255.0 "VMkernel NIC Name"

AddsthespecifiedVMkernelNICtothesystem.
vicfg-vmknic.pl <conn_params> -d "VMkernel NIC Name"

DeletesthespecifiedVMkernelNICfromthesystem.
vicfg-vmknic.pl <conn_params> --ip <IP address> -n <net mask> "VMkernel NIC Name

ModifiestheVMkernelNICsIPaddressandnetmask.
vicfg-vmknic.pl <conn_params> --ip DHCP "VMkernel NIC Name"

SetsthespecifiedVMkernelNICtouseDHCP.

Managing Virtual Switches with vicfg-vswitch


Thevicfg-vswitchcommandcanaddorremovevirtualswitchesormodifyvirtual switchsettings.Avirtualswitchisanabstractednetworkdevice.Itcanroutetraffic internallybetweenvirtualmachinesandlinktoexternalnetworks.SeeVirtual SwitchesintheESXServer3iConfigurationGuideandtheESXServer3Configuration Guide. Bydefault,eachvirtualmachinehasasinglevirtualswitchcalledvSwitch0.

Options for vicfg-vswitch


Table 213liststhecommandspecificoptionsforvicfg-vswitch.Youmustalso specifyconnectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-13. Options for vicfg-vswitch
Option --add <vswitch_name> -a<vswitch_name> --add-pg <portgroup> <switch> -A <portgroup> <switch> Description Addsthespecifiedvirtualswitchtothesystem. Addsaportgrouptothespecifiedvirtualswitch.

42

VMware, Inc.

Chapter 2 Remote CLI Reference

Table 2-13. Options for vicfg-vswitch (Continued)


Option --check <virtual_switch> -c<virtual_switch> Description Checkwhetheravirtualswitchexists.Prints1ifthe switchexistsandprints0otherwise. Usethevirtualswitchname,e.g.vSwitch0or vSwitch1,tospecifythevirtualswitch. --check-pg <port_group> -C <port_group> --delete <vswitch_name> -d <vswitch_name> Checkswhetherthespecifiedportgroupexists. Deletesavirtualswitch.Executingthecommandwith thisoptionfailsifanyportsonthevirtualswitchare stillinusebyVMkernelnetworks,vswifs,orvirtual machines. Deletesaportgroupfromthevirtualswitch. Executingthecommandwiththisoptionfailsifthe portgroupisinuse,forexample,byavirtualmachine oraVMkernelnetwork. Addsanuplinkadapter(physicalNIC)toavirtual switch.Executingthecommandwiththisoption attachesanewunusedphysicalnetworkadaptertoa virtualswitch. Listsallvirtualswitchesandtheirportgroups. SetstheMTU(maximumtransmissionunit)ofthe virtualswitch.ThisoptionaffectsallphysicalNICs assignedtothevirtualswitch. Providesthenameoftheportgroupforthe--vlan option.SpecifyALLtosetVLANIDsonallport groupsofavirtualswitch. RemovesaphysicalNICfromavirtualswitch.A physicalNICisaphysicalEthernetadaptertowhich thevirtualswitchisconnected.Ifyouremovethelast NIC,youlosephysicalnetworkconnectivityforthat switch. WhenyouexecuteaRemoteCLIwiththe--server optionpointingtoaVirtualCenterServerhost,use --vihosttospecifytheESXServerhosttoexecute thecommandon. SetstheVLANIDforaspecificportgroupofavirtual switch.Settingtheoptionto0disablestheVLANfor thisportgroup. Ifyouspecifythisoption,youmustalsospecifythe --pgoption.

--del-pg <portgroup> -D <portgroup>

--link <pnic> -L <pnic>

--list -l --mtu <virtual_switch> -m <virtual_switch> --pg <port group> -p <port group> --unlink <pnic> -U <pnic>

--vihost <host> -h <host>

--vlan -v

VMware, Inc.

43

Remote Command-Line Interface Installation and Reference Guide

Examples for vicfg-vswitch


Thefollowingexamplesforvicfg-vswitchrequireconnectionoptions.See SpecifyingOptionsforRemoteCLICommandsonpage 19.
vicfg-vswitch.pl <conn_params> --add vSwitch1

AddsvSwitch1asavirtualswitch.
vicfg-vswitch.pl <conn_params> --add-pg=group1 vSwitch0

AddsaportgrouptovSwitch0.
vicfg-vswitch.pl <conn_params> -c vSwitch0

CheckswhethervSwitch0exists.Prints1iftheswitchexists,0iftheswitchdoesnot exist.
vicfg-vswitch.pl <conn_params> -m 9000 vSwitch0

SetstheMTUofthevirtualswitchvSwitch0to9000.
vicfg-vswitch.pl <conn_params> -l

Printsinformationaboutthevirtualswitch.SeeSampleOutputfromvicfgvswitchl. Sample Output from vicfg-vswitch -l Thefollowingoutputmightresultfromacalltovicfg-vswitch -l.


Switch Name vSwitch0 Num Ports 64 VLAN ID 0 0 0 Num Ports 64 VLAN ID 0 0 0 Used Ports 5 MTU 1500 Used Ports 0 0 1 Used Ports 1 MTU 1500 Used Ports 0 0 1 Uplinks Uplinks vmnic2,vmnic0 Uplinks vmnic0,vmnic2 vmnic0,vmnic2 vmnic0,vmnic2 Uplinks

PortGroup Name group1 group2 group3 Switch Name vSwitch1

PortGroup Name bldg1 bldg2 bldg3

44

VMware, Inc.

Chapter 2 Remote CLI Reference

System Management Commands


AnumberofRemoteCLIcommandsallowyoutoperformsystemconfigurationand performancemonitoring. Table 2-14. System Management Commands
Command resxtop vicfg-cfgbackup Description MonitorsinrealtimehowESXServer hostsuseresources. Backsuptheconfigurationdataofan ESXServer3isystemandrestores previouslysavedconfigurationdata. SetsupSNMP(SimpleNetwork ManagementProtocol). Specifiesthesyslogserverandtheport toconnecttothatserverforESXServer 3ihosts. PerformsmaintenanceonESXServer3i hosts. See UsingresxtopforPerformance Monitoringonpage 45 Usingvicfgcfgbackupfor ConfigurationInformationonpage 45 SettingUpSNMPwithvicfgsnmp onpage 47 SpecifyingthesyslogServerwith vicfgsyslogonpage 49 PerformingMaintenancewith vihostupdateonpage 50

vicfg-snmp vicfg-syslog

vihostupdate

Using resxtop for Performance Monitoring


TheresxtopRemoteCLIcommandallowsyoutoexaminehowESXServerhostsuse resources.Youcanusetheutilityinoneofthreemodes:interactive(default),batch,or replay.TheResourceManagementGuideexplainshowtouseresxtopineachofthese modesandprovidesinformationaboutavailablecommandsanddisplaystatistics.

Using vicfg-cfgbackup for Configuration Information


Thevicfg-cfgbackupcommandcanbackupESXServer3iconfigurationdataand restorethemlater. VMwarerecommendsthatyoubackupyourhostconfigurationafteryouchangethe configurationorupgradetheESXServer3iimage. TheESXServer3iEmbeddedSetupGuideandESXServer3iInstallableSetupGuidediscuss backingupandrestoringESXServer3iconfiguration. NOTEThiscommandisnotavailableforESXServer3version3.5andcannotbe executedfromtheVirtualCenterServer.

VMware, Inc.

45

Remote Command-Line Interface Installation and Reference Guide

Options for vicfg-cfgbackup


Table 215liststhecommandspecificoptionsforvicfg-cfgbackup.Youmustalso specifyconnectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-15. Options for vicfg-cfgbackup
Option --force -f --load <backupfile> -l <backupfile> --quiet -q --reset -r --save <backupfile> -s <backupfile> Doesnotpromptforuserconfirmation. Resetsthehost,thatis,restorestofactorysettings. Backsupthehostconfigurationto<backupfile>. Forthebackupfilename,includethenumberofthebuildthatis runningonthehostthatyouarebackingup.Ifyouarerunningthe RemoteCLIfromtheRemoteCLIvirtualappliance,thebackup fileissavedlocallyonthevirtualappliance.Localstoragefor backupfilesissafebecausevirtualappliancesarestoredinthe directory/vmfs/volumes/<datastore>,whichisseparatefrom theESXServer3iimageandconfigurationfiles. Description Forcestherestoreoftheconfiguration. Restoresconfigurationfrom<backupfile>ontothehost.

Examples for vicfg-cfgbackup


Thefollowingexamplesforvicfg-cfgbackuprequireconnectionoptions.See SpecifyingOptionsforRemoteCLICommandsonpage 19.
vicfg-cfgbackup.pl <conn_params> -s C:\backup.txt

Backsupthehostconfiguration.
vicfg-cfgbackup.pl <conn_params> -r

Restoresthehosttofactorysettings.
vicfg-cfgbackup.pl <conn_params> -l C:\backup.txt

Restoresthehosttoaconfigurationyoupreviouslysavedtoafile.
vicfg-cfgbackup.pl --server <myserver -l C:\backup.txt -q

Restoresthehosttoaconfigurationyoupreviouslysavedtoafile,anddoesnotprompt forconfirmation.

46

VMware, Inc.

Chapter 2 Remote CLI Reference

Setting Up SNMP with vicfg-snmp


SimpleNetworkManagementProtocol(SNMP)allowsmanagementprogramsto monitorandcontrolnetworkeddevices.TheBasicSystemAdministrationmanual discussesusingSNMPinyourVMwareInfrastructureenvironmentinsomedetail. ESXServer3ishipswithanSNMPmanagementagentdifferentfromtheagentthat runsintheESXServer3serviceconsole.Currently,theESXServer3iSNMPagent supportsonlySNMPtraps,notGETSandisoffbydefault. ThiscommandisnotsupportedonVirtualCenterServer. To set up the SNMP agent 1 2 3 EnabletheSNMPservice(vicfg-snmp --enable). Specifyatleastonecommunity(vicfg-snmp --communities). Configureatrapdestination(vicfg-snmp --targets).

Options for vicfg-snmp


Table 216liststhecommandspecificoptionsforvicfg-snmp.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-16. vicfg-snmp Command Options
Option --communities <comm1>[,...] -c <comm1>[,...] --disable -D --enable -E --port <port-number> -p <port-number> --reset -r --show -s SetstheportusedbytheSNMPagent.Thedefaultis UDP162. Clearsallpreviouslyspecifiedcommunitiesand targets. DisplaysthecurrentSNMPconfiguration. StartstheSNMPservice. Description Specifiescommunitiesseparatedbycommas.The settingsspecifiedusingthisoptionoverwriteany previoussettings. StopstheSNMPservice.

VMware, Inc.

47

Remote Command-Line Interface Installation and Reference Guide

Table 2-16. vicfg-snmp Command Options (Continued)


Option --targets <hostname[@port]> </community>[,...] -t <hostname[@port]> </community>[,...] --test -T Description Setthedestinationfor(notifications)traps.The settingsspecifiedusingthisflagoverwriteany previoussettings. Sendatestnotificationthatcanbeusedtovalidatethe SNMPconfiguration.

Examples for vicfg-snmp


Thefollowingexamplesforvicfg-snmprequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vicfg-snmp.pl <conn_params> -c public

Setsthecommunitytopublic.
vicfg-snmp.pl <conn_params> -c my_comm1,my_comm2

Setsmy_comm1andmy_comm2asthecommunities,overwritinganyexisting communities.
vicfg-snmp.pl <conn_params> -E

EnablestheSNMPservice.
vicfg-snmp.pl <conn_params> -p 163

SetstheSNMPagentporttoport163.
vicfg-snmp.pl <conn_params> -s

DisplaystheSNMPagentconfiguration.Returnsinformationlikethefollowing:
Current SNMP agent settinegs: Enabled: 0 UDP port: 161 Communities: Notification targets:

48

VMware, Inc.

Chapter 2 Remote CLI Reference

Specifying the syslog Server with vicfg-syslog


Thevicfg-syslogcommandallowsyoutospecifyaremotesyslogserverforanESX Server3ihost.YoucannotexecutethiscommandonanESXServerversion3.5hostor aVirtualCenterServer. TheBasicSystemAdministrationmanualdiscussessystemlogsinmoredetailand explainshowtosetthemupusingtheVIClient.

Options for vicfg-syslog


Table 217liststhecommandspecificoptionsforvicfg-syslog.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-17. Option for vicfg-syslog
Option --setport -p --setserver <sys_server> -s <sys_server> --show -i --vihost <host> -h <host> Description Setstheportforthesyslogserver.Canbeusedwith-s. HostnameorIPaddressoftheremotesyslogserver.Can beusedwith-p. Displaystheremotesyslogserver,ifasyslogserverhas beensetup. WhenyouexecuteaRemoteCLIwiththe--server optionpointingtoaVirtualCenterServerhost,use --vihosttospecifytheESXServerhosttoexecutethe commandon.

Examples for vicfg-syslog


Thefollowingexamplesforvicfg-syslogrequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vicfg-syslog.pl <conn_params> -i

Displaysthesyslogserverconfiguration.
vicfg-syslog.pl <conn_params> -s mysyslogserver

Makesmysyslogserverthesyslogserverfortheserverspecifiedin<conn_params>.
vicfg-syslog.pl <conn_params> -p <port>

Setstheportnumberusedbythesyslogserver.

VMware, Inc.

49

Remote Command-Line Interface Installation and Reference Guide

Performing Maintenance with vihostupdate


ThevihostupdatecommandallowsyoutoperformmaintenanceofyourESXServer 3ihosts.Thecommandcaninstallsoftwareupdates,enforcesoftwareupdatepolicies, andtrackinstalledsoftware. NOTEThevihostupdatecommandissupportedonlyonESXServer3i.For maintenanceofyourESXServer3version3.5host,usetheesxupdatecommand.This commandisnotsupportedonVirtualCenterServer. Softwareupdatesmightbepatchesforaddressingcriticalsecurityissuesorurgentbug fixes,ortheymightbegeneralupdatesormaintenancereleases.Theymightbelocated onthelocalfilesystemoronanNFS,FTP,orHTTPserver.Eachupdateconsistsofa descriptorfileandasetofpackages.Thedescriptorcontrolstheinstallationprocessand checksthatrequirementsaremet.Forexample,youmightberequiredtopoweroffall virtualmachinesrunningontheserveryouareabouttoupdate,oryoumightneedto reboottheserveraftertheupdate. Foradetaileddiscussionofvihostupdate,seetheESXServer3iSetupGuide. To update the firmware of an ESX Server 3i host 1 2 Downloadtheupdatebundletothemachinewhereyourunthevihostupdate command. Callthevihostupdatecommand. Thevihostupdateoptionsallowyoutoeitherworkwiththebundledirectly,or pointtoametadatafile. Theupdateprocessfirstpushestheupdatebundletothehost,andthenrequeststhat thehostperformtheupdate.

Options for vihostupdate


Table 218liststhecommandspecificoptionsforvihostupdate.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-18. Options for vihostupdate
Option --bundle <bundle_file_name> -b <bundle_file_name> --install -i Description UnpackthedownloadedbundleZIPfile. Ifyouspecifythis option,youcannotspecify--metadata. Patchthehostwithapplicablepackagesintheupdatebundle. Thisoptiontakesnoarguments,butyoumustalsoinclude either-btospecifyabundle,or-mtospecifyametadatafile.

50

VMware, Inc.

Chapter 2 Remote CLI Reference

Table 2-18. Options for vihostupdate (Continued)


Option --metadata <metadata_xml_file> -m <metadata_xml_file> --query -q --scan <dir> -s <dir> Description Pathtothe metadata.xmlfilethatcontainsinformationabout theupdatebundle.Ifyouspecifythisoption,youcannot specify--bundle. Listpackagesinstalledonthehost.Thisoptionreturnsversion informationfortheESXServerhost,aswellasallpackages installedandtheirversionnumbers. Scanforpackagesthatapplytothehostinthedirectory specifiedby<dir>.

Examples for vihostupdate


Thefollowingexamplesforvihostupdaterequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19. AssumethepathtoanupdatebundleisEESX-142-test-release.zip.Ifyouthengo tothedirectorywhereyoucopiedthatbundle,youcanexecutethefollowing commands:
vihostupdate.pl <conn_params> -i -b EESX-142-test-release.zip

Unpacksandpatchesthehost
vihostupdate.pl <conn_params> -b EESX-142-test-release.zip

Unpacksthefile,butdoesnotpatchthehost.
vihostupdate.pl <conn_params> -i -m EESX-142-test-release.zip/metadata.xml

PatchesahostusingthefileEESX-142-test-release.zip. Runningthefirstexampleisequivalenttorunningthesecondandthirdinsequence.

Virtual Machine Management Commands


AnumberofRemoteCLIcommandsallowyoutoperformvirtualmachine management. Table 2-19. Virtual Machine Management Commands
Command svmotion Description Movesavirtualmachinesconfiguration fileandoptionallyitsdiskswhilethe virtualmachineisrunning. Performsvirtualmachineoperations remotely. See MigratingVirtualMachinesUsing svmotiononpage 52 Chapter 4,ManagingVirtualMachines withvmwarecmd,onpage 77.
51

vmware-cmd

VMware, Inc.

Remote Command-Line Interface Installation and Reference Guide

Migrating Virtual Machines Using svmotion


Thesvmotioncommandmovesavirtualmachinesconfigurationfile,and,optionally, itsdisks,whilethevirtualmachineisrunning.StorageVMotionisdiscussedinsome detailinBasicSystemAdministration.Youcanusesvmotiontoinitiatemigrationson bothESXServer3iandESXServer3hosts.Youalwayscallthiscommandwiththe --serverconnectionoptionpointingtoaVirtualCenterServer. Youcanspecifythevirtualmachineanditsdestinationwiththe--vmoption.By default,allvirtualdisksarerelocatedtothesamedatastoreasthevirtualmachine.You canusethe--disksoptiontorelocateindividualvirtualdiskstodifferentdatastores. Youcannotcurrentlyrelocateavirtualdiskwithoutrelocatingthevirtualmachines configurationfile. Youcanrunthesvmotioncommandeitherininteractiveornoninteractivemode. Tousethecommandininteractivemode,typesvmotion --interactive.Youare promptedforalltheinformationnecessarytocompletethestoragemigration. Whenyouinvokethecommandininteractivemode,allotherparametersare ignored. Innoninteractivemode,thesvmotioncommandusesthefollowingsyntax:
svmotion [standard Remote CLI options] --datacenter=<datacenter name> --vm <VM config datastore path>:<new datastore> [--disks <virtual disk datastore path>:<new datastore>, <virtual disk datastore path>:<new datastore>]

Squarebracketsindicateoptionalelements. OnWindowssystems,usedoublequotesinsteadofsinglequotesaroundthe virtualmachineanddisksparameter.

Options for svmotion


Table 220liststhecommandspecificoptionsforsvmotion.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-20. Options for svmotion
Option <datacenter> <VM config datastore path> Description Thedatacenterthatcontainsthevirtualmachinetobemigrated.Youmustquote thenameifitcontainswhitespacesorotherspecialcharacters. Datastorepathtothevirtualmachinesconfigurationfile.Ifthepathcontains spacesorotherspecialcharacters,youmustquoteit.SeeTodeterminethepathto thevirtualmachinesconfigurationfileonpage 53.

52

VMware, Inc.

Chapter 2 Remote CLI Reference

Table 2-20. Options for svmotion (Continued)


Option <new datastore> --disks Description Nameofthenewdatastoretowhichthevirtualmachineconfigurationfileordisk istobemoved.Donotincludebracketsaroundthenameofthedatastore. Ifyoudonotspecifythisparameter,allvirtualdisksassociatedwithavirtual machinearerelocatedtothesamedatastoreasthevirtualmachineconfiguration file.Byspecifyingthisparameter,youcanlocateindividualvirtualdisksto differentdatastores. Ifyouwouldliketokeepavirtualdiskonitscurrentdatastore,usethe--disks optionforthatdiskwithitscurrentdatastoreasthe<new datastore>. <virtual disk datastore path> Usedwith--diskstospecifythelocationofavirtualdiskfileforwhichyouwant tooverridethedefaultmove(seethesyntaxlistedabovethistable). SeeTodeterminethepathtoavirtualdiskfileonpage 53.

Determining Parameter Information


Youmustspecifythedatastorepathtothevirtualmachinesconfigurationfileinthe <VM config datastore path>argument. To determine the path to the virtual machines configuration file 1 2 3 IntheVIClientinventory,selectthevirtualmachineandclicktheSummarytab. ClickEditSettingstodisplaytheVirtualMachinePropertiesdialogbox. ClicktheOptionstab,andselectGeneralOptions. TheVirtualMachineConfigurationFiletextboxdisplaysthepathtothevirtual machineconfigurationfile. Youmustspecifythevirtualdiskdatastorepathinthe<virtual disk datastore path>parameter. To determine the path to a virtual disk file 1 2 3 IntheVIClientinventory,selectthevirtualmachinetowhichthevirtualdisk belongs,andclicktheSummarytab. ClickEditSettingstodisplaytheVirtualMachinePropertiesdialogbox. ClicktheHardwaretab,andselectthevirtualdiskfromthelistofdevices. TheDiskFiletextboxdisplaysthepathtothevirtualdiskfile.

VMware, Inc.

53

Remote Command-Line Interface Installation and Reference Guide

Examples for svmotion


Thefollowingexamplesforsvmotionrequireconnectionoptions.SeeConnection Optionsonpage 22.Eachexampleshoulduseoneline,eventhoughlinebreaksare includedforlegibilitybelow.Squarebracketsintheexamplesindicateadatastore.
svmotion.pl <conn_params> --interactive

Startstheinteractiveversionofthesvmotioncommand.
svmotion.pl --url=https://myvc.mycorp.com/sdk --datacenter=DC1 --vm=[old_datastore] myvm/myvm.vmx: new_datastore

Relocatesavirtualmachinesstorage(includingdisks)tonew_datastore.
svmotion.pl <conn_params> --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

Relocatesavirtualmachinesconfigurationfiletonew_datastore,butleavethetwo disks(myvm_1.vmdkandmyvm_2.vmdk)inold_datastore.
svmotion.pl <conn_params> --datacenter RcliTstDc --vm="[storage1]testvm/testvm.vmx:storage2

Migratesthevirtualmachinetestvmfromstorage1tostorage2.

Miscellaneous Management Commands


TheRemoteCLIincludesthefollowingmiscellaneouscommands,discussedinthis section. Table 2-21. Miscellaneous Management Commands
Command vicfg-advcfg vicfg-module Description Performsadvancedconfiguration.Use thiscommandasinstructedbyVMware. EnablesVMkerneloptions.Usethis commandwiththeoptionslistedinthis document,orinstructedbyVMware. Creates,modifies,deletes,andlistslocal directaccessusersandgroupsofusers. See UsingvicfgadvcfginSpecial Circumstancesonpage 55 EnablingVMkernelModuleOptions withvicfgmoduleonpage 55 ManagingUsersandGroupswith vicfguseronpage 56

vicfg-user

54

VMware, Inc.

Chapter 2 Remote CLI Reference

Using vicfg-advcfg in Special Circumstances


Thevicfg-advcfgcommandperformsanumberoflowleveladvancedoptionsand isnotintendedforcustomeruse.YoumightusethiscommandwhenVMware TechnicalSupportoraVMwareKnowledgeBasearticleinstructyoutodoso.

Enabling VMkernel Module Options with vicfg-module


Thevicfg-modulecommandallowsyoutosetandgetVMkerneloptions.The commandisusuallyusedwhenVMwareTechnicalSupport,aKnowledgeBasearticle, orVMwaredocumentationinstructyoutodoso. ThiscommandisnotsupportedonVirtualCenterServer.

Options for vicfg-module


Table 222liststhecommandspecificoptionsforvicfg-module.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-22. Options for vicfg-module
Option --set-options <module_name> -s --get-options <module_name> -g <module_name> Description Specifiestheoptionstringtobepassedtothemodule whenthemoduleisloaded. Returnstheoptionstringconfiguredtobepassedtothe modulewhenthemoduleisloaded.Thisstringisnot necessarilytheoptionstringcurrentlyinusebythe module.

Examples for vicfg-module


ThefollowingexamplesillustrateNetQueueconfiguration.TheESXServer3i ConfigurationGuideandtheESXServer3ConfigurationGuideexplainsNetQueue configurationinmoredetail.Thefollowingexamplesrequireconnectionoptions.See SpecifyingOptionsforRemoteCLICommandsonpage 19.
vicfg-module.pl <conn_params> -s intr_type_2 rx_ring_num=8 s2io

ConfiguresasupportedNICtouseNetQueue.
vicfg-module.pl <conn_params> -g s2io

VerifiesthattheNetQueuemodulehasbeenconfigured.

VMware, Inc.

55

Remote Command-Line Interface Installation and Reference Guide

Managing Users and Groups with vicfg-user


AnESXServergrantsaccesstoitsresourceswhenaknownuserwithappropriate permissionslogsontothehostwithapasswordthatmatchestheonestoredforthat user.Thevicfg-usercommandallowsyoutocreate,modify,delete,andlistlocal directaccessusersandgroupsofusersonanESXServerhost.Youcannotexecutethis commandonaVirtualCenterServer. UsermanagementisdiscussedindetailintheESXServer3ConfigurationGuide,theESX Server3iConfigurationGuide,andtheBasicSystemAdministrationdocument. ThesyntaxofthiscommanddiffersfromotherRemoteCLIcommands.Youspecify operationsasfollows:
vicfg-user <conn_params> -e <user | group> -o <add | modify | delete | list>

Options for vicfg-user


Table 223liststhecommandspecificoptionsforvicfg-user.Youmustalsospecify connectionoptions.SeeRemoteCLIConnectionOptionsonpage 22. Table 2-23. Options for vicfg-user
Option --addgroup <group_list> -g <group> --adduser <user_list> -u <user_list> --entity <group|user> e<group|user> --group <name> -d <name> --groupid <group_id> -D <group_id> --login <login_id> l<login_id> --newpassword <p_wd> -p <p_wd> --newuserid <UUID> -i <UUID> --newusername <name> -n <name> Newusernameforthetargetuser. NewUUIDforthetargetuser. Passwordforthetargetuser. LoginIDoftheuser. GroupIDofthegroup. Addsthespecifieduserstoaspecifiedgroup.Takesa commaseparatedlistofusers. Entitytoperformtheoperationon.Specifyeitheruser orgroup. Groupnameofthegroup. Description Addstheusertoacommaseparatedlistofgroups.

56

VMware, Inc.

Chapter 2 Remote CLI Reference

Table 2-23. Options for vicfg-user (Continued)


Option --operation -o --removegroup <group_list> -G <group_list> --removeuser <user_list> -U <user_list> --role <administrator|read-only|no-access> -r <administrator|read-only|no-access> --shell -s Grantshellaccesstothetargetuser.Validvaluesareyes andno.Defaultisnoshellaccess.Usethiscommandto changethedefault,ortorevokeshellaccessrightsafter theyhavebeengranted. ThisoptionissupportedonlyonESXServer3.The optionisnotsupportedonESXServer3i. Description Operationtoperform.Specifyadd,modify,delete,or list. Commaseparatedlistofgroupstoremovethetarget userfrom. Commaseparatedlistofuserstoberemovedfromthe targetgroup. Roleforthetargetuserorgroup.Specifyoneof administrator,read-only,orno-access.

Examples for vicfg-user


Thefollowingexamplesforvicfg-userrequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vicfg-user.pl <conn_params> -e user -o add -l user27 -p 27_password

AddswithloginIDuser27.
vicfg-user.pl <conn_params> -e user -o modify -l user27 -p 27_password -i <new user id> -n <new user name>

ModifiestheuserwithloginIDuser27.
vicfg-user.pl <conn_params> -e user -o modify -l user27 -g test

AddstheuserwithloginIDuser27toagrouptest.
vicfg-user.pl <conn_params> -e user -o delete -l user27

RemovestheuserwithloginIDuser27.
vicfg-user.pl <conn_params> -e group -o add -d group42 -D <group id>

Addsgroup42asagroup.
vicfg-user.pl <conn_params> -e group -o add -d group42 -u test

Addsausertesttothegroupgroup42.

VMware, Inc.

57

Remote Command-Line Interface Installation and Reference Guide

vicfg-user.pl <conn_params> -e group -o delete -d group42

Removesthegroupgroup42.

Performing File System Operations with vifs


Thevifscommandperformscommonoperationssuchascopy,remove,get,andput onfilesanddirectories.ThecommandissupportedonESXServer3butnoton VirtualCenterServer. Insteadofusingthiscommand,youcanbrowsedatastorecontentsandhostfilesusing aWebbrowser.Connecttothefollowinglocation:
http://ESX3ihost_IP_Address/host http://ESX3ihost_IP_Address/folder

YoucanviewdatacenteranddatastoredirectoriesfromthisrootURL.

File and Directory Groups


Filesanddirectoriescanbeclassifiedintothreegroups.Thevifscommandsupports allthreegroups,butdifferentoperationsareavailableforeachgroup. HostHostconfigurationfiles.Youmustspecifythefilesuniquenameidentifiers. Youspecifyhostlocationsusingthehost/<path>syntax. TempThe/tmpdirectoryandfilesinsidethatdirectory. Youspecifytemplocationsusingthetmp/dir/subdirsyntax. DatastoresDatastorefilesanddirectories.Youhavetwochoicesforspecifyinga datastore: 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)or/folder/testvms/VM1/VM1.vmx&dsName=myStorage1 (Windows) Thetwoexamplepathsrefertothesamevirtualmachineconfigurationfileforthe virtualmachineVM1insidethemyStorage1datastorestestvms/VM1directory. NOTEBecausedirectorynamesoftenusespecialcharactersorspaces,enclosingthe pathinquotesishighlyrecommendedforbothstyles.
58 VMware, Inc.

Chapter 2 Remote CLI Reference

Running vifs
Whenyourunvifs,youcanspecifytheoperationnameandargumentandalsooneof thestandardconnectionoptionsdiscussedinTable 12.Usealiases,symboliclinks,or wrapperscriptstosimplifytheinvocationsyntax. NOTEThevifscommandhasnoconceptofaworkingdirectoryorlastdirectoryor fileoperatedon.

Options for vifs


Table 224liststhecommandspecificoptionsforvifs.Allvifsoptionsworkon datastorefilesordirectories.Someoptionsalsoworkonhostfilesandfilesinthetemp directory.Youmustalsospecifyconnectionoptions.SeeRemoteCLIConnection Optionsonpage 22. Table 2-24. Options for vifs
Command --copy -c <source> <target> Description Copiesafileinadatastoretoanother locationinadatastore.The<source> mustbearemotesourcepath,the <target>aremotetargetpathor directory. The--forceoptionreplacesexisting destinationfiles. --dir -D <remote_dir> --force -F --get -g <remote_path> <local_path> --listdc -C --listds -S Liststhecontentsofadatastore directory. Overwritesthedestinationfile.Used withmove. DownloadsafilefromtheESXServer 3hosttothemachineonwhichyou runtheRemoteCLI.Thisoperation usesHTTP GET. Liststhedatacenterpathsavailableon aserver. Liststhedatastorenamesonthe server.Whenmultipledatacenters areavailable,youcanusethe--dc (-Z)argumenttospecifythenameof thedatacenterfromwhichyouwant tolistthedatastore. Datastore Temp Datastore Temp Datastore Host 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 Datastore Host Datastore Host vifs --listds For... Datastore Temp Examples copy src_file_path dst_directory_path [--force] copy src_file_path dst_file_path [--force]

VMware, Inc.

59

Remote Command-Line Interface Installation and Reference Guide

Table 2-24. Options for vifs (Continued)


Command --mkdir -M <remote_dir> --move -m <source> <target> Description Createsadirectoryinadatastore.This operationfailsiftheparentdirectory ofdst_datastore_file_pathdoes notexist. Movesafileinadatastoretoanother locationinadatastore.The<source> mustbearemotesourcepath,the <target>aremotetargetpathor directory. The--forceoptionreplacesexisting destinationfiles. --put -p <local_path> <remote_path> Uploadsafilefromthemachineon whichyouruntheRemoteCLItothe ESXServer3ihost.Thisoperation usesHTTP PUT. Thiscommandcanreplaceexisting hostfilesbutcannotcreatenewfiles. --rm -r <remote_path> --rmdir -R <remote_dir> Deletesadatastorefile. Datastore Temp Datastore Temp rm dst_file_path Datastore Host, Temp put src_local_file_path dst_file_path put src_local_file_path dst_directory_path For... Datastore Temp Examples mkdir dst_directory_path

Datastore Temp

move src_file_path dst_directory_path [--force] move src_file_path dst_file_path [--force]

Deletesadatastoredirectory.This operationfailsifthedirectoryisnot empty.

rmdir dst_directory_path

Examples for vifs


Thissectiongivessomeexamplesforvifs.Executingvifsworksonlywhenyouare connecteddirectlytoanESXServer3ihost.Thecommanddoesnotworkwhenyou connecttoaVirtualCenterServerandattempttoconnecttotheESXServer3ihost throughtheVirtualCenterServer. YoucanexecutethecommandslistedbelowonaLinuxsystem.Forcorresponding commandsonaWindowssystem,usedoublequotesinsteadofsinglequotes. Thefollowingexamplesforvifsrequireconnectionoptions.SeeSpecifyingOptions forRemoteCLICommandsonpage 19.
vifs.pl <conn_params> --copy '[myvmfs] dir_1/my_text' '[myvmfs] dir_3/text'

Copiesthemy_textfilefromdir_1todir_3.
vifs.pl <conn_params> --dir '[myvmfs] dir_3'

Liststhecontentsofdirectorydir_3.
60 VMware, Inc.

Chapter 2 Remote CLI Reference

vifs.pl <conn_params> --copy '[myvmfs] dir_1/my_text' '[myvmfs] dir_3/my_text' --force

Copiesthemy_textfileintodir_3.Ifyouusethiscommand,andafilenamedmy_text alreadyexistsindir_3,thecommandoverwritestheexistingfilebecauseofthe --forceoption.


vifs.pl <conn_params> --mkdir '[myvmfs] new_dir'

Createsthedirectorycallednew_dir.
vifs.pl <conn_params> --put /root/test_put '[myvmfs] new_dir/test_put'

Placesacopyofthelocaltest_putfileintothespecifiedserversnew_dirdirectory.
vifs.pl <conn_params> --rm '[myvmfs] new_dir/test_put'

Removesthetest_putfilefromthenew_dirfolder.
vifs.pl <conn_params> --rmdir '[myvmfs] new_dir'

Removesthenew_dirfolder.
vifs.pl <conn_params> --get '[myvmfs] dir_1/my_text' /root/my_text

Retrievesthefilemy_textfromtheESXServer3ihostandplacesitinthelocal machinesrootfolder.
vifs.pl <conn_params> --move '[myvmfs] dir_1/my_text' '[myvmfs] dir_3/my_text'

Movesthemy_textfilefromdir_1todir_3.
vifs.pl <conn_params> --listds

Liststhenamesofalldatastoresontheserverspecifiedintheconfigurationfile.Youcan useeachnamethathasbeenreturnedtorefertodatastorepathsusingsquarebracket notation,asfollows:


[my_datastore] dir/subdir/file

Commands with an esxcfg Prefix


Forseveralofthecommandslistedinthischapter,youmighthaveusedcorresponding serviceconsolecommandsstartingwithanesxcfgprefixinscriptstomanageESX Server3.0.TofacilitateeasymigrationfromESXServer3.0toESXServer3iorESX Server3version3.5,thecommandswiththeesxcfgprefixareavailableasRemoteCLI commands. NOTEVMwarerecommendsthatyouusethecommandwiththevicfgprefix. Commandswiththeesxcfgprefixareavailablemainlyforcompatibilityreasonsand mightbecomeobsolete.
VMware, Inc. 61

Remote Command-Line Interface Installation and Reference Guide

Table 225listsallRemoteCLIcommandsforwhichacommandwithanesxcfgprefix isavailable. Table 2-25. Commands with an esxcfg Prefix


Command with vicfg prefix vicfgadvcfg vicfgcfgbackup vicfgdns vicfgdumppart vicfgmodule vicfgmpath vicfgnas vicfgnics vicfgntp vicfgrescan vicfgroute vicfgsnmp vicfgsyslog vicfguser vicfgvmhbadevs vicfgvmknic vicfgvswitch Command with esxcfg prefix esxcfgadvcfg esxcfgcfgbackup esxcfgdns esxcfgdumppart esxcfgmodule esxcfgmpath esxcfgnas esxcfgnics esxcfgntp esxcfgrescan esxcfgroute esxcfgsnmp esxcfgsyslog esxcfguser esxcfgvmhbadevs esxcfgvmknic esxcfgvswitch See UsingvicfgadvcfginSpecialCircumstancesonpage 55. UsingvicfgcfgbackupforConfigurationInformationon page 45 SpecifyingtheDNSConfigurationwithvicfgdnson page 36 ManagingDiagnosticPartitionswithvicfgdumpparton page 28. SeeEnablingVMkernelModuleOptionswith vicfgmoduleonpage 55 ConfiguringStorageArrayswithvicfgmpathonpage 30. ManagingNASFileSystemswithvicfgnasonpage 33. ManagingPhysicalNICswithvicfgnicsonpage 38. SpecifyingtheNTPServerwithvicfgntponpage 39 Rescanningwithvicfgrescanonpage 34. ManipulatingtherouteEntrywithvicfgrouteonpage 40. SettingUpSNMPwithvicfgsnmponpage 47 SpecifyingthesyslogServerwithvicfgsyslogonpage 49 ManagingUsersandGroupswithvicfguseronpage 56 FindingAvailableLUNswithvicfgvmhbadevson page 35. ManagingVMkernelNICswithvicfgvmkniconpage 41. ManagingVirtualSwitcheswithvicfgvswitchon page 42.

62

VMware, Inc.

Managing Storage with vmkfstools

YouusethevmkfstoolsRemoteCLItocreateandmanipulatevirtualdisks,file systems,logicalvolumes,andphysicalstoragedevicesonanESXServerhost.Using vmkfstools,youcancreateandmanageavirtualmachinefilesystem(VMFS)ona physicalpartitionofadisk.Youcanalsousevmkfstoolstomanipulatefiles,suchas virtualdisks,storedonVMFS3andNFS. NOTEThevmkfstoolscommandonESXServerdoesnotsupportalltheoptions supportedintheESXServer3version3.5serviceconsole. YoucanexecutethevmkfstoolsRemoteCLIlikeotherRemoteCLIcommands. SpecifytheESXServerhostonwhichtoexecutethecommand,andspecifyadditional connectionoptionsasdiscussedinSpecifyingOptionsforRemoteCLICommands onpage 19.ThiscommandisnotsupportedonVirtualCenterServer. Inmostcases,youdontneedtologinastherootusertorunthevmkfstools command.However,somecommands,suchasthefilesystemcommands,might requiretherootuserlogin. YoucanperformmostvmkfstoolsoperationsusingtheVIClientinsteadofthe commandline.ForinformationonusingtheVIClienttoworkwithstorage,see ConfiguringStorageintheESXServer3ConfigurationGuideandtheESXServer3i ConfigurationGuide. Thischapterincludesthefollowingtopics: vmkfstoolsCommandSyntaxonpage 64 vmkfstoolsFileSystemOptionsonpage 67 vmkfstoolsVirtualDiskOptionsonpage 69

VMware, Inc.

63

Remote Command-Line Interface Installation and Reference Guide

vmkfstools Command Syntax


Thevmkfstoolscommandhasthefollowingsyntax:
vmkfstools <options> <target>

Here,<options>canbeoneormorecommandlineoptionsandassociatedvalues(see SpecifyingOptionsonpage 64)and<target>isthepartition,device,orpathto whichyouwanttoapplythecommand(seeSpecifyingtheTargetonpage 66).

Specifying Options
Youcanuseoneormorecommandlineoptionsandassociatedargumentstospecify whatyouwanttodo.Forexample,whenyoucreateanewvirtualdisk,youcanspecify thediskformat. Thelongandshort(singleletter)formsofoptionsareequivalent.Forexample,the followingcommandsareidentical:
vmkfstools --createfs vmfs3 --blocksize 2m vmhba1:3:0:1 vmkfstools -C vmfs3 -b 2m vmhba1:3:0:1

Table 31givesanoverviewofvmkfstoolsfilesystemoptions.Itincludesabrief descriptionandapointertowheretheoptionisdiscussed. Table 3-1. vmkfstools File System Option Overview
Option --blocksize b --createfs -C --extendfs -Z --human-readable j --queryfs -P --setfsname S Setsthelabelforthefilesystem. Usedwith--createfs. ExtendsexistingVMFS3file system. Listsattributesin humanreadableformat. Listsattributesoffilesystem. Description Usesthespecifiedsizeforfile systemcreation.Usedwith --createfs. CreatesaVMFSfilesystem. See CreatingaVMFSFileSystemon page 67 CreatingaVMFSFileSystemon page 67. ExtendinganExistingVMFS3Volume onpage 68. ListingAttributesofaVMFSVolume onpage 69 ListingAttributesofaVMFSVolume onpage 69. CreatingaVMFSFileSystemon page 67

Table 31givesanoverviewofvmkfstoolsfilesystemoptions.Itincludesabrief descriptionandapointertowheretheoptionisdiscussed.

64

VMware, Inc.

Chapter 3 Managing Storage with vmkfstools

Table 3-2. vmkfstools Virtual Disk Option Overview


Option --adaptertype a --clonevirtualdisk -i --createdrm -r --createrdmpassthru -z --createvirtualdisk -c --deletevirtualdisk -U --diskformat d --extendvirtualdisk X --geometry -g --inflatedisk -j --migratevirtualdisk -M --queryrdm -q --renamevirtualdisk -E --writezero -w Convertsathinvirtualdiskto eagerzeroedthickformat, preservingallexistingdata. MigratesaVMFS2diskto VMFS3. Liststheattributesofarawdisk mapping. Renamesthespecifiedvirtual disk. Cleansthevirtualdiskby writingzerosoverallitsdata. Usesthespecifiedformatfor diskcreation.Usedwith-cand -i. Extendsthespecifiedvirtual disk. Displaysvirtualdiskgeometry. SupportedDiskFormatsonpage 69. Deletesthespecifiedvirtualdisk. DeletingaVirtualDiskonpage 72. Mapsarawdisktoafileona VMFSfilesystem. Mapsapassthroughrawdiskto afileonaVMFSfilesystem. Createsavirtualdisk. Description Usesthespecifiedtypefordisk creation.Usedwith-cand-i. Clonesthespecifiedvirtualdisk. See CreatingaVirtualDiskonpage 70. CloningaVirtualorRawDiskon page 73. CreatingaVirtualCompatibilityMode RawDeviceMappingonpage 75. CreatingaPhysicalCompatibilityMode RawDeviceMappingonpage 76. CreatingaVirtualDiskonpage 70.

ExtendingaVirtualDiskonpage 74. DisplayingVirtualDiskGeometryon page 76. InflatingaThinVirtualDiskon page 72. CreatingaVirtualCompatibilityMode RawDeviceMappingonpage 75. ListingAttributesofanRDMon page 76. RenamingaVirtualDiskonpage 73. InitializingaVirtualDiskonpage 71.

VMware, Inc.

65

Remote Command-Line Interface Installation and Reference Guide

Specifying the Target


Youcanspecifythetargetoftheoperationspecifiedin<options>asafilesystem, partition,orvirtualdisk.Youcanusearelativeorabsolutepathnameinthe/vmfs hierarchy.

File System Target


SpecifyaVMFSfilesystemorfileusinganabsoluteorrelativepaththatnamesa directorysymboliclink,rawdevicemapping,orafileunder/vmfs. TospecifyaVMFSfilesystem,usethisformat:
/vmfs/volumes/<file_system_UUID>

or
/vmfs/volumes/<file_system_label>

TospecifyaVMFSfile,usethisformat:
/vmfs/volumes/<file system label|file system UUID>/[dir]/myDisk.vmdk

Youdontneedtoentertheentirepathifthecurrentworkingdirectoryisthe parentdirectoryofmyDisk.vmdk. Forexample,


/vmfs/volumes/datastore1/rh9.vmdk

SeevmkfstoolsFileSystemOptionsonpage 67.

Disk Partition Target


SpecifyadiskpartitionusingavmhbaA:T:L:Pformat,whereA,T,L,andPareintegers representingadapter,target,LUN,andpartitionnumberrespectively.Thepartition digitmustbegreaterthanzeroandshouldcorrespondtoavalidVMFSpartitionoftype fb.Forexample,vmhba0:2:3:1referstothefirstpartitiononLUN3,target2,HBA0. SeevmkfstoolsVirtualDiskOptionsonpage 69.

Device Target
SpecifyadeviceorlogicalvolumeusingapathnameintheESXServerdevicefile system.Thepathnamebeginswith/vmfs/devices,whichisthemountpointofthe devicefilesystem.Eachdevicetypehassubmounts,forexample: /vmfs/devices/disksforlocalorSANbaseddisks. /vmfs/devices/lvmforESXServerlogicalvolumes. /vmfs/devices/genericforgenericSCSIdevices,suchastapedrives.

66

VMware, Inc.

Chapter 3 Managing Storage with vmkfstools

vmkfstools File System Options


Thissectiondiscussesvmkfstools filesystemoptions.Someoptionsareforadvanced usersonly.Youmustalsospecifyconnectionoptions.SeeRemoteCLIConnection Optionsonpage 22. Thelongandshort(singleletter)formsofoptionsareequivalent.Forexample,the followingcommandsareidentical:
vmkfstools.pl <conn_params> --createfs vmfs3 --blocksize 2m vmhba1:3:0:1 vmkfstools.pl <conn_params> -C vmfs3 -b 2m vmhba1:3:0:1

FilesystemoptionsallowyoutocreateaVMFSfilesystem.Theseoptionsdonotapply toNFSfilesystems.YoucanperformmanyofthesetasksthroughtheVIClient.

Creating a VMFS File System


The-CoptioncreatesaVMFS3filesystemonthespecifiedSCSIpartition,suchas vmhba1:0:0:1.Thepartitionbecomesthefilesystemsheadpartition.
-C --createfs vmfs3 -b --blocksize <block_size>kK|mM -S --setfsname <fsName>

NOTEYoucanhaveonlyoneVMFSvolumeforaLUN. VMFS2filesystemsarereadonlyonanyESXServerhost.Youcannotcreateormodify VMFS2filesystemsbutyoucanreadfilesstoredonVMFS2filesystems. Table 33liststhesuboptionsyoucanusewiththe-Coption. Table 3-3. Suboptions for vmkfstools -C
Option -b --blocksize Description DefinetheblocksizefortheVMFS3filesystem.Thedefaultfileblocksizeis1MB. The<block_size>valueyouspecifymustbeamultipleof128KB,withaminimum valueof128KB.Whenenteringasize,indicatetheunittypebyaddingasuffixsuch asmorM.TheunittypeisnotcasesensitivevmkfstoolsinterpretseithermorM tomeanmegabytesandkorKtomeankilobytes. DefinethevolumelabelofaVMFSvolumefortheVMFS3filesystemyouare creating.Usethissuboptiononlywiththe-Coption.Thelabelyouspecifycanbeup to128characterslongandcannotcontainanyleadingortrailingblankspaces. Afteryoudefineavolumelabel,youcanuseitwheneveryouspecifytheVMFS volumeinacalltovmkfstools.Thevolumelabelappearsinlistingsgeneratedfor theLinuxls -lcommandandasasymboliclinktotheVMFSvolumeunderthe /vmfs/volumesdirectory. YoucanchangetheVMFSvolumelabelusingtheVIClientUI.

-S --setfsname

VMware, Inc.

67

Remote Command-Line Interface Installation and Reference Guide

Examples for Creating a VMFS File System


Thefollowingexamplesrequireconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> -C vmfs3 -b 1m -S my_vmfs/vmfs/devices/disks/vmhba1:3:0:1

CreatesanewVMFS3filesystemnamedmy_vmfsonthefirstpartitionoftarget3, LUN 0ofSCSIadapter1.Thefileblocksizeis1MB.


vmkfstools.pl <conn_params> -C vmfs3 -S my_vmfs vmhba1:0:0:4 vmkfstools.pl <conn_params> --createfs vmfs3 --setfsname my_vmfs vmhba1:0:0:4 vmkfstools.pl <conn_params> --createfs vmfs3 --blocksize 1m--setfsname my_vmfs vmhba1:0:0:4 vmkfstools.pl <conn_params> --createfs vmfs3 -b 4m --setfsname my_vmfs vmhba1:0:0:4

Extending an Existing VMFS-3 Volume


The-ZoptionaddsanextenttoapreviouslycreatedVMFSvolume <existing-VMFS-volume>.
-Z --extendfs <extension-device> <existing-VMFS-volume>

Eachtimeyouusethisoption,youextendaVMFS3volumewithanewextentsothat thevolumespansmultiplepartitions.AlogicalVMFS3volumecanhaveatmost32 physicalextents. CAUTIONWhenyourunthisoption,youlosealldataontheSCSIdeviceyouspecified in<extension-device>.

Example for Extending an Existing Volume


Thefollowingexamplerequiresconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> -Z /vmfs/devices/disks/vmhba0:1:2:1 /vmfs/devices/disks/vmhba0:3:0:1

Extendsthelogicalfilesystembyallowingittospantoanewpartition.Theextended filesystemspanstwopartitions,vmhba1:3:0:1andvmhba0:1:2:1.Inthisexample, vmhba1:3:0:1isthenameoftheheadpartition.

68

VMware, Inc.

Chapter 3 Managing Storage with vmkfstools

Listing Attributes of a VMFS Volume


The-PoptionliststheattributesofafileordirectoryonaVMFSvolume.
-P --queryfs

ThelistedattributesincludetheVMFSversionnumber(VMFS2orVMFS3),the numberofextentsinthespecifiedVMFSvolume,thevolumelabelifany,theUUID, andalistingofthedevicenameswhereeachextentresides.

Example for Listing Attributes


Thefollowingexamplerequiresconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> --queryfs /vmfs/volumes/my_vmfs

Thiscommandmightreturnthefollowing:
VMFS-3.31 file system spanning 1 partitions. Capacity : 65229815808, 64641564672 avail File system label : my_vmfs UUID : 46fd1460-6ec4e2b8-e048-000e0c7f4088 Path : /vmfs/volumes/46fd1460-6ec4e2b8-e048-000e0c7f4088 Partitions spanned: vmhba2:0:0:6

IfanydevicebackingVMFSfilesystemgoesoffline,thenumberofextentsandthe availablespacechangeaccordingly.

vmkfstools Virtual Disk Options


Virtualdiskoptionsallowyoutosetup,migrate,andmanagevirtualdisksstoredin VMFS2,VMFS3,andNFSfilesystems.Youcanalsoperformmostofthesetasks throughtheVIClient.

Supported Disk Formats


Whenyoucreateorcloneavirtualdisk,youcanusethe-d --diskformatsuboption tospecifytheformatforyourdisk.Choosefromthefollowingformats: zeroedthick(default)Spacerequiredforthevirtualdiskisallocatedduring creation.Anydataremainingonthephysicaldeviceisnoterasedduringcreation, butwillbezeroedoutondemandatalatertimeonfirstwritefromthevirtual machine.Thevirtualmachinedoesnotreadstaledatafromdisk.

VMware, Inc.

69

Remote Command-Line Interface Installation and Reference Guide

eagerzeroedthickSpacerequiredforthevirtualdiskisallocatedatcreation time.Incontrasttozeroedthickformat,thedataremainingonthephysical deviceiszeroedoutduringcreation.Itmighttakemuchlongertocreatedisksin thisformatthantocreateothertypesofdisks. thickSpacerequiredforthevirtualdiskisallocatedduringcreation.Thistype offormattingdoesntzerooutanyolddatathatmightbepresentonthisallocated space.Onlytherootuserisallowedtocreatedisksinthisformat. thinThinprovisionedvirtualdisk.Unlikewiththethickformat,space requiredforthevirtualdiskisnotallocatedduringcreation,butissupplied, zeroedout,ondemandatalatertime. rdmVirtualcompatibilitymoderawdiskmapping. rdmpPhysicalcompatibilitymode(passthrough)rawdiskmapping. rawRawdevice. 2gbsparseAsparsediskwith2GBmaximumextentsize.Youcanusedisksin thisformatwithotherVMwareproducts.However,youcannotpoweronasparse diskonanESXServerhostunlessyoufirstreimportthediskinacompatible format,suchasthickorthin,withvmkfstools. monosparseAmonolithicsparsedisk.Youcanusedisksinthisformatwith otherVMwareproducts. monoflatAmonolithicflatdisk.Youcanusedisksinthisformatwithother VMwareproducts. With -c --createvirtualdisk,vmkfstoolsacceptszeroedthick, eagerzeroedthick,thick,andthin. With-i --clonevirtualdisk,vmkfstoolsacceptsrdm:dev,rdmp:dev,raw:dev, thin,2gbsparse,monoflat,andmonosparse. WithNFSfiles,vmkfstoolssupportsonlythin,thick,zeroedthick,and 2gbsparse.BecausetheNFSserverandnottheESXServerhostdecidestheallocation policy,thick,zeroedthick,andthinusuallyhavethesameresult.Thedefault allocationpolicyonmostNFSserversisthin.

Creating a Virtual Disk


The-coptioncreatesavirtualdiskatthespecifiedlocationonaVMFSvolume.You needtospecifythesizeofthevirtualdisk.
-c --createvirtualdisk <size>[kK|mM|gG] -a --adaptertype [buslogic|lsilogic] <srcfile> -d --diskformat [thin|zeroedthick|eagerzeroedthick]
70 VMware, Inc.

Chapter 3 Managing Storage with vmkfstools

Youcanindicatetheunittypefor<size>byaddingasuffixofk(kilobytes),m (megabytes),org(gigabytes).Theunittypeisnotcasesensitivevmkfstools interpretseitherkorKtomeankilobytes.Ifyoudonotspecifyaunittype,vmkfstools defaultstobytes. Thevmkfstoolscommandsupportsthefollowingsuboptionsinconjunctionwith-c. -aspecifiesthedevicedriverthatisusedtocommunicatewiththevirtualdisks. YoucanchoosebetweenBusLogicandLSILogicSCSIdrivers. -dspecifiesdiskformats.Fordetaileddescriptionofthediskformats,see SupportedDiskFormatsonpage 69.

Examples for Creating a Virtual Disk


Thefollowingexamplesrequireconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> -c 2048m /vmfs/volumes/my_vmfs/myOS.vmdk

CreatesatwogigabytevirtualdiskfilenamedmyOS.vmdkontheVMFSfilesystem namedmyVMFS.Thisfilerepresentsanemptyvirtualdiskavirtualmachinecanaccess.
vmkfstools.pl <conn_params> --createvirtualdisk 20m /vmfs/volumes/store1/test.vmdk

Createsa20MBvirtualdisknamedtest.vmdk.
vmkfstools.pl <conn_params> --createvirtualdisk 20mb -d thin -a lsilogic /vmfs/volumes/M1/test.vmdk

Createsavirtualdiskassociatedwiththespecifiedadapter.
vmkfstools.pl <conn_params> -c 200m /vmfs/volumes/my_vmfs/test01.vmdk

Createsa200MBvirtualdisknamedtest01.vmdkontheVMFSfilesystemnamed my_vmfs.

Initializing a Virtual Disk


The-woptioncleansthevirtualdiskbywritingzerosoverallitsdata.
-w --writezeros

DependingonthesizeofyourvirtualdiskandtheI/Obandwidthtothedevicehosting thevirtualdisk,completingthiscommandmighttakealongtime. CAUTIONWhenyouusethiscommand,youloseanyexistingdataonthevirtualdisk.

VMware, Inc.

71

Remote Command-Line Interface Installation and Reference Guide

Examples for Initializing a Virtual Disk


Thefollowingexamplesrequireconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> -w /vmfs/volumes/my_vmfs/test01.vmdk vmkfstools.pl <conn_params> --writezeros /vmfs/volumes/my_vmfs/text02.vmdk

Inflating a Thin Virtual Disk


The-joptionconvertsathinvirtualdisktoeagerzeroedthickformat,preserving allexistingdata.
-j --inflatedisk

SeeSupportedDiskFormatsonpage 69.

Examples for Inflating a Virtual Disk


Thefollowingexamplesrequireconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> --inflatedisk '[myVMFS] testsep1.vmdk' vmkfstools.pl <conn_params> -j '[myVMFS] test02.vmdk' vmkfstools.pl <conn_params> --inflatedisk -a buslogic /vmfs/volumes/myvmfs/thin.vmdk

Deleting a Virtual Disk


The-Uoptiondeletesfilesassociatedwiththevirtualdiskatthespecifiedpathonthe VMFSvolume.
-U --deletevirtualdisk

Example for Deleting a Virtual Disk


Thefollowingexamplerequiresconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> -U /vmfs/volumes/store/test.vmdk

Deletesthevirtualdisktest.vmdk.

72

VMware, Inc.

Chapter 3 Managing Storage with vmkfstools

Renaming a Virtual Disk


The-Eoptionrenamesthevirtualdiskfile.
-E --renamevirtualdisk <oldName> <newName>

Youmustspecifytheoriginalfilenameorfilepath<oldName>andthenewfilenameor filepath<newName>.

Examples for Renaming a Virtual Disk


Thefollowingexamplesrequireconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> -E /vmfs/volumes/myvmfs/test.vmdk /vmfs/volumes/store/renamed.vmdk vmkfstools.pl <conn_params> -E /vmfs/volumes/myvmfs/my_OS.vmdk /vmfs/volumes/myvmfs/my_new_OS.vmdk vmkfstools.pl <conn_params> 10.20.120.196 --renamevirtualdisk /vmfs/volumes/myvmfs/my_OS.vmdk /vmfs/volumes/myvmfs/my_new_OS.vmdk

Cloning a Virtual or Raw Disk


The-ioptioncreatesacopyofavirtualdiskorrawdiskyouspecify.
-i --importfile <srcfile> <destfile> -d --diskformat [rdm:<device>|rdmp:<device>|raw:<device>|thin|2gbsparse] -a --adaptertype <type>

ForESXServer,youmustspecifythe--diskformatand--adaptertypeoptionswith -i.The--diskformatoptionspecifiesthediskformatforthecopyyoucreate.See SupportedDiskFormatsonpage 69. NOTEToclonetheESXServerhostsRedologswhilepreservingtheirhierarchy,use thevifs -Ccommand.

Example for Cloning a Virtual or Raw Disk


Thefollowingexamplerequiresconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools <conn_params> -i /vmfs/volumes/templates/gold-master.vmdk /vmfs/volumes/myVMFS/myOS.vmdk -d thick -a lsilogic

Clonesthecontentsofamastervirtualdiskfromthetemplaterepositorytoavirtual diskfilenamedmyOS.vmdkonthefilesystemmyVMFS.

VMware, Inc.

73

Remote Command-Line Interface Installation and Reference Guide

Migrating VMware Workstation and VMware GSX Server Virtual Machines


YoucannotusetheVIClienttomigratevirtualmachinescreatedwithVMware WorkstationorVMwareGSXServerintoyourESXServersystem.However,youcan usethevmkfstools -icommandtoimportthevirtualdiskintoyourESXServer system.YoucanthenattachthisdisktoanewvirtualmachineyoucreateinESXServer. Youmustimportthevirtualdiskfirstbecauseyoucannotpowerondisksexportedin 2gbsparseformatonanESXServerhost. To migrate VMware Workstation and GSX Server virtual machines 1 2 3 UsevmkfstoolstoimportaVMwareWorkstationorGSXServerdiskintoyour /vmfs/volumes/myVMFS/directoryoranysubdirectory. IntheVIClient,createanewvirtualmachineusingtheCustomconfiguration option. Whenconfiguringadisk,selectUseanexistingvirtualdiskandattachthe VMwareWorkstationorGSXServerdiskyouimported.

Extending a Virtual Disk


The-Xoptionextendsthesizeofadiskallocatedtoavirtualmachineafterthevirtual machinehasbeencreated.
-X --extendvirtualdisk <newSize>[kK|mM|gG]

Youmustpoweroffthevirtualmachinethatusesthisdiskfilebeforeyouenterthis command.Youmighthavetoupdatethefilesystemonthedisksotheguestoperating systemcanrecognizeandusethenewsizeofthediskandtakeadvantageoftheextra space. NOTEThenewSizeparameterdefinestheentirenewsize,notjusttheincrementyou addtothedisk. YouspecifythenewSizeparameterinkilobytes,megabytes,orgigabytesbyaddinga suffixofk(kilobytes),m(megabytes),org(gigabytes).Theunittypeisnotcase sensitivevmkfstoolsinterpretseitherkorKtomeankilobytes.Ifyoudontspecifya unittype,vmkfstoolsdefaultstokilobytes. Donotextendthebasediskofavirtualmachinethathassnapshotsassociatedwithit. Ifyoudo,youcannolongercommitthesnapshotorrevertthebasedisktoitsoriginal size.

74

VMware, Inc.

Chapter 3 Managing Storage with vmkfstools

Examples for Extending a Virtual Disk


Thefollowingexamplerequiresconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> 10.20.120.132 -X 5g <disk name>.dsk

Extendsa4GBvirtualdiskby1GB.
vmkfstools.pl <conn_params> 10.20.120.132 -X 50M /vmfs/volumes/my_newVMFS/my_disk.vmdk

Creating a Virtual Compatibility Mode Raw Device Mapping


The-roptioncreatesaRawDeviceMapping(RDM)fileinvirtualcompatibilitymode onaVMFS3volumeandmapsarawdisktothisfile.
-r --createrdm <device>

Afterthismappingisestablished,youcanaccesstherawdiskasyouwouldanormal VMFSvirtualdisk.Thefilelengthofthemappingisthesameasthesizeoftherawdisk itpointsto. Whenspecifyingthe<device>parameter,enter0forthepartitiontoindicatethatthe entirerawdiskisused.Usethefollowingformat:


/vmfs/devices/disks/vmhbaA:T:L:0

FordetailsonconfiguringandusingRDMs,seeRawDeviceMappingintheESX Server3ConfigurationGuideandtheESXServer3iConfigurationGuide. AllVMFS3filelockingmechanismsapplytoRDMs.

Examples For Creating a Virtual Compatibility Mode RDM


Thefollowingexamplesrequireconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> -r /vmfs/devices/disks/vmhba2:1:0:0 /vmfs/volumes/storage1/rdm210.vmdk

CreatesavirtualcompatibilitymodeRDMfile/vmfs/volumes/storage1/rdm210.vmdk andmapsthe/vmfs/devices/disks/vmhba2:1:0:0rawdisktothatfile.
vmkfstools.pl <conn_params> -r /vmfs/devices/disks/vmhba1:3:0:0 my_rdm.vmdk

CreatesanRDMfilenamedmy_rdm.vmdkandmapsthevmhba1:3:0:0rawdiskto thatfile.Youcanconfigureavirtualmachinetousethemy_rdm.vmdkmappingfileby addingthefollowinglinestothevirtualmachineconfigurationfile:


scsi0:0.present = TRUE scsi0:0.fileName = /vmfs/volumes/myVMFS/my_rdm.vmdk
VMware, Inc. 75

Remote Command-Line Interface Installation and Reference Guide

Creating a Physical Compatibility Mode Raw Device Mapping


The-zoptionletsyoumapaphysicalcompatibilitymoderawdevicetoafileona VMFSvolume.
-z --createrdmpassthru <device>

ThemappingletsavirtualmachinebypassESXServerSCSIcommandfilteringwhen accessingitsvirtualdisk.Thistypeofmappingisusefulwhenthevirtualmachine needstosendproprietarySCSIcommands,forexample,whenthevirtualmachineruns SANawaresoftware. Afteryouestablishthistypeofmapping,youcanusethemappingtoaccesstheraw diskjustasyouwouldanyotherVMFSvirtualdisk.Whenspecifyingthe<device> parameter,enter0forthepartitiontoindicatethattheentirerawdeviceisused.Use thefollowingformat:


/vmfs/devices/disks/vmhbaA:T:L:0

Example for Creating a Physical Compatibility Mode RDM


Thefollowingexamplerequiresconnectionoptions.SeeSpecifyingOptionsfor RemoteCLICommandsonpage 19.
vmkfstools.pl <conn_params> -z /vmfs/devices/disks/vmhba2:1:0:0 /vmfs/volumes/storage1/rdmpass.vmdk

CreatesaphysicalcompatibilitymodeRDMfilenamedrdmpass.vmdkandmapsthe vmbha2:1:0:0tothatfile.Youcantusethenameofafilethatalreadyexists.

Listing Attributes of an RDM


The-qoptionletsyoulisttheattributesofanRDM.
-q --queryrdm

ThisoptionprintsthevmhbanameoftherawdiskRDM.Theoptionalsoprintsother identificationinformation,likethediskID,fortherawdisk.

Displaying Virtual Disk Geometry


The-goptiongetsinformationaboutthegeometryofavirtualdisk.
-g --geometry

Theformis:Geometry information C/H/S,whereCrepresentsthenumberof cylinders,Hrepresentsthenumberofheads,andSrepresentsthenumberofsectors. NOTEWhenimportingVMwareWorkstationvirtualdiskstoESXServerhost,you mightseeadiskgeometrymismatchmessage.Geometrymismatchmightalsocause problemsloadingaguestoperatingsystemorrunninganewlycreatedvirtualmachine.


76 VMware, Inc.

Managing Virtual Machines with vmware-cmd

Thischapterdiscussesthevmware-cmdRemoteCLIcommand,whichallowsyouto managethevirtualmachinesinyourVMwareInfrastructureenvironment. Youcanusevmware-cmdtoperformvariousoperationsonavirtualmachine,including registeringavirtualmachineonthelocalserver,gettingthepowerstateofavirtual machine,settingconfigurationvariables,andsoon. NOTEOlderversionsofvmware-cmdsupportedasetofconnectionoptionsand generaloptionsthatdifferfromtheoptionsinotherRemoteCLIcommands.The vmware-cmdRemoteCLIsupportstheexistingserviceconsolebasedvmware-cmd syntaxandoptionnamesforbackwardcompatibility.TheRemoteCLIalsosupports thestandardRemoteCLI--server,--username,and--passwordoptions,butnone oftheotherconnectionoptions. Thischapterincludesthefollowingtopics: ConnectionOptionsforvmwarecmdonpage 78 GeneralOptionsforvmwarecmdonpage 78 ServerOptionsforvmwarecmdonpage 79 VirtualMachineOptionsforvmwarecmdonpage 79 vmwarecmdExamplesonpage 83

VMware, Inc.

77

Remote Command-Line Interface Installation and Reference Guide

Connection Options for vmware-cmd


Thevmware-cmdRemoteCLIcommandsupportsonlythefollowingconnection options.Otherconnectionoptionsarenotsupported. Table 4-1. vmware-cmd Connection Options
Option --server <host> -H <host> -T <target> Whenyouexecutevmware-cmd withthe-Hoptionpointingtoa VirtualCenterServer,use-TtospecifytheESXServerhosttoexecutethe commandon. Alternativeconnectionport.Thedefaultportnumberis902. Usernameforauserwhoisauthorizedtologintothehostspecifiedby-H or-T. Passwordfortheuserspecifiedby-U. Protocoltouse,eitherhttporhttps.Defaultishttps. Description TargetESXServerhostorVirtualCenterServerhost.

-O <port> --username <username> -U <username> --password <password> -P <password> -Q <protocol>

General Options for vmware-cmd


Thevmware-cmdRemoteCLIcommandsupportsthefollowinggeneraloptions. Table 4-2. vmware-cmd General Options
Option -h -q -v Description Printsahelpmessage,listingtheoptionsforthiscommand. Runsinquietmodewithminimaloutput.Thespecifiedoperationandargumentsare notspecifiedintheoutput. Runsinverbosemode.

78

VMware, Inc.

Chapter 4 Managing Virtual Machines with vmware-cmd

Server Options for vmware-cmd


ThefollowingoptionsallowyoutoperformoperationsontheESXServerhostyouare connectedto.Whenspecifyingvm-path,chooseoneofthefollowingformats: Datastoreprefixstyle:[ds_name] relative_path forexample[myStorage1] testvms/vm1/VM1.vmx(Linux)or [myStorage1] testvms\vm1\VM1.vmx(Windows) UUIDbasedpath: folder/subfolder/file forexample /vmfs/volumes/mystorage/Ftestvms/vm1/VM1.vmx(Linux)or /vmfs/volumes/mystorage/testvms/vm1/VM1.vmx(Windows) Table 4-3. vmware-cmd Server Operations
Server Operation -l -s register <vm-path> [datacenter] [resource_pool] -s unregister <vm-path> Description Liststheregisteredvirtualmachinesontheserver. Registersavirtualmachinespecifiedby<vm-path>onthe server.Youcanoptionallyspecifyadatacenterorresource pool. Unregistersavirtualmachinespecifiedby<vm-path>onthe server.

Virtual Machine Options for vmware-cmd


ThefollowingoptionsallowyoutoperformoperationsonvirtualmachinesontheESX Serveryouareconnectingto. Whenspecifyingvm-path,chooseoneofthefollowingformats: Datastoreprefixstyle:[ds_name] relative_path forexample[myStorage1] testvms/vm1/VM1.vmx(Linux)or [myStorage1] testvms\vm1\VM1.vmx (Windows) UUIDbasedpath: folder/subfolder/file forexample /vmfs/volumes/mystorage/Ftestvms/vm1/VM1.vmx(Linux)or /vmfs/volumes/mystorage/testvms/vm1/VM1.vmx(Windows)

VMware, Inc.

79

Remote Command-Line Interface Installation and Reference Guide

Table 4-4. Commands that apply to any VMware Infrastructure Host


Command <vm-path> answer <vm-path> connectdevice <device_name> <vm-path> createsnapshot <name> <description> <quiesce> <memory> Description Promptstheusertoansweraquestionforavirtualmachinewaiting foruserinput. Connectsthespecifiedvirtualdevicetoavirtualmachine. Createsasnapshotofthespecifiedvirtualmachine,providinganame anddescriptionforthesnapshot. Ifthe<quiesce>flagis1andthevirtualmachineispoweredon whenthesnapshotistaken,VMwareToolsisusedtoquiescethe filesysteminthevirtualmachine.Quiescingafilesystemisa processofbringingtheondiskdataofaphysicalorvirtual computerintoastatesuitableforbackups.Thisprocessmight includesuchoperationsasflushingdirtybuffersfromthe operatingsystemsinmemorycachetodisk,orotherhigherlevel applicationspecifictasks. Ifthe<memory>flagis1,thenadumpoftheinternalstateofthe virtualmachineisincludedinthesnapshot.Memorysnapshots takelongertocreate. <vm-path> disconnectdevice <device_name> <vm-path> getconfigfile Disconnectsthespecifiedvirtualdevicefromthevirtualmachine. Returnsastringcontainingthenameofthevirtualmachines configurationfile.Thiscommandfailsifthevirtualmachineisnot connected. RetrievesthevalueforaGuestInfovariable. Returnsinformationabouttheproduct,where<prodinfo>is product,platform,build,majorversion(productsmajorversion number),minorversion(productsminorversionnumber)or revision. Ifproductisspecified,thereturnvalueisoneofthefollowing:ws (VMwareWorkstation),gsx(VMwareGSXServer)esx(VMwareESX Server)orunknown(unknownproducttype). Ifplatformisspecified,thereturnvalueisoneofthefollowing: windows(MicrosoftWindows),linux(Linuxoperatingsystem)or unknown(unknownplatformtype). <vm-path> getstate Retrievestheexecutionstateofavirtualmachine.Thestatecanbeon, off,suspended,stuck(requiresuserinput),orunknown.

<vm-path> getguestinfo <variable> <vm-path> getproductinfo <prodinfo>

80

VMware, Inc.

Chapter 4 Managing Virtual Machines with vmware-cmd

Table 4-4. Commands that apply to any VMware Infrastructure Host (Continued)
Command <vm-path> gettoolslastactive Description Returnsanintegerindicatinghowmuchtimehaspassed,inseconds, sincethelastheartbeatwasdetectedfromtheVMwareToolsservice. Thisvalueisinitializedtozerowhenthevirtualmachinepowerson. Itstaysatzerountilthefirstheartbeatisdetected,afterwhichthe valueisalwaysgreaterthanzerountilthevirtualmachineispower cycledagain. Accessestheuptimeoftheguestoperatingsystemonthevirtual machine. Returns1ifthevirtualmachinealreadyhasasnapshot.Returns0 otherwise. Removesallsnapshotsbelongingtothevirtualmachine.Ifno snapshotexists,thenthisoperationdoesnothing. Shutsdown,thenrebootsavirtualmachine.Thepowerop_modecan behard,soft,ortrysoft.Ifpowerop_modeisnotspecified,the defaultissoft.SeeValuesforpowerop_modeonpage 81. Revertsthevirtualmachinetothecurrentsnapshot.Ifnosnapshot exists,thenthisoperationdoesnothing,andthevirtualmachinestate remainsunchanged. WritesaGuestInfovariableintomemory.Thevariableisdiscarded whenthevirtualmachineprocessterminates. Powersonapreviouslypoweredoffvirtualmachineorresumesa suspendedvirtualmachine.Thepowerop_modecanbehard,soft,or trysoft.Ifpowerop_modeisnotspecified,thedefaultissoft.See Valuesforpowerop_modeonpage 81. Shutsdownandpowersoffavirtualmachine.Thepowerop_modecan behard,soft,ortrysoft.Ifpowerop_modeisnotspecified,the defaultissoft.SeeValuesforpowerop_modeonpage 81. Suspendsavirtualmachine.Thepowerop_modecanbehard,soft,or trysoft.Ifpowerop_modeisnotspecified,thedefaultissoft.See Valuesforpowerop_modeonpage 81.

<vm-path> getuptime <vm-path> hassnapshot <vm-path> removesnapshots <vm-path> reset <powerop_mode> <vm-path> revertsnapshot

<vm-path> setguestinfo <variable> <value> <vm-path> start <powerop_mode>

<vm-path> stop <powerop_mode> <vm-path> suspend <powerop_mode>

Values for powerop_mode


Whenyoucallvmware-cmdtostart,stop,reset,orsuspendavirtualmachine,youmust supplyavalueforthepowerop_modeflag.Thissectiondescribeswhathappenswhen thatvalueissoft,hard,andtrysoft. NOTEYoumusthavethecurrentversionofVMwareToolsinstalledandrunningin theguestoperatingsystemtouseasoftpoweroperation.

VMware, Inc.

81

Remote Command-Line Interface Installation and Reference Guide

Performing soft Power Operations


Whenyouspecifysoftasthepowerop_modevalue,thecommandperformsthe followingoperations: StopAttemptstoshutdowntheguestoperatingsystem,andthenpowersoffthe virtualmachine. ResetAttemptstoshutdowntheguestoperatingsystem,andthenrebootsthe virtualmachine. SuspendAttemptstorunascriptintheguestoperatingsystembefore suspendingthevirtualmachine. StartThebehaviordependsonthestateofthevirtualmachine. StartwhenavirtualmachineissuspendedAfterresumingthevirtual machine,thecommandattemptstorunascriptintheguestoperatingsystem. TheStartoperationalwayssucceeds.IfVMwareToolsisnotpresentoris malfunctioning,runningthescriptmightfail. StartwhenvirtualmachineispoweredoffAfterpoweringonthevirtual machine,thecommandattemptstorunascriptintheguestoperatingsystem whentheVMwareToolsservicebecomesactive.Thedefaultscriptdoes nothingduringthisoperationbecauseitdoesnothavetorenewaDHCPlease. TheStartoperationalwayssucceeds.IfVMwareToolsisnotpresentoris malfunctioning,runningthescriptmightfail.

Performing hard Power Operations


Whenyouspecifyhardasthepowerop_modevalue,thecommandperformsthe followingoperations: StartStartsorresumesavirtualmachinewithoutrunninganyscripts,thatis, performsastandardpoweronorresumeoperation. Stop,resetorsuspendImmediatelyandunconditionallypowersoff,resets,or suspendsthevirtualmachine.

Performing trysoft Power Operations


Whenyouspecifytrysoftasthepowerop_modevalue,thesystemfirstattemptsto performthesoftpowertransitionoperation.Ifthisattemptfails,thesystemperforms thehardpoweroperation.

82

VMware, Inc.

Chapter 4 Managing Virtual Machines with vmware-cmd

vmware-cmd Examples
Thefollowingexamplesforvmware-cmdrequireconnectionoptions.SeeSpecifying OptionsforRemoteCLICommandsonpage 19.
vmware-cmd.pl <conn_params> C:\home\vmware\win2000.vmx getstate

Retrievestheexecutionstateofavirtualmachine.C:\home\vmware\win2000.vmxis thepathtothevirtualmachinesconfigurationfile.
vmware-cmd.pl <conn_params> -q C:\home\vmware\win2000.vmx reset hard

Performsahardreset,thatis,thevirtualmachineisresetimmediatelyand unconditionally. -qindicatesthequietoption(onlytheresultsoftheoperationareprinted). C:\home\vmware\win2000.vmxisthepathtothevirtualmachinesconfiguration file.


vmware-cmd.pl <conn_params> D:\dir.vmx connectdevice "CD/DVD Drive 2"

ConnectsthevirtualIDEdeviceCD/DVD Drive 2inaWindowsguestoperating system.


vmware-cmd.pl <conn_params> /vmfs/volumes/4654bb7d-37601c39-9c29-00145e5a8a9d/padellvm2/padellvm2.vmx getproductinfo product

Returns,forexample,getproductinfo(product) = esx.

VMware, Inc.

83

Remote Command-Line Interface Installation and Reference Guide

84

VMware, Inc.

Index

Numerics
2gbsparse disk format 70

A
adding NAS datastore 26 appliance See virtual appliance

B
backup of configuration information 45

C
cloning 73 cloning virtual disks 73 command-line connection parameters 21 commands with esxcfg prefix 61 configuration files 20, 24 configuration information 45 connection options 19, 24 copying files 59 cp936 encoding 22 creating directories 60 creating pass-through RDM 76 creating session files 19 creating VMFS 68

directory groups 58 disk attributes 69 disk formats 69 supported 69 disk partition target 66 disks See virtual disks displaying virtual disks 76 DNS configuration 36 downloading files 59 downloading Remote CLI package 13

E
eagerzeroedthick disk format 70 editing remote files example 26 encoding cp936 22 ISO-8859-1 22 Shift_JIS 22 environment variables 20 esxcfg prefix 61 esxcfg-advcfg 55, 62 esxcfg-cfgbackup 45, 62 esxcfg-dns 36, 62 esxcfg-dumppart 28, 62 esxcfg-module 55, 62 esxcfg-mpath 30, 62 esxcfg-nas 33, 62 esxcfg-nics 38, 62 esxcfg-ntp 39, 62 esxcfg-rescan 34, 62 esxcfg-route 40, 62 esxcfg-snmp 47, 62

D
deleting virtual disks 72 device target 66 diagnostic partitions deactivating 29 managing 28 vicfg-dumppart 28
VMware, Inc.

85

Remote Command-Line Interface Installation and Reference Guide

esxcfg-syslog 49, 62 esxcfg-user 56, 62 esxcfg-vmhbadevs 35, 62 esxcfg-vmknic 41, 62 esxcfg-vswitch 42, 62 examples adding a NAS datastore 26 cloning raw disk 73 cloning virtual disk 73 command line 25 configuration files 24 deleting a virtual disk 72 editing files on ESX host 26 editing remote files 26 extending virtual disks 75 extending VMFS volume 68 inflating virtual disks 72 initializing virtual disks 72 listing attributes 69 physical compatibility mode RDM 76 renaming virtual disks 73 session files 24 specifying connection options 24 SSPI protocol 25 svmotion 54 vicfg-cfgbackup 46 vicfg-dns 37 vicfg-dumppart 29 vicfg-module 55 vicfg-mpath 32 vicfg-nas 33 vicfg-nics 38 vicfg-ntp 40 vicfg-rescan 34 vicfg-route 40 vicfg-snmp 48 vicfg-syslog 49 vicfg-user 57
86

vicfg-vmhbadevs 35 vicfg-vmknic 42 vicfg-vswitch 44 vifs 60 virtual compatibility mode RDM 75 virtual disks 71 VMFS file system 68 executing commands Linux 13, 14 Windows 15, 16 execution options 22 extending a virtual disk 74 extending existing VMFS volume 68 extending volume 68

F
Fibre Channel storage 30 file groups 58 file system target 66 file systems NAS 33 VMFS 68 finding available LUNs 35 fixed path policy 31

G
groups 56 GSX Server 74

H
hard power operations 82 host maintenance, vihostupdate 50

I
importing virtual appliance 17 inflating thin virtual disks 72 initializing virtual disks 71

VMware, Inc.

Index

installing Remote CLI Linux 13 Windows 15 iSCSI storage 30 ISO-8859-1 encoding 22

L
Linux executing commands 14 installing Remote CLI 13 Remote CLI 13 shell 17 listing available LUNs 35 listing disk attributes 69 listing RDM attributes 76 listing VMFS volume attributes 69 logs 49 LUNs listing available 35 rescanning 34 VML names 30

miscellaneous management commands 54 module options 55 monoflat disk format 70 monosparse disk format 70 most recently used path policy 31 MRU path policy 31 multipathing 30

N
NAS datastores accessing 33 adding in script 26 adding to ESX host 33 removing from ESX host 33 vicfg-nas 26, 33 NetQueue configuration 55 network adapters duplex value 38 managing 38 speed 38 vicfg-nics 38 vicfg-vmknic 41 Network Time Protocol 39 networking commands 36 NICs 38 NTP Server 39

M
maintenance 50 managing diagnostic partitions 28 managing groups 56 managing NAS file systems 33 managing physical NICs 38 managing users 56 managing virtual switches 42 managing VMkernel NICs 41 manipulating route entry 40 Microsoft Windows Security Support Provider Interface 21 migrating virtual machines GSX Server 74 svmotion 52 vmkfstools 74 VMware Workstation 74

O
options 22

P
parameters, command line 21 partitions, diagnostic 28 password, virtual appliance 18 path policies 31 performance monitoring 45 Perl 9

VMware, Inc.

87

Remote Command-Line Interface Installation and Reference Guide

physical compatibility mode disk format 70 physical compatibility mode RDM 76 physical network adapters 38 physical NICs 38 port groups 42 power operations hard 82 soft 82 trysoft 82 powerop_mode 81

R
raw device mapping physical compatibility mode 76 virtual compatibility mode 75 raw disks cloning 73 format 70 rdm format 70 rdmp format 70 RCLI See Remote CLI rdm disk format 70 rdmp disk format 70 RDMs attributes 76 physical compatibility mode 76 virtual compatibility mode 75 Remote CLI command-line 21 configuration files 20 environment variables 20 execution options 22 installing on Linux 13 installing on Windows 15 using virtual appliance 17 Remote CLI package downloading 13 installing on Linux 13
88

installing on Windows 15 uninstalling 15, 16 unpacking 13 Remote CLI virtual appliance installing 17 running 18 renaming virtual disks 73 required parameters 19 rescanning adapters 34 rescanning LUNs 34 resxtop 10, 45 root password 18 route entry 40 Running 59 running vifs 59 running virtual appliance 18

S
scripts with Remote CLI commands 25 session files 19, 24 Shift_JIS encoding 22 Simple Network Management Protocol 47 snapshots 74 soft power operations 82 SSPI protocol 21, 25 storage commands 28 creating directories with vifs 60 supported disk formats 69 svmotion 52 syslog server 49 system logs 49 system management commands 45

T
target, specifying 66 thick disk format 70 thin disk format 70

VMware, Inc.

Index

thin virtual disks inflating 72 vmkfstools 72 trysoft power operations 82

U
uninstalling Remote CLI package Linux 15 Windows 16 unpacking Remote CLI package 13 users, managing 56 using session files 19

V
variables 20 VI Perl Toolkit 9 vicfg-advcfg 55 vicfg-cfgbackup 45 vicfg-dns 36 vicfg-dumppart 28 vicfg-module NetQueue configuration 55 uses 55 vicfg-mpath 30 vicfg-nas 33 vicfg-nics 38 vicfg-ntp 39 vicfg-rescan 34 vicfg-route 40 vicfg-snmp 47 vicfg-syslog 49 vicfg-user 56 vicfg-vmhbadevs 35 vicfg-vmknic 41 vicfg-vswitch 42 vifs 58, 59 vihostupdate 50 virtual appliance environment variables 20
VMware, Inc.

importing 17 installing Remote CLI 17 introduction 17 multiple configuration files 20 required parameters 19 root password 18 running 18 using Remote CLI 17 virtual compatibility mode RDM 75 virtual disk geometry 76 virtual disks cloning 73 creating 70, 71 deleting 72 extending 75 inflating 72 initializing 71, 72 options 69 renaming 73 virtual machines HBA names 30 management commands 51 managing 79 migrating 52 vmware-cmd 79 virtual switches port groups 42 vicfg-vswitch 42 VMFS creating with vmkfstools 67, 68 extending volumes 68 listing attributes 69 vmkfstools 63 volume attributes 69 VMkernel module options 55 VMkernel NICs 41 vmkfstools command syntax 64 creating pass-through RDM 76
89

Remote Command-Line Interface Installation and Reference Guide

creating virtual disk 70 creating VMFS 67 creating VMFS example 68 deleting virtual disk 72 device target 66 disk formats 69 disk partition target 66 display disk geometry 76 extending virtual disk 74 extending volume 68 file system options 67 file system target 66 inflating thin virtual disk 72 initializing virtual disk 71 options 67 overview 63 RDM attributes 76 renaming virtual disk 73 snapshots 74 syntax 64 virtual disk options 69 VMFS volume attributes 69

VML LUN names 30 VMware Workstation 74 vmware-cmd connection options 78 examples 83 general options 78 server options 79 virtual machine options 79

W
Windows executing commands 16 installing Remote CLI 15 using Remote CLI 15

Z
zeroedthick disk format 69

90

VMware, Inc.

Você também pode gostar