Loading

×Sorry to interrupt
CSS Error

Refresh

Cookie Preference Center

General Information on cookies

When you visit our website, we use cookies to ensure that we give you the best experience. This information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies by clicking on the different category headings to find out more and change your settings. However, blocking some types of cookies may impact your experience on the site and the services we are able to offer. Further information can be found in our

Cookie Policy.

Strictly Necessary

Strictly Necessary

Always Active

Strictly Necessary

Strictly necessary cookies are always enabled since they are essential for our website to function. They enable core functionality such as security, network management, and website accessibility. You can set your browser to block or alert you about these cookies, but this may affect how the website functions. For more information please visit www.aboutcookies.org or www.allaboutcookies.org.

Cookie Details‎

Performance

Performance

Performance

Performance cookies are used to analyze the user experience to improve our website by collecting and reporting information on how you use it. They allow us to know which pages are the most and least popular, see how visitors move around the site, optimize our website and make it easier to navigate.

Cookie Details‎

Please confirm your settings by refreshing the page.

Functional

Functional

Functional

Functional cookies help us keep track of your past browsing choices so we can improve usability and customize your experience. These cookies enable the website to remember your preferred settings, language preferences, location and other customizable elements such as font or text size. If you do not allow these cookies, then some or all of these services may not function properly.

Cookie Details‎

Advertising

Advertising

Advertising

Advertising cookies are used to send you relevant advertising and promotional information. They may be set through our site by third parties to build a profile of your interests and show you relevant advertisements on other sites. These cookies do not directly store personal information, but their function is based on uniquely identifying your browser and internet device.

Cookie Details‎

Advertising Cookies

Consent Leg.Interest

Select All Vendors

Select All Vendors

Select All Hosts

Select All

Clear Filters

Information storage and access

Apply

Confirm My Choices Reject All Allow All

My Subscriptions

Loading

Knowledge Base

Managing Storage using the Command Line Interface (CLI) in vSphere 4.x (1029301)

Last Updated: 3/20/2024Categories: How toTotal Views: 101405Language:
Chinese (Simplified)JapaneseEnglish

5 like this article

Subscribe to get an email
newsletter with new updates

5 people found this helpful Please provide article feedback:

Purpose

This articles provides information about configuring NFS, iSCSI, and VMFS volumes using:

ESX Console Operating System (COS)

vSphere PowerCLI 4.x

VMware vSphere CLI 4.x

Resolution

Mounting Network File System (NFS) Shares

COS

esxcfg-nas manages NAS mounts. Use this command to add, delete, list, and change the attributes of NAS devices. This example shows you how to add an NFS share:

# esxcfg-nas -a <datastore name> -o <nfs server hostname/ip> -s <mount point>

vSphere PowerCLI

Use the New-Datastore cmdlet to create a new datastore. Use -Nfs to create an NFS share and specify the NFS server and mount point using the -NfsHost and -Path parameters. For example:

[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> New-Datastore -VMHost 10.112.96.17 -Nfs -Name NFS-01 -NfsHost 10.112.101.9 -Path /NFS

Name FreeSpaceMB CapacityMB
---- ----------- ----------
NFS-01 135548 274944

vSphere CLI

Use the vicfg-nas.pl command to add an entry to the known NAS file system list and supplies the share name of the new NAS file system. You must supply the host name and the share name for the new NAS file system. For example:

vicfg-nas.pl --server 10.112.96.17 --add NFS-01 --nasserver 10.112.101.9 --share /NFS
Connecting to NAS volume: NFS
NFS created and connected.

Listing NAS/NFS Exports or Shares

COS

To list NAS/NFS Exports or Shares using the COS, run the command:

# esxcfg-nas –l

vSphere PowerCLI

To list NAS/NFS Exports or Shares using the vSphere PowerCLI, run the command:

[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> Get-Datastore | where {$_.type -eq "NFS"}

vSphere CLI

To list NAS/NFS Exports or Shares using the vSphere CLI, run the command:

C:\Program Files\VMware\VMware vSphere CLI\bin>vicfg-nas.pl -server 10.112.96.17 --list

Creating a VMFS Volume

You can use vmkfstools to create and manage a virtual machine file system (VMFS) and physical storage devices on an ESX/ESXi host:

COS

For detailed information on creating the VMFS volume from the ESX/ESXi console, see Manually creating a VMFS volume using vmkfstools -C (1009829).

vSphere PowerCLI

The New-Datastore cmdlet is used to create the VMFS datastore, specify the name of the datastore using the -Name parameter, and provide the NAA ID using the -Path parameter. For example:

[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> New-Datastore -Name vCloud-0 -Path naa.60060160582017005c0a006277b6df11 -Vmfs

Name: vCloud-0
Name FreeSpaceMB CapacityMB
---- ----------- ----------
vCloud-0 50425 50944

For more information, see Managing storage using PowerCLI (1028368).

vSphere CLI

To create a VMFS volume using the vSphere CLI, run the command:

C:\Program Files\VMware\VMware vSphere CLI\bin>vmkfstools.pl --server 10.112.96.17 -C vmfs3 -b 1m -S vCloud-0 /vmfs/devices/disks/naa.60060160582017005c0a006277b6df11:1

Creating vmfs3 file system on naa.60060160582017005c0a006277b6df11:1 with blockSize 1048576 and volume label vCloud-0

Successfully created new volume:4cb43e93-555bbef5-0f61-0024817ebebb

Configuring iSCSI Storage

VMware ESX/ESXi systems include software iSCSI capabilities for accessing remote storage using an IP network. This can be configured in the VMware vSphere Client, Console OS, vSphere CLI and PowerCLI.

COS

To configure a VMware ESX software iSCSI initiator:

To enable the iSCSI Initiator, run the command:

# esxcfg-swiscsi -e

To add iSCSI targets, run the command:

# vmkiscsi-tool -D -a 10.112.101.9:3260 vmhba32

Notes:

-D is used to set the mode of discovery and -a is used to add an iSCSI target.

The device identifier may differ between ESX host systems. For example, the software iSCSI initiator may be populated as vmhba33 or vmhba34.

To show details about the configured targets, run the command:

# vmkiscsi-tool -l -T vmhba37

To rescan the software iSCSI adapter, run the command:

# esxcfg-swiscsi -s

Scanning vmhba32...
Scanning vmhba33...

For configuring VMkernel ports for iSCSI, see Configuring a VMkernel port and enable VMotion via command line (1006989).

vSphere PowerCLI

To get a list of iSCSI HBAs, run the command:

[vSphere PowerCLI] C:\Program Files\VMware\Infrastructure\vSphere PowerCLI> Get-VMHost 10.112.96.17 | Get-VMHostHba -Type iScsi

For more information on creating a new datastore over iSCSI, see Work with Host Storages and iSCSI HBA Devices in the vSphere PowerCLI Administration Guide.

vSphere CLI

Use the vicfg-iscsi vCLI command to configure both hardware and software iSCSI storage for your ESX/ESXi system.

For detailed information on configuring iSCSI storage using the vSphere CLI, see iSCSI Storage Setup in the vSphere Command-Line Interface Installation and Scripting Guide.

Related Information

For information about managing storage using the CLI in vSphere 5.x, see Command-Line Management in vSphere 5 for Service Console Users in the vSphere documentation. vSphere 4.x でコマンド ライン インターフェイス (CLI) を使用してストレージを管理する
在 vSphere 4.x 中使用命令行界面 (CLI) 管理存储

Detectable by VMware SkylineTM

Actions

Copy

link to clipboard
copied!

Print

Language:
Chinese (Simplified)JapaneseEnglish

Attachments

Additional Resources

KB
•
End Of General Availability of the Free vSphere Hypervisor (ESXi 7.x and 8.x) (2107518)

KB
•
Download and Install VMware Fusion (2014097)

Results 1-2 of 2

Ask The Community

Get answers quickly from VMware experts in the community

Post Subject

CONTINUE IN COMMUNITIES

Related Products:

VMware vSphere PowerCLI

VMware vSphere ESXi

VMware vSphere CLI

VMware vSphere

VMware ESX Server

Related Versions:

VMware vSphere PowerCLI 4.1

VMware vSphere PowerCLI 4.0

VMware vSphere CLI 4.1

VMware vSphere CLI 4.0

VMware ESXi 4.1.x Installable

VMware ESXi 4.1.x Embedded

VMware ESXi 4.0.x Installable

VMware ESXi 4.0.x Embedded

VMware ESX 4.1.x

VMware ESX 4.0.x

view all

Take Our Survey

Support Assistant