Vmware VSphere Command Line Interface Concepts And Examples V Center Server 6.0 Esxi Vcenter 60 En

User Manual: vmware vCenter Server - 6.0 - Command-Line Interface Concepts and Examples Free User Guide for VMware vCenter Software, Manual

Open the PDF directly: View PDF PDF.
Page Count: 156

DownloadVmware VSphere Command-Line Interface Concepts And Examples V Center Server - 6.0 Vsphere-esxi-vcenter-server-60-command-line-interface-concepts-examples-en
Open PDF In BrowserView PDF
vSphere Command-Line Interface
Concepts and Examples
ESXi 6.0
vCenter Server 6.0

This document supports the version of each product listed and
supports all subsequent versions until the document is replaced
by a new edition. To check for more recent editions of this
document, see http://www.vmware.com/support/pubs.

EN-001470-00

vSphere Command-Line Interface Concepts and Examples

You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
docfeedback@vmware.com

Copyright © 2008 - 2015 VMware, Inc. All rights reserved. Copyright and trademark information

VMware, Inc.
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com

2

VMware, Inc.

Contents

About This Book

9

1 vSphere CLI Command Overviews 11
Introduction 11
Documentation 12
Command‐Line Help 12
List of Available Host Management Commands 12
Targets and Protocols for vCLI Host Management Commands 14
Supported Platforms for vCLI Commands 15
Commands with an esxcfg Prefix 16
ESXCLI Overview 16
ESXCLI Commands Available on Different ESXi Hosts 16
Trust Relationship Requirement for ESXCLI Commands 17
Downloading and Installing the vCenter Server Certificate 17
Using the ‐‐cacertsfile Option 17
Using the ‐‐thumbprint Option 17
Using the Credential Store 17
Using ESXCLI Output 18
Connection Options for vCLI Host Management Commands 18
Connection Options for DCLI Commands 18
vCLI Host Management Commands and Lockdown Mode 19

2 Managing Hosts 21
Stopping, Rebooting, and Examining Hosts 21
Stopping and Rebooting Hosts with ESXCLI 21
Stopping, Rebooting, and Examining Hosts with vicfg‐hostops 21
Entering and Exiting Maintenance Mode 22
Entering and Exiting Maintenance Mode with ESXCLI 22
Entering and Exiting Maintenance Mode with vicfg‐hostops 23
Backing Up Configuration Information with vicfg‐cfgbackup 23
Backup Tasks 23
Backing Up Configuration Data 24
Restoring Configuration Data 24
Using vicfg‐cfgbackup from vMA 24
Managing VMkernel Modules 24
Managing Modules with esxcli system module 25
Managing Modules with vicfg‐module 25
Using vicfg‐authconfig for Active Directory Configuration 25
Updating Hosts 26

3 Managing Files 27
Introduction to Virtual Machine File Management 27
Managing the Virtual Machine File System with vmkfstools 28
Upgrading VMFS3 Volumes to VMFS5 29
Managing VMFS Volumes 29
Managing Duplicate VMFS Datastores 29
Mounting Datastores with Existing Signatures 29
VMware, Inc.

3

Getting Started with vSphere Command-Line Interfaces

Mounting and Unmounting with ESXCLI 30
Mounting and Unmounting with vicfg‐volume 30
Resignaturing VMFS Copies 30
Resignaturing a VMFS Copy with ESXCLI 31
Resignaturing a VMFS Copy with vicfg‐volume 31
Reclaiming Unused Storage Space 31
Using vifs to View and Manipulate Files on Remote ESXi Hosts 32
Examples 34
Example Scenario 35

4 Managing Storage 37
Introduction to Storage 37
How Virtual Machines Access Storage 38
Datastores 39
Storage Device Naming 39
Device Identifiers 40
Legacy Identifiers 40
Examining LUNs 40
Target and Device Representation 40
Examining LUNs with esxcli storage core 41
Examining LUNs with vicfg‐scsidevs 42
Detaching Devices and Removing a LUN 43
Working with Permanent Device Loss 43
Managing Paths 44
Multipathing with Local Storage and FC SANs 44
Listing Path Information 45
Listing Path Information with ESXCLI 45
Listing Path Information with vicfg‐mpath 46
Changing the State of a Path 46
Changing Path State with ESXCLI 47
Changing Path State with vicfg‐mpath 47
Managing Path Policies 47
Multipathing Considerations 48
Changing Path Policies 49
Changing Path Policies with ESXCLI 49
Changing Path Policies with vicfg‐mpath 49
Setting Policy Details for Devices that Use Round Robin 50
Managing NFS/NAS Datastores 50
Capabilities Supported by NFS/NAS 51
Adding and Deleting NAS File Systems 51
Managing NAS File Systems with ESXCLI 51
Managing NAS File Systems with vicfg‐nas 52
Monitoring and Managing SAN Storage 52
Monitoring and Managing Virtual SAN Storage 53
To retrieve Virtual SAN information 53
To manage a Virtual SAN cluster 53
To add and remove Virtual SAN storage 54
Monitoring vSphere Flash Read Cache 54
Monitoring and Managing Virtual Volumes 55
Migrating Virtual Machines with svmotion 55
Storage vMotion Uses 56
Storage vMotion Requirements and Limitations 56
Running svmotion in Interactive Mode 56
Running svmotion in Noninteractive Mode 56
4

VMware, Inc.

Contents

Configuring FCoE Adapters 57
Scanning Storage Adapters 58
Retrieving SMART Information 58

5 Managing iSCSI Storage 59
iSCSI Storage Overview 59
Discovery Sessions 60
Discovery Target Names 61
Protecting an iSCSI SAN 61
Protecting Transmitted Data 61
Securing iSCSI Ports 62
Setting iSCSI CHAP 62
Command Syntax for esxcli iscsi and vicfg‐iscsi 63
esxcli iscsi Command Syntax 63
Key to esxcli iscsi Short Options 64
vicfg‐iscsi Command Syntax 65
iSCSI Storage Setup with ESXCLI 68
Setting Up Software iSCSI with ESXCLI 68
Setting Up Dependent Hardware iSCSI with ESXCLI 70
Setting Up Independent Hardware iSCSI with ESXCLI 72
iSCSI Storage Setup with vicfg‐iscsi 73
Setting Up Software iSCSI with vicfg‐iscsi 73
Setting Up Dependent Hardware iSCSI with vicfg‐iscsi 75
Setting Up Independent Hardware iSCSI with vicfg‐iscsi 76
Listing and Setting iSCSI Options 77
Listing iSCSI Options with ESXCLI 77
Setting MTU with ESXCLI 78
Listing and Setting iSCSI Options with vicfg‐iscsi 78
Listing and Setting iSCSI Parameters 78
Listing and Setting iSCSI Parameters with ESXCLI 79
Returning Parameters to Default Inheritance 80
Listing and Setting iSCSI Parameters with vicfg‐iscsi 80
Returning Parameters to Default Inheritance 81
Enabling iSCSI Authentication 82
Enabling iSCSI Authentication with ESXCLI 82
Enabling iSCSI Authentication with vicfg‐iscsi 83
Setting Up Ports for iSCSI Multipathing 83
Managing iSCSI Sessions 84
Introduction to iSCSI Session Management 84
Listing iSCSI Sessions 85
Logging in to iSCSI Sessions 85
Removing iSCSI Sessions 85

6 Managing Third‐Party Storage Arrays 87
Managing NMP with esxcli storage nmp 87
Device Management with esxcli storage nmp device 87
esxcli storage nmp device list 88
esxcli storage nmp device set 88
Listing Paths with esxcli storage nmp path 88
Managing Path Selection Policy Plugins with esxcli storage nmp psp 88
Retrieving PSP Information 89
Setting Configuration Parameters for Third‐Party Extensions 89
Fixed Path Selection Policy Operations 89
Retrieving the Preferred Path 89
Setting the Preferred Path 90
VMware, Inc.

5

Getting Started with vSphere Command-Line Interfaces

Customizing Round Robin Setup 90
Retrieving Path Selection Settings 90
Specifying Conditions for Path Changes 91
Managing SATPs 91
Retrieving Information About SATPs 91
Adding SATP Rules 91
Removing SATP Rules 92
Retrieving and Setting SATP Configuration Parameters 93
Path Claiming with esxcli storage core claiming 93
Using the Reclaim Troubleshooting Command 94
Unclaiming Paths or Sets of Paths 94
Managing Claim Rules 95
Adding Claim Rules 95
Converting ESX 3.5 LUN Masks to Claim Rule Format 97
Removing Claim Rules 98
Listing Claim Rules 98
Loading Claim Rules 98
Moving Claim Rules 98
Running Path Claiming Rules 99

7 Managing Users 101
Users in the vSphere Environment 101
vicfg‐user Command Syntax 101
Managing Users with vicfg‐user 102
Assigning Permissions with ESXCLI 104

8 Managing Virtual Machines 105
vmware‐cmd Overview 105
Connection Options for vmware‐cmd 106
General Options for vmware‐cmd 106
Format for Specifying Virtual Machines 106
Listing and Registering Virtual Machines 106
Retrieving Virtual Machine Attributes 107
Managing Virtual Machine Snapshots with vmware‐cmd 108
Taking Virtual Machine Snapshots 109
Reverting and Removing Snapshots 109
Powering Virtual Machines On and Off 109
Connecting and Disconnecting Virtual Devices 110
Working with the AnswerVM API 111
Forcibly Stopping Virtual Machines with EXCLI 111

9 Managing vSphere Networking 113
Introduction to vSphere Networking 113
Networking Using vSphere Standard Switches 114
Networking Using vSphere Distributed Switches 115
Retrieving Basic Networking Information 115
Network Troubleshooting 116
Setting Up vSphere Networking with vSphere Standard Switches 117
Setting Up Virtual Switches and Associating a Switch with a Network Interface 117
Retrieving Information About Virtual Switches 118
Retrieving Information about Virtual Switches with ESXCLI 118
Retrieving Information about Virtual Switches with vicfg‐vswitch 118
Adding and Deleting Virtual Switches 119
Adding and Deleting Virtual Switches with ESXCLI 119
6

VMware, Inc.

Contents

Adding and Deleting Virtual Switches with vicfg‐vswitch 119
Setting Switch Attributes with esxcli network vswitch standard 119
Setting Switch Attributes with vicfg‐vswitch 120
Checking, Adding, and Removing Port Groups 120
Managing Port Groups with ESXCLI 120
Managing Port Groups with vicfg‐vswitch 120
Managing Uplinks and Port Groups 121
Connecting and Disconnecting Uplink Adapters and Port Groups with ESXCLI 121
Connecting and Disconnecting Uplinks and Port Groups with vicfg‐vswitch 121
Setting the Port Group VLAN ID 121
Setting the Port Group VLAN ID with ESXCLI 121
Setting the Port Group VLAN ID with vicfg‐vswitch 122
Managing Uplink Adapters 122
Managing Uplink Adapters with esxcli network nic 122
Specifying Multiple Uplinks with ESXCLI 123
Managing Uplink Adapters with vicfg‐nics 124
Linking and Unlinking Uplink Adapters with ESXCLI 124
Linking and Unlinking Uplink Adapters with vicfg‐vswitch 124
Adding and Modifying VMkernel Network Interfaces 125
Managing VMkernel Network Interfaces with ESXCLI 125
Managing VMkernel Network Interfaces with vicfg‐vmknic 126
Setting Up vSphere Networking with vSphere Distributed Switch 128
Managing Standard Networking Services in the vSphere Environment 128
Setting the DNS Configuration 128
Setting the DNS Configuration with ESXCLI 128
Setting the DNS Configuration with vicfg‐dns 130
Adding and Starting an NTP Server 131
Managing the IP Gateway 131
Setting Up IPsec 132
Using IPsec with ESXi 132
Managing Security Associations 133
Managing Security Policies 134
Managing the ESXi Firewall 135
Monitoring VXLAN 136
137

10 Monitoring ESXi Hosts 139
Using resxtop for Performance Monitoring 139
Managing Diagnostic Partitions 139
Diagnostic Partition Creation 140
Diagnostic Partition Management 140
Managing Core Dumps 140
Managing Local Core Dumps with ESXCLI 140
Managing Core Dumps with ESXi Dump Collector 141
Managing Core Dumps with vicfg‐dumppart 141
Configuring ESXi Syslog Services 142
Managing ESXi SNMP Agents 143
Configuring SNMP Communities 144
Configuring the SNMP Agent to Send Traps 144
Configuring a Trap Destination with ESXCLI 144
Configuring a Trap Destination with vicfg‐snmp 145
Configuring the SNMP Agent for Polling 145
Retrieving Hardware Information 146

VMware, Inc.

7

Contents

Index 147

VMware, Inc.

8

About This Book

The Getting Started with vSphere Command‐Line Interfaces documentation explains how to use the commands in
the VMware vSphere® Command‐Line Interface (vCLI) and includes command overviews and examples.

Intended Audience
This book is for experienced Windows or Linux system administrators who are familiar with vSphere
administration tasks and data center operations and know how to use commands in scripts.

Document Feedback
VMware welcomes your suggestions for improving our documentation. If you have comments, send your
feedback to docfeedback@vmware.com or click on the Send Us Feedback button in the documentation center.

Related Documentation
The vSphere Command‐Line Interface Reference, available in the vSphere Documentation Center, includes
reference information for vicfg- commands and ESXCLI commands.
Getting Started with vSphere Command‐Line Interfaces includes information about available CLIs, enabling the
ESXi Shell, and installing and running vCLI and DCLI commands.
Command‐Line Management in vSphere 5 and vSphere 6 for Service Console Users is for customers who currently
use the ESX Service Console.
The vSphere SDK for Perl documentation explains how you can use the vSphere SDK for Perl and related
utility applications to manage your vSphere environment. The documentation includes an Installation Guide, a
Programming Guide, and a reference to the vSphere SDK for Perl Utility Applications.
Background information for the tasks discussed in this manual is available in the vSphere documentation set.
The vSphere documentation consists of the combined vCenter Server and ESXi documentation and includes
information about managing storage, networking virtual machines, and more.

Technical Support and Education Resources
The following sections describe the technical support resources available to you. To access the current version
of this book and other books, go to http://www.pubs.vmware.com..

Online and Telephone Support
To use online support to submit technical support requests, view your product and contract information, and
register your products, go to http://www.vmware.com/support.
Customers with appropriate support contracts should use telephone support for the fastest response on
priority 1 issues. Go to http://www.vmware.com/support/phone_support.

VMware, Inc.

9

Getting Started with vSphere Command-Line Interfaces

Support Offerings
To find out how VMware support offerings can help meet your business needs, go to
http://www.vmware.com/support/services.

VMware Professional Services
VMware Education Services courses offer extensive hands‐on labs, case study examples, and course materials
designed to be used as on‐the‐job reference tools. Courses are available onsite, in the classroom, and live
online. For onsite pilot programs and implementation best practices, VMware Consulting Services provides
offerings to help you assess, plan, build, and manage your virtual environment. To access information about
education classes, certification programs, and consulting services, go to http://www.vmware.com/services.

10

VMware, Inc.

1

vSphere CLI Command Overviews

1

This chapter introduces the command set, presents supported commands for different versions of vSphere,
lists connection options, and discusses vCLI and lockdown mode.
This chapter includes the following topics:


“Introduction” on page 11



“List of Available Host Management Commands” on page 12



“Targets and Protocols for vCLI Host Management Commands” on page 14



“Commands with an esxcfg Prefix” on page 16



“ESXCLI Overview” on page 16



“Connection Options for vCLI Host Management Commands” on page 18



“Connection Options for DCLI Commands” on page 18



“vCLI Host Management Commands and Lockdown Mode” on page 19

Introduction
The commands in the vSphere CLI package allow you to perform vSphere configuration tasks using
commands from vCLI package installed on supported platforms, or using commands from vMA. The package
consists of several command sets.
Table 1-1. Components of the vSphere CLI Command Set
vCLI Commands

Description

ESXCLI commands

Manage many aspects of an ESXi host. You can run ESXCLI commands remotely or in the
ESXi Shell.
You can also run ESXCLI commands from the vSphere PowerCLI prompt by using the
Get-EsxCli cmdlet.

vicfg- commands

Set of commands for many aspects of host management Eventually, these commands will be
replaced by ESXCLI commands.
A set of esxcfg- commands that precisely mirrors the vicfg- commands is also included in
the vCLI package. f

Other commands
(vmware-cmd, vifs,
vmkfstools)

Commands implemented in Perl that do not have a vicfg- prefix. These commands are
scheduled to be deprecated or replaced by ESXCLI commands.

DCLI commands

Manage VMware SDDC services.
DCLI is a CLI client to the vCloud Suite SDK interface for managing VMware SDDC services.
A DCLI command talks to a vCloud Suite API endpoint to locate relevant information, and
then executes the command and displays result to the user.

VMware, Inc.

11

Getting Started with vSphere Command-Line Interfaces

You can install the vSphere CLI command set on a supported Linux or Windows system. See Getting Started
with vSphere Command‐Line Interfaces. You can also deploy the vSphere Management Assistant (vMA) to an
ESXi system of your choice.
After installation, run vCLI commands from the Linux or Windows system or from vMA.


Manage ESXi hosts with other vCLI commands by specifying connection options such as the target host,
user, and password or a configuration file. See “Connection Options for vCLI Host Management
Commands” on page 18.



Manage vCenter services with DCLI commands by specifying a target vCenter Server system and
authentication options. See Getting Started with vSphere Command‐Line Interfaces for a list of connection
options.

Documentation
Getting Started with vSphere Command‐Line Interfaces includes information about available CLIs, enabling the
ESXi Shell, and installing and running vCLI commands. An appendix supplies the namespace and command
hierarchies for ESXCLI.
Reference information for vCLI and DCLI commands is available on the vCLI documentation page
http://www.vmware.com/support/developer/vcli/ and in the vSphere Documentation Center for the product
version that you are using.


vSphere Command‐Line Interface Reference is a reference to vicfg- and related vCLI commands and
includes reference information for ESXCLI commands. All reference information is generated from the
help.



A reference to esxtop and resxtop is included in the Resource Management documentation.



The DCLI Reference is included separately from the vSphere Command‐Line Interface Reference. All reference
information is generated from the help.

Command-Line Help
Available command‐line help differs for the different command sets.
Command set
vicfg‐ commands

Available Command-Line Help
Run  --help for an overview of each options.
Run Pod2Html with a vicfg‐ command as input and pipe the output to a file for more detailed
help information.
pod2html vicfg-authconfig.pl > vicfg-authconfig.html
This output corresponds to the information available in the vSphere Command‐Line Interface
Reference.

ESXCLI commands

Run --help at any level of the hierarchy for information about both commands and
namespaces available from that level.

DCLI commands

Run --help for any command or namespace to display the input options, whether the option
is required, and the input option type. For namespaces, --help displays all available child
namespaces and commands.
Run dcli --help to display usage information for DCLI.

List of Available Host Management Commands
Table 1‐2 lists vCLI host management commands in alphabetical order and the corresponding ESXCLI
command if available. For ESXCLI, new commands and namespaces are added with each release. See the
Release Notes for the corresponding release for information.
Functionality of DCLI command set that is being added in vSphere 6.0 is different from these commands. They
are not included in the table.

12

VMware, Inc.

Chapter 1 vSphere CLI Command Overviews

Table 1-2. vCLI and ESXCLI Commands
vCLI 4.1 Command

vCLI 5.1 and later
Command

esxcli

esxcli (new syntax)

All vCLI 4.1 commands have been renamed. Significant additions have been
made to ESXCLI. Many tasks previously performed with a vicfg- command
is now performed with ESXCLI.

resxtop

resxtop (No ESXCLI
equivalent)

Monitors in real time how ESXi hosts use resources. Runs in interactive or
batch mode.

Supported only on
Linux.

See “Using resxtop for Performance Monitoring” on page 139. See the vSphere
Resource Management documentation for a detailed reference.

svmotion (No ESXCLI

Moves a virtual machine’s configuration file, and, optionally, its disks, while
the virtual machine is running.

svmotion

equivalent)
Must run against a
vCenter Server system.
vicfg-advcfg

esxcli system
settings advanced

Comment

See “Migrating Virtual Machines with svmotion” on page 55.
Performs advanced configuration.
The advanced settings are a set of VMkernel options. These options are
typically in place for specific workarounds or debugging.
Use this command as instructed by VMware.

vicfg-authconfig

vicfg-authconfig (No
ESXCLI equivalent).

Remotely configures Active Directory settings for an ESXi host.
See “Using vicfg‐authconfig for Active Directory Configuration” on page 25.
Backs up the configuration data of an ESXi system and restores previously
saved configuration data.

vicfg-cfgbackup (No
ESXCLI equivalent),
Cannot run against a
vCenter Server system.

See “Backing Up Configuration Information with vicfg‐cfgbackup” on
page 23.

vicfg-dns

esxcli network ip
dns

Specifies an ESXi host’s DNS (Domain Name Server) configuration. See
“Setting the DNS Configuration” on page 128.

vicfg-dumppart

esxcli system
coredump

Sets both the partition (esxcli system coredump partition) and the
network (esxcli system coredump network) to use for core dumps. Use
this command to set up ESXi Dump Collector.

vicfg-cfgbackup

“Managing Diagnostic Partitions” on page 139.
vicfg-hostops

vicfg-ipsec

esxcli system
maintenancemode

Manages hosts.

esxcli system
shutdown

“Entering and Exiting Maintenance Mode” on page 22.

esxcli network ip
ipsec

Sets up IPsec (Internet Protocol Security), which secures IP communications
coming from and arriving at ESXi hosts. ESXi hosts support IPsec using IPv6.

“Stopping, Rebooting, and Examining Hosts” on page 21.

See “Setting Up IPsec” on page 132.
vicfg-iscsi

esxcli iscsi

Manages hardware and software iSCSI storage.
See “Managing iSCSI Storage” on page 59.

vicfg-module

esxcli system
module

Enables VMkernel options. Use this command with the options listed in this
document, or as instructed by VMware.
See “Managing VMkernel Modules” on page 24.

esxcli storage core
path

Configures storage arrays.

vicfg-mpath35
vicfg-nas

esxcli storage nfs

Manages NAS/NFS filesystems. See “Managing NFS/NAS Datastores” on
page 50.

vicfg-nics

esxcli network nic

Manages the ESXi host’s uplink adapters. See “Managing Uplink Adapters”
on page 122.

vicfg-ntp

vicfg-ntp (No ESXCLI
equivalent)

Defines the NTP (Network Time Protocol) server. See “Adding and Starting an
NTP Server” on page 131.

vicfg-rescan

esxcli storage core
adapter rescan

Rescans the storage configuration. See “Scanning Storage Adapters” on
page 58.

vicfg-route

esxcli network ip
route)

Manages the ESXi host’s route entry. See “Managing the IP Gateway” on
page 131.

vicfg-mpath

VMware, Inc.

“Managing Paths” on page 44.

13

Getting Started with vSphere Command-Line Interfaces

Table 1-2. vCLI and ESXCLI Commands (Continued)
vCLI 4.1 Command

vCLI 5.1 and later
Command

Comment

vicfg-scsidevs

esxcli storage core
device

Finds and examines available LUNs. See “Examining LUNs” on page 40.

vicfg-snmp

esxcli system snmp

Manages the SNMP agent. “Managing ESXi SNMP Agents” on page 143.
Using SNMP in a vSphere environment is discussed in detail in the vSphere
Monitoring and Performance documentation.
New options added in vCLI 5.0.
Expanded SNMP support added in vCLI 5.1.

vicfg-syslog

esxcli system
syslog

Specifies log settings for ESXi hosts including local storage policies and server
and port information for network logging. See “Configuring ESXi Syslog
Services” on page 142.
The vCenter Server and Host Management documentation explains how to set up
system logs using the vSphere Web Client.

vicfg-user (No
ESXCLI equivalent)

vicfg-user

Creates, modifies, deletes, and lists local direct access users and groups of
users. See “Managing Users” on page 101.
The vSphere Security documentation discusses security implications of user
management and custom roles.

vicfg-vmknic

esxcli network ip
interface .

Adds, deletes, and modifies VMkernel network interfaces. See “Adding and
Modifying VMkernel Network Interfaces” on page 125.

vicfg-volume

esxcli storage
filesystem

Supports resignaturing the copy of a VMFS volume, and mounting and
unmounting the copy. See “Managing Duplicate VMFS Datastores” on
page 29.

vicfg-vswitch

esxcli network
vswitch

Adds or removes virtual switches or modifies virtual switch settings. See
“Setting Up Virtual Switches and Associating a Switch with a Network
Interface” on page 117.

vifs

vifs (No ESXCLI
equivalent)

Performs file system operations such as retrieving and uploading files on the
ESXi system. See “Managing the Virtual Machine File System with
vmkfstools” on page 28.

vihostupdate

esxcli software vib

Updates legacy ESXi hosts to a different version of the same major release.
You cannot run vihostupdate against ESXi 5.0 and later hosts.
See “Managing VMkernel Modules” on page 24.

vmkfstools

vmkfstools (No
ESXCLI equivalent)

Creates and manipulates virtual disks, file systems, logical volumes, and
physical storage devices on an ESXi host. See “Managing the Virtual Machine
File System with vmkfstools” on page 28.

vmware-cmd

vmware-cmd (No
ESXCLI equivalent)

Performs virtual machine operations remotely. This includes, for example,
creating a snapshot, powering the virtual machine on or off, and getting
information about the virtual machine. See “Managing Virtual Machines” on
page 105.

Targets and Protocols for vCLI Host Management Commands
Most vCLI commands are used to manage or retrieve information about one or more ESXi hosts. They can
target an ESXi host or a vCenter Server system. When you target a vCenter Server system, you can use
--vihost to specify the ESXi host to run the command against. The only exception is svmotion, which you
can run against vCenter Server systems, but not against ESXi systems.
The following commands must have an ESXi system, not a vCenter Server system as a target.


vifs



vicfg-user



vicfg-cfgbackup



vihostupdate



vmkfstools

The resxtop command requires an HTTPS connection. All other commands support HTTP and HTTPS.
14

VMware, Inc.

Chapter 1 vSphere CLI Command Overviews

Supported Platforms for vCLI Commands
You cannot run the vihostupdate command against an ESXi 5.0 or later system.
You cannot run vicfg-syslog --setserver or vicfg-syslog --setport with an ESXi 5.0 or later target.
Table 1‐3 lists platform support for the different vCLI commands.
Table 1-3. Platform Support for vCLI 5.x Commands
Command

ESXi 5.x and 6.0

VC 5.xand 6.0

ESXi 4.x

ESX 4.x

VC 4.x

DCLI

No

No

No

No

No

esxcli

Yes

Yes

Yes

Yes

No

resxtop

Yes (from Linux)

Yes (from Linux)

Yes (from
Linux)

Yes (from
Linux)

Yes (from
Linux)

svmotion

No

Yes

No

No

Yes

vicfg-advcfg

Yes

Yes

Yes

Yes

Yes

vicfg-authconfig

Yes

Yes

Yes

Yes

Yes

vicfg-cfgbackup

Yes

No

Yes

No

No

vicfg-dns

Yes

Yes

Yes

Yes

Yes

vicfg-dumppart

Yes

Yes

Yes

Yes

Yes

vicfg-hostops

Yes

Yes

Yes

Yes

Yes

vicfg-ipsec

Yes

No

Yes

Yes

No

vicfg-iscsi

Yes

Yes

Yes

Yes

Yes

vicfg-module

Yes

Yes

Yes

Yes

Yes

vicfg-mpath

Yes

Yes

Yes

Yes

Yes

vicfg-nas

Yes

Yes

Yes

Yes

Yes

vicfg-nics

Yes

Yes

Yes

Yes

Yes

vicfg-ntp

Yes

Yes

Yes

Yes

Yes

vicfg-rescan

Yes

Yes

Yes

Yes

Yes

vicfg-route

Yes

Yes

Yes

Yes

Yes

vicfg-scsidevs

Yes

Yes

Yes

Yes

Yes

vicfg-snmp

Yes

No

Yes

Yes

No

vicfg-syslog

No

No for 5.0 target

Yes

No

Yes

vicfg-user

Yes

No

Yes

Yes

No

vicfg-vmknic

Yes

Yes

Yes

Yes

Yes

vicfg-volume

Yes

Yes

Yes

Yes

Yes

vicfg-vswitch

Yes

Yes

Yes

Yes

Yes

vifs

Yes

No

Yes

Yes

No

vihostupdate

Use esxcli software vib instead.

Yes

Yes

No

vmkfstools

Yes

No

Yes

Yes

No

vmware-cmd

Yes

Yes

Yes

Yes

Yes

vicfg-mpath35

No

No

No

No

No

vihostupdate35

No

No

No

No

No

VMware, Inc.

15

Getting Started with vSphere Command-Line Interfaces

Commands with an esxcfg Prefix
To facilitate easy migration if shell scripts that use esxcfg‐ commands, the vCLI package includes a copy of
each vicfg- command that uses an esxcfg- prefix.
IMPORTANT VMware recommends that you use ESXCLI or the vCLI commands with the vicfg prefix.
Commands with the esxcfg prefix are available mainly for compatibility reasons and are now obsolete.
vCLI esxcfg- commands are equivalent to vicfg- commands, but not completely equivalent to the
deprecated esxcfg- service console commands.
Table 1‐4 lists all vCLI vicfg- commands for which a vCLI command with an esxcfg prefix is available.
Table 1-4. Commands with an esxcfg Prefix
Command with vicfg prefix

Command with esxcfg prefix

vicfg-advcfg

esxcfg-advcfg

vicfg-cfgbackup

esxcfg-cfgbackup

vicfg-dns

esxcfg-dns

vicfg-dumppart

esxcfg-dumppart

vicfg-module

esxcfg-module

vicfg-mpath

esxcfg-mpath

vicfg-nas

esxcfg-nas

vicfg-nics

esxcfg-nics

vicfg-ntp

esxcfg-ntp

vicfg-rescan

esxcfg-rescan

vicfg-route

esxcfg-route

vicfg-scsidevs

esxcfg-scsidevs

vicfg-snmp

esxcfg-snmp

vicfg-syslog

esxcfg-syslog

vicfg-vmknic

esxcfg-vmknic

vicfg-volume

esxcfg-volume

vicfg-vswitch

esxcfg-vswitch

ESXCLI Overview
This section gives an overview of ESXCLI commands and how to use them. See Getting Started with vSphere
Command‐Line Interfaces for details.

ESXCLI Commands Available on Different ESXi Hosts
When you run an ESXCLI vCLI command, you must know the commands supported on the target host. For
example, if you run commands against ESXi 5.x hosts, ESXCLI 5.x commands are supported. If you run
commands against ESXi 6.0 hosts, ESXCLI 6.0 commands are supported.
Some commands or command outputs are determined by the host type. In addition, VMware partners might
develop custom ESXCLI commands that you can run on hosts where the partner VIB has been installed.
Run esxcli --server  --help for a list of namespaces supported on the target. You can drill
down into the namespaces for additional help.
IMPORTANT ESXCLI on ESX 4.x hosts does not support targeting a vCenter Server system. You can therefore
not run ESXCLI commands with --server pointing to a vCenter Server system even if you install vCLI 5.0.

16

VMware, Inc.

Chapter 1 vSphere CLI Command Overviews

Trust Relationship Requirement for ESXCLI Commands
Starting with vSphere 6.0, ESXCLI checks whether a trust relationship exists between the machine where you
run the ESXCLI command and the ESXi host. An error results if the trust relationship does not exist.
To establish the trust relationship, you have these options.

Downloading and Installing the vCenter Server Certificate
You can download the vCenter Server root certificate using a Web browser and add it to the trusted certificates
on the machine where you plan on running ESXCLI commands.
To download the certificate
1

Type the URL of the vCenter Server system or vCenter Server Virtual Appliance into a Web Browser.

2

Click the Download trusted root certificates link.

3

Change the extension of the downloaded file to .zip. (The file is a ZIP file of all certificates in the
TRUSTED_ROOTS store).

4

Extract the ZIP file.
The result is a certs folder. The folder includes files with the extension .0. .1, and so on, which are
certificates, and files with the extension .r0, r1, and so on which are CRL files associated with the
certificates.

5

Add the trusted root certificates to the list of trusted roots. The process differs depending on the platform
you are on.

You can now run ESXCLI commands against any host that is managed by the trusted vCenter Server without
supplying additional information if you specify the vCenter Server in the --server option and the ESXi host
in the --vihost option.

Using the --cacertsfile Option
Using a certificate to establish the trust relationship is the most secure option. You can specify the certificate
with the --cacertsfile parameter or the VI_CACERTFILE variable.

Using the --thumbprint Option
You can supply the thumbprint for the target server (ESXi host or vCenter Server system) in the --thumbprint
parameter (VI_THUMBPRINT variable).
When you run a command, ESXCLI checks first whether a certificate file is available. If not, ESXCLI checks
whether a thumbprint of the target server is available. If not, an error like the following results:
Connect to sof-40583-srv failed. Server SHA-1 thumbprint:
5D:01:06:63:55:9D:DF:FE:38:81:6E:2C:FA:71:BC:Usin63:82:C5:16:51 (not trusted).

You can run the command with the thumbprint to establish the trust relationship, or add the thumbprint to
the VI_THUMBPRINT variable. For example, using the thumbprint of the ESXi host above, you can run the
following command:
esxcli --server myESXi --username user1 --password 'my_password' --thumbprint
5D:01:06:63:55:9D:DF:FE:38:81:6E:2C:FA:71:BC:63:82:C5:16:51 storage nfs list

Using the Credential Store
Your vCLI installation includes a credential store. You can manage the credential store with the
credstore-admin utility application, which is located in the /Perl/apps/general directory inside the
VMware vSphere CLI directory.
IMPORTANT Updating the credential store is a two‐step process. First you add the user and password for the
server, and then you add the thumbprint for the server.

VMware, Inc.

17

Getting Started with vSphere Command-Line Interfaces

To establish trust for a user with the credential store
1

Add the user and password for the target ESXi host to the local credential store.
credstore_admin.pl add --server  --username  --password 

2

Add the thumbprint for the target ESXi host. This thumbprint was returned in the error when you
attempted to connect to the host.
credstore_admin.pl add --server  --thumbprint 

3

If you are using a non‐default credential store file, you have to pass it in with the --credstore option.
Otherwise, this user will be able to access the host without authentication going forward.

Using ESXCLI Output
Many ESXCLI commands generate output you might want to use in your application. You can run esxcli
with the --formatter dispatcher option and send the resulting output as input to a parser.
The --formatter options supports three values, csv, xml, and keyvalue and is used before any namespace.
esxcli --formatter=csv storage filesystem list

Lists all file system information in CSV format.
You can pipe the output to a file.
esxcli --formatter=keyvalue storage filesystem list > myfilesystemlist.txt

IMPORTANT Always use a formatter for consistent output.

Connection Options for vCLI Host Management Commands
You can run host management commands such as ESXCLI commands, vicfg‐ commands, and other
commands with several different connection options. You can target hosts directly or target a vCenter Server
system and specify the host you want to manage. If you are targeting a vCenter Server system, specify the
Platform Services Controller, which includes the vCenter Single Sign‐On service, for best security.
IMPORTANT For connections to ESXi 6.0 hosts, vCLI supports both the IPv4 protocol and the IPv6 protocol.
For earlier versions, vCLI supports only IPv4. In all cases, you can configure IPv6 on the target host with
several of the networking commands.
See the Getting Started with vSphere Command‐Line Interfaces documentation for a complete list and examples.

Connection Options for DCLI Commands
DCLI is a CLI client to the vCloud Suite SDK interface for managing VMware SDDC services. A DCLI
command talks to a vCloud Suite SDK endpoint to get the vCloud Suite SDK command information, executes
the command, and displays result to the user.
You can run DCLI commands locally or from an administration server.


Run DCLI on the Linux shell of a vCenter Server Virtual Appliance.



Install vCLI on a supported Windows or Linux system and target a vCenter Server windows installation
or a vCenter Server Virtual Appliance. You have to provide endpoint information to successfully run
commands.

DCLI commands support other connection options than other commands in the command set.
See the Getting Started with vSphere Command‐Line Interfaces documentation for a complete list and examples.

18

VMware, Inc.

Chapter 1 vSphere CLI Command Overviews

vCLI Host Management Commands and Lockdown Mode
For additional security, an administrator can place one or more hosts managed by a vCenter Server system in
lockdown mode. Lockdown mode affects login privileges for the ESXi host. See the vSphere Security document
in the vSphere 6.0 Documentation Center for a detailed discussion of normal lockdown mode and strict
lockdown mode, and of how to enable and disable them.
To make changes to ESXi systems in lockdown mode, you must go through a vCenter Server system that
manages the ESXi system as the user vpxuser and include both the --server and the --vihost parameter. .
esxcli --server MyVC --vihost MyESXi storage filesystem list
The command prompts for the vCenter Server system user name and password.
The following commands cannot run against vCenter Server systems and are therefore not available in
lockdown mode:


vifs



vicfg-user



vicfg-cfgbackup



vihostupdate



vmkfstools

If you have problems running a command on an ESXi host directly (without specifying a vCenter Server
target), check whether lockdown mode is enabled on that host.

VMware, Inc.

19

Getting Started with vSphere Command-Line Interfaces

20

VMware, Inc.

2

Managing Hosts

2

Host management commands can stop and reboot ESXi hosts, back up configuration information, and manage
host updates. You can also use a host management command to make your host join an Active Directory
domain or exit from a domain.
The chapter includes the following topics:


“Stopping, Rebooting, and Examining Hosts” on page 21



“Entering and Exiting Maintenance Mode” on page 22



“Backing Up Configuration Information with vicfg‐cfgbackup” on page 23



“Managing VMkernel Modules” on page 24



“Using vicfg‐authconfig for Active Directory Configuration” on page 25



“Updating Hosts” on page 26

For information on updating ESXi 5.0 hosts with the esxcli software command and on changing the host
acceptance level to match the level of a VIB that you might want to use for an update, see the vSphere Upgrade
documentation in the vSphere 5.0 Documentation Center.

Stopping, Rebooting, and Examining Hosts
You can stop, reboot, and examine hosts with ESXCLI or with vicfg-hostops.

Stopping and Rebooting Hosts with ESXCLI
You can shut down or reboot an ESXi host using the vSphere Web Client or vCLI commands (ESXCLI or
vicfg-hostops).
Shutting down a managed host disconnects it from the vCenter Server system, but does not remove the host
from the inventory. You can shut down a single host or all hosts in a data center or cluster. Specify one of the
options listed in “Connection Options for vCLI Host Management Commands” on page 18 in place of
.
To shut down a host, run esxcli system shutdown poweroff. You must specify the --reason option and
supply a reason for the shutdown. A --delay option allows you to specify a delay interval, in seconds.
To reboot a host, run system shutdown reboot. You must specify the --reason option and supply a reason
for the shutdown. A --delay option allows you to specify a delay interval, in seconds.

Stopping, Rebooting, and Examining Hosts with vicfg-hostops
You can shut down or reboot an ESXi host using the vSphere Web Client, or ESXCLI or the vicfg-hostops
vCLI command.

VMware, Inc.

21

Getting Started with vSphere Command-Line Interfaces

Shutting down a managed host disconnects it from the vCenter Server system, but does not remove the host
from the inventory. You can shut down a single host or all hosts in a data center or cluster. Specify one of the
options listed in “Connection Options for vCLI Host Management Commands” on page 18 in place of
.


Single host. Run vicfg-hostops with --operation shutdown.


If the host is in maintenance mode, run the command without the --force option.
vicfg-hostops  --operation shutdown



If the host is not in maintenance mode, use --force to shut down the host and all running virtual
machines.
vicfg-hostops  --operation shutdown --force



All hosts in data center or cluster. To shut down all hosts in a cluster or data center, specify --cluster
or --datacenter.
vicfg-hostops  --operation shutdown --cluster 
vicfg-hostops  --operation shutdown --datacenter 

You can reboot a single host or all hosts in a data center or cluster.


Single host. Run vicfg-hostops with --operation reboot.


If the host is in maintenance mode, run the command without the --force option.
vicfg-hostops  --operation reboot



If the host is not in maintenance mode, use --force to shut down the host and all running virtual
machines.
vicfg-hostops  --operation reboot --force



All hosts in data center or cluster. You can specify --cluster or --datacenter to reboot all hosts in a
cluster or data center.
vicfg-hostops  --operation reboot --cluster 
vicfg-hostops  --operation reboot --datacenter 

You can display information about a host by running vicfg-hostops with --operation info.
vicfg-hostops  --operation info

The command returns the host name, manufacturer, model, processor type, CPU cores, memory capacity, and
boot time. The command also returns whether vMotion is enabled and whether the host is in maintenance
mode.

Entering and Exiting Maintenance Mode
You can instruct your host to enter or exit maintenance mode with ESXCLI or with vicfg-hostops.

Entering and Exiting Maintenance Mode with ESXCLI
You place a host in maintenance mode to service it, for example, to install more memory. A host enters or
leaves maintenance mode only as the result of a user request.
esxcli system maintenanceMode set allows you to enable or disable maintenance mode.
When you run the vicfg-hostops vCLI command, you can specify one of the options listed in “Connection
Options for vCLI Host Management Commands” on page 18 in place of .
To enter and exit maintenance mode
1

Run esxcli  system maintenanceMode set --enable true to enter maintenance
mode.
After all virtual machines on the host have been suspended or migrated, the host enters maintenance
mode. You cannot deploy or power on a virtual machine on hosts in maintenance mode.

22

VMware, Inc.

Chapter 2 Managing Hosts

2

Run esxcli  system maintenanceMode set --enable false to have a host
existing maintenance mode.

If you attempt to exit maintenance mode when the host is no longer in maintenance mode, an error informs
you that maintenance mode is already disabled.

Entering and Exiting Maintenance Mode with vicfg-hostops
You place a host in maintenance mode to service it, for example, to install more memory. A host enters or
leaves maintenance mode only as the result of a user request.
vicfg-hostops suspends virtual machines by default, or powers off the virtual machine if you run
vicfg-hostops --action poweroff.
NOTE vicfg-hostops does not work with VMware DRS. Virtual machines are always suspended.
The host is in a state of Entering Maintenance Mode until all running virtual machines are suspended or
migrated. When a host is entering maintenance mode, you cannot power on virtual machines on it or migrate
virtual machines to it.
When you run the vicfg-hostops vCLI command, you can specify one of the options listed in “Connection
Options for vCLI Host Management Commands” on page 18 in place of .
To enter maintenance mode
1

Run vicfg-hostops  --operation enter to enter maintenance mode.

2

Run vicfg-hostops  --operation info to check whether the host is in maintenance
mode or in the Entering Maintenance Mode state.

After all virtual machines on the host have been suspended or migrated, the host enters maintenance mode.
You cannot deploy or power on a virtual machine on hosts in maintenance mode.
You can put all hosts in a cluster or data center in maintenance mode by using the --cluster or
--datacenter option. Do not use those options unless suspending all virtual machines in that cluster or data
center is no problem.
You can later run vicfg-hostops  --operation exit to exit maintenance mode.

Backing Up Configuration Information with vicfg-cfgbackup
After you configure an ESXi host, you can back up the host configuration data. Always back up your host
configuration after you change the configuration or upgrade the ESXi image.
IMPORTANT The vicfg-cfgbackup command is available only for ESXi hosts. The command is not available
through a vCenter Server system connection. No equivalent ESXCLI command is supported.

Backup Tasks
During a configuration backup, the serial number is backed up with the configuration. The number is restored
when you restore the configuration. The number is not preserved when you run the Recovery CD (ESXi
Embedded) or perform a repair operation (ESXi Installable).
You can back up and restore configuration information as follows.
1

Back up the configuration by using the vicfg-cfgbackup command.

2

Run the Recovery CD or repair operation

3

Restore the configuration by using the vicfg-cfgbackup command.

When you restore a configuration, you must make sure that all virtual machines on the host are stopped.

VMware, Inc.

23

Getting Started with vSphere Command-Line Interfaces

Backing Up Configuration Data
You can back up configuration data by running vicfg-cfgbackup with the -s option.
vicfg-cfgbackup  -s /tmp/ESXi_181842_backup.txt

For the backup filename, include the number of the build that is running on the host that you are backing up.
If you are running vCLI on vMA, the backup file is saved locally on vMA. Backup files can safely be stored
locally because virtual appliances are stored in the /vmfs/volumes/ directory on the host,
which is separate from the ESXi image and configuration files.

Restoring Configuration Data
If you have created a backup, you can later restore ESXi configuration data. When you restore configuration
data, the number of the build running on the host must be the same as the number of the build that was
running when you created the backup file. To override this requirement, include the -f (force) option.
To restore ESXi configuration data
1

Power off all virtual machines that are running on the host that you want to restore.

2

Log in to a host on which vCLI is installed, or log in to vMA.

3

Run vicfg-cfgbackup with the -l flag to load the host configuration from the specified backup file.
Specify one of the options listed in “Connection Options for vCLI Host Management Commands” on
page 18 in place of .


If you run the following command, you are prompted for confirmation.
vicfg-cfgbackup  -l /tmp/ESXi_181842_backup.tgz



If you run the following command, you are not prompted for confirmation.
vicfg-cfgbackup  -l /tmp/ESXi_181842_backup.tgz -q

To restore the host to factory settings, run vicfg-cfgbackup with the -r option:
vicfg-cfgbackup  -r

Using vicfg-cfgbackup from vMA
To back up a host configuration, you can run vicfg-cfgbackup from a vMA instance. The vMA instance can
run on the target host (the host that you are backing up or restoring), or on a remote host.
To restore a host configuration, you must run vicfg-cfgbackup from a vMA instance running on a remote
host. The host must be in maintenance mode, which means all virtual machines (including vMA) must be
suspended on the target host.
For example, a backup operation for two ESXi hosts (host1 and host2) with vMA deployed on both hosts works
as follows:


To back up one of the host’s configuration (host1 or host2), run vicfg-cfgbackup from the vMA
appliance running on either host1 or host2. Use the --server option to specify the host for which you
want backup information. The information is stored on vMA.



To restore the host1 configuration, run vicfg-cfgbackup from the vMA appliance running on host2. Use
the --server option to point to host1 to restore the configuration to that host.



To restore the host2 configuration, run vicfg-cfgbackup from the vMA appliance running on host1. Use
the --server option to point to host2 to restore the configuration to that host.

Managing VMkernel Modules
The esxcli system module and vicfg-module commands support setting and retrieving VMkernel module
options.

24

VMware, Inc.

Chapter 2 Managing Hosts

vicfg-module and esxcli system module commands are implementations of the deprecated
esxcfg-module service console command. The two commands support most of the options esxcfg-module
supports. vicfg-module and esxcli system module are commonly used when VMware Technical Support,
a Knowledge Base article, or VMware documentation instruct you to do so.

Managing Modules with esxcli system module
Not all VMkernel modules have settable module options. The following example illustrates how to examine
and enable a VMkernel module. Specify one of the connection options listed in “Connection Options for vCLI
Host Management Commands” on page 18 in place of .
To examine, enable, and set a VMkernel modules
1

List information about the module.
esxcli  system module list -module=module_name

The system returns the name, type, value, and description of the module.
2

(Optional) List all enabled or loaded modules.
esxcli  system module list --enabled=true
esxcli  system module list --loaded=true

3

Enable the model.
esxcli  system module set --module=module_name --enabled=true

4

Set the parameter.
esxcli system module parameters set --module module_name
--parameter-string="parameter_string"

5

Verify that the module is configured.
esxcli  system module parameters list --module=module_name

Managing Modules with vicfg-module
Not all VMkernel modules have settable module options. The following example illustrates how the examine
and enable a VMkernel modules. Specify one of the connection options listed in “Connection Options for vCLI
Host Management Commands” on page 18 in place of .
To examine and set a VMkernel modules
1

Run vicfg-module --list to list the modules on the host.
vicfg-module  --list

2

Run vicfg-module --set-options with connection options, the option string to be passed to a module,
and the module name. For example:
vicfg-module  --set-options '=' 

To retrieve the option string that is configured to be passed to a module when the module is loaded, run
vicfg-module --get-options. This string is not necessarily the option string currently in use by the
module.
vicfg-module  --get-options module_name

Verifies that a module is configured.

Using vicfg-authconfig for Active Directory Configuration
ESXi can be integrated with Active Directory. Active Directory provides authentication for all local services
and for remote access through the vSphere Web Services SDK, vSphere Web Client, PowerCLI, and vSphere
CLI. You can configure Active Directory settings with the vSphere Web Client, as discussed in the vCenter
Server and Host Management documentation, or use vicfg-autconfig.

VMware, Inc.

25

Getting Started with vSphere Command-Line Interfaces

vicfg-authconfig allows you to remotely configure Active Directory settings on ESXi hosts. You can list
supported and active authentication mechanisms, list the current domain, and join or part from an Active
Directory domain. Before you run the command on an ESXi host, you must prepare the host.
IMPORTANT All hosts that join Active Directory must also be managed by an NTP Server to avoid issues with
clock skews and Kerberos tickets.
To prepare ESXi hosts for Active Directory Integration
1

Make sure the ESXi system and the Active Directory server are using the same time zone by configuring
ESXi and AD to use same NTP server.
The ESXi system’s time zone is always set to UTC.

2

Configure the ESXi system’s DNS to be in the Active Directory domain.

You can run vicfg-authconfig to add the host to the domain. A user who runs vicfg-authconfig to
configure Active Directory settings must have the appropriate Active Directory permissions, and must have
administrative privileges on the ESXi host. You can run the command directly against the host or against a
vCenter Server system, specifying the host with --vihost.
To set up Active Directory
1

Install the ESXi host, as explained in the vSphere Installation and Setup documentation.

2

Install Windows Active Directory on a Windows Server that runs Windows 2000, Windows 2003, or
Windows 2008. See the Microsoft Web site for instructions and best practices.

3

Synchronize time between the ESXi system and Windows Active Directory (AD).

4

Test that the Windows AD Server can ping the ESXi host by using the host name.
ping 

5

Run vicfg-authconfig to add the host to the Active Directory domain.
vicfg-authconfig --server=
--username=
--password=
--authscheme AD --joindomain 
--adusername=
--adpassword=

The system prompts for user names and passwords if you do not specify them on the command line.
Passwords are not echoed to the screen.
6

Check that a Successfully Joined  message appears.

7

Verify the ESXi host is in the intended Windows AD domain.
vicfg-authconfig --server XXX.XXX.XXX.XXX --authscheme AD -c

You are prompted for a user name and password for the ESXi system.

Updating Hosts
When you add custom drivers or patches to a host, the process is called an update.

26



Update ESXi 4.0 and ESXi 4.1 hosts with the vihostupdate command, as discussed in the vSphere
Command‐Line Interface Installation and Reference Guide included in the vSphere 4.1 documentation set.



Update ESXi 5.0 hosts with esxcli software vib commands discussed in the vSphere Upgrade
documentation included in the vSphere 5.0 documentation set. You cannot run the vihostupdate
command against ESXi 5.0 or later.



Update ESXi 5.1 hosts with esxcli software vib commands discussed in the vSphere Upgrade
documentation included in the vSphere 5.1 documentation set.

VMware, Inc.

Chapter 2 Managing Hosts



Update ESXi 5.5 hosts with esxcli software vib commands discussed in the vSphere Upgrade
documentation included in the vSphere 5.5 documentation set.



Update ESXi 6.0 hosts with esxcli software vib commands discussed in the vSphere Upgrade
documentation included in the vSphere 6.0 documentation set.

VMware, Inc.

27

Getting Started with vSphere Command-Line Interfaces

28

VMware, Inc.

3

Managing Files

3

The vSphere CLI includes two commands for file manipulation. vmkfstools allows you to manipulate VMFS
(Virtual Machine File System) and virtual disks. vifs supports remote interaction with files on your ESXi host.
NOTE See “Managing Storage” on page 37 for information about storage manipulation commands.
This chapter includes the following topics:


“Introduction to Virtual Machine File Management” on page 27



“Managing the Virtual Machine File System with vmkfstools” on page 28



“Upgrading VMFS3 Volumes to VMFS5” on page 29



“Managing VMFS Volumes” on page 29



“Reclaiming Unused Storage Space” on page 31



“Using vifs to View and Manipulate Files on Remote ESXi Hosts” on page 32

Introduction to Virtual Machine File Management
You can use the vSphere Web Client or vCLI commands to access different types of storage devices that your
ESXi host discovers and to deploy datastores on those devices.
NOTE Datastores are logical containers, analogous to file systems, that hide specifics of each storage device
and provide a uniform model for storing virtual machine files. Datastores can be used for storing ISO images,
virtual machine templates, and floppy images. The vSphere Web Client uses the term datastore exclusively.
This manual uses the term datastore and VMFS (or NFS) volume to refer to the same logical container on the
physical device.
Depending on the type of storage you use, datastores can be backed by the following file system formats:


Virtual Machine File System (VMFS). High‐performance file system that is optimized for storing virtual
machines. Your host can deploy a VMFS datastore on any SCSI‐based local or networked storage device,
including Fibre Channel and iSCSI SAN equipment. As an alternative to using the VMFS datastore, your
virtual machine can have direct access to raw devices and use a mapping file (RDM) as a proxy.
You manage VMFS and RDMs with the vSphere Web Client, or the vmkfstools command.



Network File System (NFS). The NFS client built into ESXi uses the Network File System (NFS) protocol
over TCP/IP to access a designated NFS volume that is located on a NAS server. The ESXi host can mount
the volume and use it for its storage needs. vSphere supports version 3 and 4.1 of the NFS protocol.
Typically, the NFS volume or directory is created by a storage administrator and is exported form the NFS
server. The NFS volumes do not need to be formatted with a local file system, such as VMFS. You can
mount the volumes directly and use them to store and boot virtual machines in the same way that you use
VMFS datastores. The host can access a designated NFS volume located on an NFS server, mount the
volume, and use it for any storage needs.

VMware, Inc.

27

Getting Started with vSphere Command-Line Interfaces

You manage NAS storage devices from the vSphere Web Client or with the esxcli storage nfs
command. The diagram below illustrates different types of storage, but it is for conceptual purposes only.
It is not a recommended configuration.
Figure 3-1. Virtual Machines Accessing Different Types of Storage
Host
requires TCP/IP connectivity
virtual
machine

virtual
machine

virtual
machine

virtual
machine

virtual
machine

local
ethernet
SCSI
fibre
channel
HBA

VMFS

SAN

software
initiator

iSCSI
hardware
initiator

ethernet
NIC

LAN

ethernet
NIC

LAN

LAN

Key
physical
disk

datastore

virtual
disk

VMFS
fibre array

VMFS
iSCSI array

NFS
NAS appliance

Managing the Virtual Machine File System with vmkfstools
VMFS datastores primarily serve as repositories for virtual machines. You can store multiple virtual machines
on the same VMFS volume. Each virtual machine, encapsulated in a set of files, occupies a separate single
directory. For the operating system inside the virtual machine, VMFS preserves the internal file system
semantics.
In addition, you can use the VMFS datastores to store other files, such as virtual machine templates and ISO
images. VMFS supports file and block sizes that enable virtual machines to run data‐intensive applications,
including databases, ERP, and CRM, in virtual machines. See the vSphere Storage documentation.
You use the vmkfstools vCLI to create and manipulate virtual disks, file systems, logical volumes, and
physical storage devices on an ESXi host. You can use vmkfstools to create and manage a virtual machine file
system (VMFS) on a physical partition of a disk and to manipulate files, such as virtual disks, stored on
VMFS‐3 and NFS. You can also use vmkfstools to set up and manage raw device mappings (RDMs).
IMPORTANT The vmkfstools vCLI supports most but not all of the options that the vmkfstools ESXi Shell
command supports. See VMware Knowledge Base article 1008194.
You cannot run vmkfstools with --server pointing to a vCenter Server system.
The vSphere Storage documentation includes a complete reference to the vmkfstools command that you can
use in the ESXi Shell. You can use most of the same options with the vmkfstools vCLI command. Specify one
of the connection options listed in “Connection Options for vCLI Host Management Commands” on page 18
in place of .
The following options supported by the vmkfstools ESXi Shell command are not supported by the
vmkfstools vCLI command.






28

--breaklock -B
--chainConsistent -e
--eagerzero -k
--fix -x
--lock -L

VMware, Inc.

Chapter 3 Managing Files







--migratevirtualdisk -M
--parseimage -Y
--punchzero -K
--snapshotdisk -I
--verbose -v

Upgrading VMFS3 Volumes to VMFS5
vSphere 5.0 supports VMFS5 volumes, which have improved scalability and performance. You can upgrade
from VMFS3 to VMFS5 by using the vSphere Web Client, the vmkfstools ESXi Shell command, or the esxcli
storage vmfs upgrade command. Pass the volume label or the volume UUID to the ESXCLI command.
IMPORTANT You cannot upgrade VMFS3 volumes to VMFS5 with the vmkfstools command included in
vSphere CLI.

Managing VMFS Volumes
Different commands are available for listing, mounting, and unmounting VMFS volumes and for listing,
mounting, and unmounting VMFS snapshot volumes.


Managing VMFS volumes
esxcli storage filesystem list shows all volumes, mounted and unmounted, that are resolved,
that is, that are not snapshot volumes.
esxcli storage filesystem unmount unmounts a currently mounted filesystem. Use this command
for snapshot volumes or resolved volumes.



Managing snapshot volumes
esxcli storage vmfs snapshot commands can be used for listing, mounting, and resignaturing
snapshot volumes. See “Mounting Datastores with Existing Signatures” on page 29 and “Resignaturing
VMFS Copies” on page 30.

Managing Duplicate VMFS Datastores
Each VMFS datastore created in a LUN has a unique UUID that is stored in the file system superblock. When
the LUN is replicated or when a snapshot is made, the resulting LUN copy is identical, byte‐for‐byte, to the
original LUN. As a result, if the original LUN contains a VMFS datastore with UUID X, the LUN copy appears
to contain an identical VMFS datastore, or a VMFS datastore copy, with the same UUID X.
ESXi hosts can determine whether a LUN contains the VMFS datastore copy, and either mount the datastore
copy with its original UUID or change the UUID to resignature the datastore.
When a LUN contains a VMFS datastore copy, you can mount the datastore with the existing signature or
assign a new signature. The vSphere Storage documentation discusses volume resignaturing in detail.

Mounting Datastores with Existing Signatures
You can mount a VMFS datastore copy without changing its signature if the original is not mounted. For
example, you can maintain synchronized copies of virtual machines at a secondary site as part of a disaster
recovery plan. In the event of a disaster at the primary site, you can mount the datastore copy and power on
the virtual machines at the secondary site.
IMPORTANT You can mount a VMFS datastore only if it does not conflict with an already mounted VMFS
datastore that has the same UUID.
When you mount the VMFS datastore, ESXi allows both read and write operations to the datastore that resides
on the LUN copy. The LUN copy must be writable. The datastore mounts are persistent and valid across
system reboots.

VMware, Inc.

29

Getting Started with vSphere Command-Line Interfaces

You can mount a datastore with vicfg-volume (see “To mount a datastore with vicfg‐volume” on page 30) or
with ESXCLI (see “To mount a datastore with ESXCLI” on page 30).

Mounting and Unmounting with ESXCLI
The esxcli storage filesystem commands support mounting and unmounting volumes. You can also
specify whether to persist the mounted volumes across reboots by using the --no-persist option.
Use the esxcli storage filesystem command to list mounted volumes, mount new volumes, and
unmount a volume. Specify one of the connection options listed in “Connection Options for vCLI Host
Management Commands” on page 18 in place of .
To mount a datastore with ESXCLI
1

List all volumes that have been detected as snapshots.
esxcli  storage filesystem list

2

Run esxcli storage filesystem mount with the volume label or volume UUID.
By default, the volume is mounted persistently; use --no-persist to mount nonpersistently.
esxcli  storage filesystem volume mount
--volume-label=

Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.6
Linearized                      : Yes
Author                          : VMware Inc.
Create Date                     : 2015:10:23 16:14:17Z
Keywords                        : vSphere CLI, esxcli, vicfg- commands
Modify Date                     : 2015:10:23 17:56:57+03:00
Subject                         : Using vSphere CLI commands to manage vSphere
Language                        : en
XMP Toolkit                     : Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04
Creator Tool                    : FrameMaker 11.0
Metadata Date                   : 2015:10:23 17:56:57+03:00
Format                          : application/pdf
Description                     : Using vSphere CLI commands to manage vSphere
Title                           : vSphere Command-Line Interface Concepts and Examples
Creator                         : VMware Inc.
Producer                        : Acrobat Distiller 9.5.5 (Windows)
Document ID                     : uuid:dbb2c706-c2ec-4f09-9727-99997b1d9657
Instance ID                     : uuid:44896e03-41b0-4d37-a64d-c70a1881942d
Page Layout                     : SinglePage
Page Mode                       : UseOutlines
Page Count                      : 156
EXIF Metadata provided by EXIF.tools

Navigation menu