VMware ESXI - 6.5 User Manual

0 (0)

vSphere Command-Line Interface

Concepts and Examples

ESXi 6.5

vCenter Server 6.5

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-002352-00

vSphere Command-Line Interface Concepts and Examples

You can find the most up-to-date technical documentation on the VMware Web site at: h p 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 © 2007–2017 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 13

 

 

Targets and Protocols for vCLI Host Management Commands

15

Supported Platforms for vCLI Commands

15

 

 

Commands with an esxcfg Prefix

16

 

 

 

ESXCLI Commands Available on Different ESXi Hosts

17

 

Trust Relationship Requirement for ESXCLI Commands

17

 

Download and Install the vCenter Server Certificate

17

 

Using the

cacertsfile Option

18

 

 

 

Using the --thumbprint Option

18

 

 

 

Use the Credential Store 18

 

 

 

 

Using ESXCLI Output 19

 

 

 

 

Connection Options for vCLI Host Management Commands

19

Connection Options for DCLI Commands

19

 

 

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 22

Entering and Exiting Maintenance Mode

22

 

 

Enter and Exit Maintenance Mode with ESXCLI 22

 

Enter and Exit Maintenance Mode with vicfg-hostops

23

Backing Up Configuration Information with vicfg-cfgbackup 24

Backup Tasks

24

 

 

 

 

 

Backing Up Configuration Data

24

 

 

 

Restore Configuration Data

24

 

 

 

 

Using vicfg-cfgbackup from vMA

25

 

 

 

Managing VMkernel Modules

25

 

 

 

 

Manage Modules with esxcli system module

25

 

Manage Modules with vicfg-module

26

 

 

Using vicfg authconfig for Active Directory Configuration

26

Prepare ESXi Hosts for Active Directory Integration 26

Set Up Active Directory to Work with ESXi

27

 

Updating Hosts

27

 

 

 

 

 

VMware, Inc.

3

vSphere Command-Line Interface Concepts and Examples

3 Managing Files 29

Introduction to Virtual Machine File Management 29 Managing the Virtual Machine File System with vmkfstools 30 Upgrading VMFS3 Volumes to VMFS5 31

Managing VMFS Volumes 31

Managing Duplicate VMFS Datastores 32

Mounting Datastores with Existing Signatures 32

Resignaturing VMFS Copies

33

Reclaiming Unused Storage Space

34

Using vifs to View and Manipulate Files on Remote ESXi Hosts 35

vifs Options

36

 

vifs Examples

37

 

4 Managing Storage

41

 

 

 

 

 

 

 

 

Introduction to Storage

42

 

 

 

 

 

 

 

How Virtual Machines Access Storage

 

42

 

 

Datastores

44

 

 

 

 

 

 

 

 

 

Storage Device Naming

44

 

 

 

 

 

 

Examining LUNs

45

 

 

 

 

 

 

 

 

Target and Device Representation

45

 

 

 

 

Examining LUNs with esxcli storage core 46

 

 

Examining LUNs with vicfg-scsidevs

47

 

 

Detach a Device and Remove a LUN

48

 

 

 

 

Rea ach a Device

49

 

 

 

 

 

 

 

 

Working with Permanent Device Loss

49

 

 

 

 

Removing a PDL LUN

49

 

 

 

 

 

 

Rea ach a PDL LUN

49

 

 

 

 

 

 

Managing Paths

50

 

 

 

 

 

 

 

 

Multipathing with Local Storage and FC SANs

50

Listing Path Information

51

 

 

 

 

 

 

Changing the State of a Path

53

 

 

 

 

 

Managing Path Policies

54

 

 

 

 

 

 

 

Multipathing Considerations

54

 

 

 

 

 

Changing Path Policies

55

 

 

 

 

 

 

Set Policy Details for Devices that Use Round Robin 56

Scheduling Queues for Virtual Machine I/O

57

 

 

Managing NFS/NAS Datastores

57

 

 

 

 

 

Capabilities Supported by NFS/NAS

57

 

 

Adding and Deleting NAS File Systems

58

 

 

Monitor and Manage FibreChannel SAN Storage

59

Monitoring and Managing Virtual SAN Storage

60

 

Retrieve Virtual SAN Information

60

 

 

 

 

Manage a Virtual SAN Cluster 60

 

 

 

 

 

Add and Remove Virtual SAN Storage

 

61

 

 

Monitoring vSphere Flash Read Cache

62

 

 

 

Monitoring and Managing Virtual Volumes

62

 

 

Migrating Virtual Machines with svmotion

63

 

 

Storage vMotion Uses 63

 

 

 

 

 

 

Storage vMotion Requirements and Limitations

63

4

VMware, Inc.

Contents

Running svmotion in Interactive Mode 64

Running svmotion in Noninteractive Mode 64

Configuring FCoE Adapters

65

Scanning Storage Adapters

66

 

Retrieving SMART Information

66

5 Managing iSCSI Storage

69

 

 

 

 

 

 

 

iSCSI Storage Overview

 

69

 

 

 

 

 

 

 

 

Discovery Sessions

70

 

 

 

 

 

 

 

 

Discovery Target Names 71

 

 

 

 

 

 

 

Protecting an iSCSI SAN

71

 

 

 

 

 

 

 

 

Protecting Transmi

ed Data

71

 

 

 

 

 

 

Securing iSCSI Ports

 

72

 

 

 

 

 

 

 

 

Se ing iSCSI CHAP

72

 

 

 

 

 

 

 

 

Command Syntax for esxcli iscsi and vicfg-iscsi

73

 

 

 

esxcli iscsi Command Syntax

74

 

 

 

 

 

 

Key to esxcli iscsi Short Options

74

 

 

 

 

 

vicfg-iscsi Command Syntax

75

 

 

 

 

 

 

iSCSI Storage Setup with ESXCLI

78

 

 

 

 

 

Set Up Software iSCSI with ESXCLI

78

 

 

 

 

Set Up Dependent Hardware iSCSI with ESXCLI

80

 

 

Set Up Independent Hardware iSCSI with ESXCLI

82

 

iSCSI Storage Setup with vicfg-iscsi

84

 

 

 

 

 

Set Up Software iSCSI with vicfg-iscsi

85

 

 

 

 

Set Up Dependent Hardware iSCSI with vicfg-iscsi

86

 

Set Up Independent Hardware iSCSI with vicfg-iscsi

87

 

Listing and Se ing iSCSI Options

89

 

 

 

 

 

Listing iSCSI Options with ESXCLI 89

 

 

 

 

Se ing MTU with ESXCLI

89

 

 

 

 

 

 

Listing and Se ing iSCSI Options with vicfg-iscsi

89

 

 

Listing and Se ing iSCSI Parameters

90

 

 

 

 

 

Listing and Se ing iSCSI Parameters with ESXCLI

90

 

Returning Parameters to Default Inheritance with ESXCLI

92

Listing and Se ing iSCSI Parameters with vicfg-iscsi

92

 

Returning Parameters to Default Inheritance with vicfg-iscsi

94

Enabling iSCSI Authentication

94

 

 

 

 

 

 

Enable iSCSI Authentication with ESXCLI

94

 

 

 

Enable Mutual iSCSI Authentication with ESXCLI

95

 

 

Enable iSCSI Authentication with vicfg-iscsi

96

 

 

 

Set Up Ports for iSCSI Multipathing

97

 

 

 

 

 

Managing iSCSI Sessions

98

 

 

 

 

 

 

 

 

Introduction to iSCSI Session Management

98

 

 

 

Listing iSCSI Sessions

98

 

 

 

 

 

 

 

 

Logging in to iSCSI Sessions

99

 

 

 

 

 

 

Removing iSCSI Sessions

99

 

 

 

 

 

 

 

VMware, Inc.

5

vSphere Command-Line Interface Concepts and Examples

6 Managing Third-Party Storage Arrays

101

Managing NMP with esxcli storage nmp 101

 

Device Management with esxcli storage nmp device 102

Listing Paths with esxcli storage nmp path

102

Managing Path Selection Policy Plug-Ins with esxcli storage nmp psp 103

Fixed Path Selection Policy Operations

104

 

Customizing Round Robin Setup

105

 

 

Managing SATPs 106

 

 

 

Path Claiming with esxcli storage core claiming

108

Using the Reclaim Troubleshooting Command 109

Unclaiming Paths or Sets of Paths

109

 

 

Managing Claim Rules

110

 

 

 

Change the Current Claim Rules in the VMkernel 110

Adding Claim Rules

111

 

 

 

Removing Claim Rules 112

 

 

 

Listing Claim Rules

113

 

 

 

Loading Claim Rules

113

 

 

 

Moving Claim Rules

113

 

 

 

Load and Apply Path Claim Rules

114

 

 

Running Path Claim Rules 114

 

 

 

7 Managing Users 117

 

Users in the vSphere Environment

117

vicfg-user Command Syntax 118

 

Managing Users with vicfg-user 118

Assigning Permissions with ESXCLI

120

8 Managing Virtual Machines

123

 

 

vmware-cmd Overview 123

 

 

 

Connection Options for vmware-cmd

124

General Options for vmware-cmd

124

 

Format for Specifying Virtual Machines

124

List and Register Virtual Machines 125

 

Retrieving Virtual Machine

ributes

125

Managing Virtual Machine Snapshots with vmware-cmd 127

Take a Virtual Machine Snapshot 127

 

Reverting and Removing Snapshots

128

 

Powering Virtual Machines On and Off

128

 

Connecting and Disconnecting Virtual Devices

129

Working with the AnswerVM API 130

 

 

Forcibly Stop a Virtual Machine with ESXCLI

130

9 Managing vSphere Networking

131

Introduction to vSphere Networking 131

Networking Using vSphere Standard Switches 132

Networking Using vSphere Distributed Switches 133

Retrieving Basic Networking Information 134

Troubleshoot a Networking Setup

134

6

VMware, Inc.

Contents

Se

ing Up vSphere Networking with vSphere Standard Switches

136

 

Se

ing Up Virtual Switches and Associating a Switch with a Network Interface 136

 

Retrieving Information About Virtual Switches

137

 

 

Adding and Deleting Virtual Switches

138

 

 

 

Checking, Adding, and Removing Port Groups

139

 

 

Managing Uplinks and Port Groups

140

 

 

 

Se

ing the Port Group VLAN ID

141

 

 

 

Managing Uplink Adapters

142

 

 

 

 

 

Adding and Modifying VMkernel Network Interfaces 145

 

Se

ing Up vSphere Networking with vSphere Distributed Switch

148

Managing Standard Networking Services in the vSphere Environment 149

Se

ing the DNS Configuration

149

 

 

 

 

 

Se

ing the DNS Configuration with ESXCLI 149

 

 

Se

ing the DNS Configuration with vicfg-dns

151

 

Manage an NTP Server 152

 

 

 

 

 

Manage the IP Gateway

152

 

 

 

 

 

Se

ing Up IPsec

153

 

 

 

 

 

 

 

Using IPsec with ESXi

154

 

 

 

 

 

 

Managing Security Associations

155

 

 

 

 

Managing Security Policies

156

 

 

 

 

Manage the ESXi Firewall

157

 

 

 

 

 

Monitor VXLAN

158

 

 

 

 

 

 

10 Monitoring ESXi Hosts

161

 

 

 

Using resxtop for Performance Monitoring

161

 

Managing Diagnostic Partitions

161

 

 

Managing Core Dumps

162

 

 

 

Manage Local Core Dumps with ESXCLI

162

Manage Core Dumps with ESXi Dump Collector 163

Manage Core Dumps with vicfg-dumppart

164

Configuring ESXi Syslog Services

164

 

 

Managing ESXi SNMP Agents 166

 

 

Configuring SNMP Communities 166

 

 

Configuring the SNMP Agent to Send Traps

166

Configuring the SNMP Agent for Polling

168

Retrieving Hardware Information

169

 

 

Index 171

VMware, Inc.

7

vSphere Command-Line Interface Concepts and Examples

8

VMware, Inc.

About This Book

vSphere Command-Line Interface Concepts and Examples 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.

VMware Technical Publications Glossary

VMware Technical Publications provides a glossary of terms that might be unfamiliar to you. For definitions of terms as they are used in VMware technical documentation, go to

h p www vmware com support pubs.

Related Documentation

The documentation for vCLI is available in the vSphere Documentation Center and on the vCLI documentation page. Go to h p www vmware com support developer vcli.

nn Started with vSphere Command-Line Interfaces includes information about available CLIs, enabling the ESXi Shell, as well as installing and running vCLI and DCLI commands.

nvSphere Command-Line Interface Reference is a reference to both ESXCLI commands and vicfg- commands. The vicfg- command help is generated from the POD available for each command, run pod2html for any vicfg- command to generate individual HTML files interactively. The ESXCLI reference information is generated from the ESXCLI help.

nDCLI Reference is a reference to DCLI commands for managing vCenter services.

The documentation for PowerCLI is available in the vSphere Documentation Center and on the PowerCLI documentation page.

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 vSphere Management Assistant Guide explains how to install and use the vSphere Management Assistant (vMA). vMA is a virtual machine that includes vCLI and other prepackaged software.

Background information for the tasks discussed in this book is available in the vSphere documentation set. The vSphere documentation consists of the combined VMware vCenter Server and ESXi documentation.

VMware, Inc.

9

vSphere Command-Line Interface Concepts and Examples

10

VMware, Inc.

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:

n“Introduction,” on page 11

n“List of Available Host Management Commands,” on page 13

n“Targets and Protocols for vCLI Host Management Commands,” on page 15

n“Supported Platforms for vCLI Commands,” on page 15

n“Commands with an esxcfg Prefix ” on page 16

n“ESXCLI Commands Available on Different ESXi Hosts,” on page 17

n“Trust Relationship Requirement for ESXCLI Commands,” on page 17

n“Using ESXCLI Output,” on page 19

n“Connection Options for vCLI Host Management Commands,” on page 19

n“Connection Options for DCLI Commands,” on page 19

n“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.

The following table lists the 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 PowerCLI prompt by using the Get-EsxCli

 

cmdlet.

 

 

vicfgcommands

Set of commands for many aspects of host management Eventually, these commands will be

 

replaced by ESXCLI commands.

 

A set of esxcfgcommands that precisely mirrors the vicfgcommands is also included in

 

the vCLI package.

 

 

VMware, Inc.

11

vSphere Command-Line Interface Concepts and Examples

vCLI Commands

Description

Other commands (vmware-cmd, vifs, vmkfstools)

Commands implemented in Perl that do not have a vicfgprefix 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 vSphere Automation SDK interface for managing VMware SDDC

 

services. A DCLI command talks to a vSphere Automation API endpoint to locate relevant

 

information, and then executes the command and displays result to the user.

You can install the vSphere CLI command set on a supported Linux or Windows system. See n 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.

nManage 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 19.

nManage vCenter services with DCLI commands by specifying a target vCenter Server system and

authentication options. See

n Started with vSphere Command-Line Interfaces for a list of connection

options.

 

Documentation

You can find information about different aspects of vCLI in separate publications.

n Started with vSphere Command-Line Interfaces includes information about available CLIs, enabling the ESXi Shell, and installing and running vCLI commands.

Reference information for vCLI and DCLI commands is available on the vCLI documentation page

h p www vmware com support developer vcli and in the vSphere Documentation Center for the product version that you are using.

nvSphere 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.

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

nThe 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

Available Command-Line Help

vicfgcommands

Run <vicfg-cmd> --help for an overview of each options.

Run Pod2Html with a vicfgcommand 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

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

commands

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.

 

 

12

VMware, Inc.

Chapter 1 vSphere CLI Command Overviews

List of Available Host Management Commands

vCLI host management commands from earlier versions have been replaced with commands that have equivalent functionality.

The following table 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 the DCLI command set that is being added in vSphere 6.0 and later is different from these commands. They are not included in the table.

vCLI 4.1

vCLI 5.1 and later

 

Command

Command

Comment

 

 

 

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 vicfgcommand is now performed with ESXCLI.

 

 

 

resxtop

resxtop (No ESXCLI

Monitors in real time how ESXi hosts use resources. Runs in

 

equivalent)

interactive or batch mode.

 

Supported only on Linux.

See “Using resxtop for Performance Monitoring,” on page 161.

 

 

See the vSphere Resource Management documentation for a detailed

 

 

reference.

 

 

 

svmotion

svmotion (No ESXCLI

Moves a virtual machine’s configuration file and, optionally, its

 

equivalent)

disks, while the virtual machine is running.

 

Must run against a

See “Migrating Virtual Machines with svmotion,” on page 63.

 

vCenter Server system.

 

 

 

 

vicfg-advcfg

esxcli system settings

Performs advanced configuration

 

advanced

The advanced se ings 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

Remotely configures Active Directory se ings for an ESXi host.

 

ESXCLI equivalent)

See “Using vicfg authconfig for Active Directory Configuration ”

 

 

on page 26.

 

 

 

vicfg-cfgbackup

vicfg-cfgbackup (No

Backs up the configuration data of an ESXi system and restores

 

ESXCLI equivalent)

previously saved configuration data.

 

Cannot run against a

See “Backing Up Configuration Information with vicfg-

 

vCenter Server system.

cfgbackup,” on page 24.

 

 

 

vicfg-dns

esxcli network ip dns

Specifies an ESXi host’s DNS (Domain Name Server)

 

 

configuration

 

 

See “Se ing the DNS Configuration ” on page 149.

 

 

 

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.

 

 

See “Managing Diagnostic Partitions,” on page 161.

 

 

 

vicfg-hostops

esxcli system

Manages hosts.

 

maintenancemode

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

 

esxcli system shutdown

“Entering and Exiting Maintenance Mode,” on page 22.

 

 

 

vicfg-ipsec

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.

 

 

See “Se ing Up IPsec,” on page 153.

 

 

 

vicfg-iscsi

esxcli iscsi

Manages hardware and software iSCSI storage.

 

 

See Chapter 5, “Managing iSCSI Storage,” on page 69.

 

 

 

VMware, Inc.

13

vSphere Command-Line Interface Concepts and Examples

vCLI 4.1

vCLI 5.1 and later

 

Command

Command

Comment

 

 

 

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 25.

 

 

 

vicfg-mpath

esxcli storage core

Configures storage arrays.

vicfg-mpath35

path

See “Managing Paths,” on page 50.

 

 

 

vicfg-nas

esxcli storage nfs

Manages NAS/NFS filesystems

 

 

See “Managing NFS/NAS Datastores,” on page 57.

 

 

 

vicfg-nics

esxcli network nic

Manages the ESXi host's uplink adapters.

 

 

See “Managing Uplink Adapters,” on page 142.

 

 

 

vicfg-ntp

vicfg-ntp (No ESXCLI

Defines the NTP (Network Time Protocol) server.

 

equivalent)

See “Manage an NTP Server,” on page 152.

 

 

 

vicfg-rescan

esxcli storage core

Rescans the storage configuration

 

adapter rescan

See “Scanning Storage Adapters,” on page 66.

 

 

 

vicfg-route

esxcli network ip route

Manages the ESXi host's route entry.

 

 

See “Manage the IP Gateway,” on page 152.

 

 

 

vicfg-scsidevs

esxcli storage core

Finds and examines available LUNs.

 

device

See “Examining LUNs,” on page 45.

 

 

 

vicfg-snmp

esxcli system snmp

Manages the SNMP agent. See “Managing ESXi SNMP Agents,”

 

 

on page 166. 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 se ings for ESXi hosts including local storage

 

 

policies and server and port information for network logging. See

 

 

“Configuring ESXi Syslog Services,” on page 164.

 

 

The vCenter Server and Host Management documentation explains

 

 

how to set up system logs using the vSphere Web Client.

 

 

 

vicfg-user

vicfg-user (No ESXCLI

Creates, modifies deletes, and lists local direct access users and

 

equivalent)

groups of users. See Chapter 7, “Managing Users,” on page 117.

 

 

The vSphere Security documentation discusses security

 

 

implications of user management and custom roles.

 

 

 

vicfg-vmknic

esxcli network ip

Adds, deletes, and modifies VMkernel network interfaces.

 

interface

See “Adding and Modifying VMkernel Network Interfaces,” on

 

 

page 145.

 

 

 

vicfg-volume

esxcli storage

Supports resignaturing the copy of a VMFS volume, and

 

filesystem

mounting and unmounting the copy.

 

 

See “Managing Duplicate VMFS Datastores,” on page 32.

 

 

 

vicfg-vswitch

esxcli network vswitch

Adds or removes virtual switches or modifies virtual switch

 

 

se ings

 

 

See “Se ing Up Virtual Switches and Associating a Switch with a

 

 

Network Interface,” on page 136.

 

 

 

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 30.

 

 

 

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 25.

 

 

 

14

VMware, Inc.

 

 

Chapter 1 vSphere CLI Command Overviews

 

 

 

vCLI 4.1

vCLI 5.1 and later

 

Command

Command

Comment

 

 

 

vmkfstools

vmkfstools (No ESXCLI

Creates and manipulates virtual disks, file systems, logical

 

equivalent)

volumes, and physical storage devices on an ESXi host.

 

 

See “Managing the Virtual Machine File System with vmkfstools,”

 

 

on page 30.

 

 

 

vmware-cmd

vmware-cmd (No ESXCLI

Performs virtual machine operations remotely. This includes, for

 

equivalent)

example, creating a snapshot, powering the virtual machine on or

 

 

off and ge ing information about the virtual machine.

 

 

See Chapter 8, “Managing Virtual Machines,” on page 123.

 

 

 

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.

nvifs

nvicfg-user

nvicfg-cfgbackup

nvihostupdate

nvmkfstools

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

Supported Platforms for vCLI Commands

Platform support for vCLI commands differs depending on the vCenter Server and ESXi version. 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.

The following table lists platform support for the different vCLI commands.

 

 

vCenter Server 5.x

 

 

vCenter Server

Command

ESXi 5.x and 6.x

and 6.x

ESXi 4.x

ESX 4.x

4.x

 

 

 

 

 

 

DCLI

No

No

No

No

No

 

 

 

 

 

 

esxcli

Yes

Yes

Yes

Yes

No

 

 

 

 

 

 

resxtop

Yes (from Linux)

Yes (from Linux)

Yes (from

Yes (from

Yes (from Linux)

 

 

 

Linux)

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

 

 

 

 

 

 

VMware, Inc.

15

vSphere Command-Line Interface Concepts and Examples

 

 

vCenter Server 5.x

 

 

vCenter Server

Command

ESXi 5.x and 6.x

and 6.x

ESXi 4.x

ESX 4.x

4.x

 

 

 

 

 

 

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

Use esxcli

Yes

Yes

No

 

software vib

software vib

 

 

 

 

instead.

instead.

 

 

 

 

 

 

 

 

 

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

 

 

 

 

 

 

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

Impo t nt You should 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.

The Following table lists all vCLI vicfg- commands for which a vCLI command with an esxcfg prefix is available.

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

 

 

16

VMware, Inc.

Chapter 1 vSphere CLI Command Overviews

Command with vicfg Prefix

Command with esxcfg Prefix

 

 

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 Commands Available on Different ESXi Hosts

The available ESXCLI commands depend on the ESXi host version.

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.x hosts, ESXCLI 6.x 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 <target> --help for a list of namespaces supported on the target. You can drill down into the namespaces for additional help.

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.

Download and Install the vCenter Server Certificate

You can download the vCenter Server root certificate by using a Web browser and add it to the trusted certificates on the machine where you plan to run ESXCLI commands.

Procedure

1Enter the URL of the vCenter Server system or vCenter Server Appliance into a Web browser.

2 Click the Download trusted root rt

t s link.

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

4Extract the ZIP file

A certificates folder is extracted. 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

VMware, Inc.

17

vSphere Command-Line Interface Concepts and Examples

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

What to do next

You can now run ESXCLI commands against any host that is managed by the trusted vCenter Server system without supplying additional information if you specify the vCenter Server system 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 ESXi host or vCenter Server system in the --thumbprint parameter or the VI_THUMBPRINT variable.

When you run a command, ESXCLI first checks whether a certificate file is available. If not, ESXCLI checks whether a thumbprint of the target server is available. If not, you receive an error of the following type.

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

Use the Credential Store

Your vCLI installation includes a credential store. You can establish trust for a user with the 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.

Impo t nt 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.

Procedure

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

2Add the thumbprint for the target ESXi host. This thumbprint was returned in the error when you a empted to connect to the host.

credstore_admin.pl add --server <esxi_HOSTNAME_OR_IP> --thumbprint <thumbprint>

3If you are using a non-default credential store file you must pass it in with the --credstore option. If you do not use the --credstore option, the host becomes accessible without authentication.

18

VMware, Inc.

Chapter 1 vSphere CLI Command Overviews

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. The following example lists all file system information in CSV format.

esxcli --formatter=csv storage filesystem list

You can pipe the output to a file

esxcli --formatter=keyvalue storage filesystem list > myfilesystemlist.txt

Impo t nt You should always use a forma er 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.

Impo t nt

For connections to ESXi hosts version 6.0 or later, 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

n 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 vSphere Automation SDK interface for managing VMware SDDC services. A DCLI command talks to a vSphere Automation SDK endpoint to get the vSphere Automation SDK command information, executes the command, and displays result to the user.

You can run DCLI commands locally or from an administration server.

nRun DCLI on the Linux shell of a vCenter Server Appliance.

nInstall vCLI on a supported Windows or Linux system and target a vCenter Server Windows installation or a vCenter Server 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

n Started with vSphere Command-Line Interfaces documentation for a complete list and examples.

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 Documentation Center for a detailed discussion of normal lockdown mode and strict lockdown mode, and of how to enable and disable them.

VMware, Inc.

19

vSphere Command-Line Interface Concepts and Examples

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 --vihost parameters.

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.

nvifs

nvicfg-user

nvicfg-cfgbackup

nvihostupdate

nvmkfstools

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.

20

VMware, Inc.

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.

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.

This chapter includes the following topics:

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

n“Entering and Exiting Maintenance Mode,” on page 22

n“Backing Up Configuration Information with vicfg-cfgbackup,” on page 24

n“Managing VMkernel Modules,” on page 25

n“Using vicfg authconfig for Active Directory Configuration ” on page 26

n“Updating Hosts,” on page 27

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 by using the vSphere Web Client or vCLI commands, such as ESXCLI or vicfg-hostops.

Shu ing 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 19 in place of

<conn_options>.

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 reboot. A --delay option allows you to specify a delay interval, in seconds.

VMware, Inc.

21

vSphere Command-Line Interface Concepts and Examples

Stopping, Rebooting, and Examining Hosts with vicfg-hostops

You can shut down or reboot an ESXi host by using the vSphere Web Client, or ESXCLI or the vicfg-hostops vCLI command.

Shu ing 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 19 in place of

<conn_options>.

nSingle host - Run vicfg-hostops with --operation shutdown.

n If the host is in maintenance mode, run the command without the --force option.

vicfg-hostops <conn_options> --operation shutdown

nIf the host is not in maintenance mode, use --force to shut down the host and all running virtual machines.

vicfg-hostops <conn_options> --operation shutdown --force

nAll hosts in data center or cluster - To shut down all hosts in a cluster or data center, specify --cluster or --datacenter.

vicfg-hostops <conn_options> --operation shutdown --cluster <my_cluster>

vicfg-hostops <conn_options> --operation shutdown --datacenter <my_datacenter>

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

nSingle host - Run vicfg-hostops with --operation reboot.

n If the host is in maintenance mode, run the command without the --force option.

vicfg-hostops <conn_options> --operation reboot

nIf the host is not in maintenance mode, use --force to shut down the host and all running virtual machines.

vicfg-hostops <conn_options> --operation reboot --force

nAll hosts in data center or cluster - You can specify --cluster or --datacenter to reboot all hosts in a cluster or data center.

vicfg-hostops <conn_options> --operation reboot --cluster <my_cluster>

vicfg-hostops <conn_options> --operation reboot --datacenter <my_datacenter>

You can display information about a host by running vicfg-hostops with --operation info. vicfg-hostops <conn_options> --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.

Enter and Exit 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.

22

VMware, Inc.

Chapter 2 Managing Hosts

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 19 in place of <conn_options>.

Procedure

1To enter maintenance mode, run the following command.

esxcli <conn_options> system maintenanceMode set --enable true

After all virtual machines on the host have been suspended or migrated, the host enters maintenance mode.

Not You cannot deploy or power on a virtual machine on hosts in maintenance mode.

2To exit maintenance mode, run the following command.

esxcli <conn_options> system maintenanceMode set --enable false

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

Enter and Exit 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 vicfghostops --action poweroff.

Not 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 19 in place of <conn_options>.

Procedure

1To enter maintenance mode, run the following command. vicfg-hostops <conn_options> --operation enter

2To check whether the host is in maintenance mode or in the Entering Maintenance Mode state, run the following command.

vicfg-hostops <conn_options> --operation info

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.

What to do next

You can put all hosts in a cluster or data center in maintenance mode by using the --cluster or -- datacenter option. You must not use those options unless suspending all virtual machines in that cluster or data center is no problem.

You can later run vicfg-hostops <conn_options> --operation exit to exit maintenance mode.

VMware, Inc.

23

vSphere Command-Line Interface Concepts and Examples

Backing Up Configuration Information with vicfg-cfgbackup

After you configure an ESXi host, you can back up the host configuration data. You should always back up your host configuration after you change the configuration or upgrade the ESXi image.

Impo t nt 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.

2Run the Recovery CD or repair operation.

3Restore 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.

Backing Up Configuration Data

You can back up configuration data by running vicfg-cfgbackup with the -s option. The following example backs up configuration data in a temporary location.

vicfg-cfgbackup <conn_options> -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/<datastore> directory on the host, which is separate from the ESXi image and configuration files

Restore 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.

When you run the vicfg-cfgbackup vCLI command, you can specify one of the options listed in “Connection Options for vCLI Host Management Commands,” on page 19 in place of <conn_options>.

Procedure

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

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

3Run vicfg-cfgbackup with the -l flag to load the host configuration from the specified backup file n If you run the following command, you are prompted for confirmation

vicfg-cfgbackup <conn_options> -l /tmp/ESXi_181842_backup.tgz

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

24

VMware, Inc.

Chapter 2 Managing Hosts

4(Optional) To restore the host to factory se ings run vicfg-cfgbackup with the -r option. vicfg-cfgbackup <conn_options> -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 host that you are backing up or restoring, also referred to as the target host, 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.

nTo back up one of the host’s configuration 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.

nTo 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.

nTo 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 se ing and retrieving VMkernel module options.

The vicfg-module and esxcli system module commands are implementations of the deprecated esxcfgmodule 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.

Manage Modules with esxcli system module

Not all VMkernel modules have se able 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 19 in

place of <conn_options>.

Procedure

1List information about the module.

esxcli <conn_options> 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 <conn_options> system module list --enabled=true esxcli <conn_options> system module list --loaded=true

3Enable the model.

esxcli <conn_options> system module set --module=module_name --enabled=true

VMware, Inc.

25

vSphere Command-Line Interface Concepts and Examples

4Set the parameter.

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

5Verify that the module is configured

esxcli <conn_options> system module parameters list --module=module_name

Manage Modules with vicfg-module

Not all VMkernel modules have se able 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 19 in

place of <conn_options>.

Procedure

1

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

 

vicfg-module

<conn_options> --list

2

Run vicfg-module --set-options with connection options, the option string to be passed to a module,

 

and the module name.

 

vicfg-module

<conn_options> --set-options '<parameter_name>=<value>' <module_name>

3(Optional) To retrieve the option string that is configured to be passed to a module when the module is loaded, run vicfg-module --get-options.

Not This string is not necessarily the option string currently in use by the module.

vicfg-module <conn_options> --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 se ings with the vSphere Web Client, as discussed in the vCenter Server and Host Management documentation, or use vicfg-autconfig.

vicfg-authconfig allows you to remotely configure Active Directory se ings on ESXi hosts. You can list supported and active authentication mechanisms, list the current domain, and join or part from an Active Directory domain.

Prepare ESXi Hosts for Active Directory Integration

Before you run the vicfg-authconfig command on an ESXi host, you must prepare the host.

Procedure

1Configure ESXi and Active Directory to use same NTP server.

Impo t nt All hosts that join Active Directory must also be managed by an NTP server to avoid issues with clock skews and Kerberos tickets. You must make sure the ESXi system and the Active Directory server are using the same time zone.

The ESXi system’s time zone is always set to UTC.

26

VMware, Inc.

Chapter 2 Managing Hosts

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

Set Up Active Directory to Work with ESXi

You can run vicfg-authconfig to add the ESXi host to the Active Directory domain. You can run the command directly against the host or against a vCenter Server system, specifying the host with --vihost.

Prerequisites

nVerify that you have installed the ESXi host, as explained in the vSphere Installation and Setup documentation.

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

nVerify that you have the appropriate Active Directory permissions and administrative privileges on the ESXi host.

nVerify that time between the ESXi system and Windows Active Directory is synchronized.

Procedure

1Test that the Windows Active Directory Server can ping the ESXi host by using the host name.

ping <ESX_hostname>

2Run vicfg-authconfig to add the host to the Active Directory domain.

vicfg-authconfig --server=<ESXi Server IP Address> --username=<ESXi Server Admin Username> --password=<ESXi Server Admin User's Password> --authscheme AD --joindomain <AD Domain Name> --adusername=<Active Directory Administrator User Name>

--adpassword=<Active Directory Administrator User's Password>

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.

3 Check that a Successfully Joined <Domain Name> message appears.

4Verify the ESXi host is in the intended Windows Active Directory 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.

nUpdate 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.

nUpdate 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.

nUpdate 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.

nUpdate 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.

27

vSphere Command-Line Interface Concepts and Examples

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

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

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

28

VMware, Inc.

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.

Not See Chapter 4, “Managing Storage,” on page 41 for information about storage manipulation commands.

This chapter includes the following topics:

n“Introduction to Virtual Machine File Management,” on page 29

n“Managing the Virtual Machine File System with vmkfstools,” on page 30

n“Upgrading VMFS3 Volumes to VMFS5,” on page 31

n“Managing VMFS Volumes,” on page 31

n“Reclaiming Unused Storage Space,” on page 34

n“Using vifs to View and Manipulate Files on Remote ESXi Hosts,” on page 35

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.

Not 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. In vCLI, the term datastore, as well as VMFS or NFS volume, refer to the same logical container on the physical device.

Depending on the type of storage you use, datastores can be backed by the VMFS and NFS file system formats.

nVirtual 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.

VMware, Inc.

29

VMware ESXI - 6.5 User Manual

vSphere Command-Line Interface Concepts and Examples

nNetwork File System (NFS) - The NFS client built into ESXi uses the 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 versions 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 forma ed 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.

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

local ethernet

SCSI

 

 

 

 

 

software

 

 

 

 

 

 

 

initiator

 

 

 

fibre

 

iSCSI

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

channel

 

hardware

 

ethernet

 

ethernet

VMFS

HBA

 

initiator

 

NIC

 

NIC

 

 

 

 

 

 

 

LAN

 

LAN

 

LAN

 

LAN

 

 

 

 

 

 

 

VMFS

VMFS

VMFS

NFS

fibre

iSCSI array

NAS

array

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.

30

VMware, Inc.

Loading...
+ 144 hidden pages