PowerCLI Reference

New-Datastore

Synopsis

This cmdlet creates a new datastore.

Syntax

New-Datastore [-Server <VIServer[]>] [-VMHost] <VMHost> [-Name] <String> -Path <String> [-Nfs] -NfsHost <String[]> [-ReadOnly] [-Kerberos] [-FileSystemVersion <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

New-Datastore [-Server <VIServer[]>] [-VMHost] <VMHost> [-Name] <String> -Path <String> [-Vmfs] [-BlockSizeMB <Int32>] [-FileSystemVersion <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Get-Datastore
Remove-Datastore
Set-Datastore
Move-Datastore

Detailed Description

This cmdlet creates a new datastore based on the provided parameters. The following characters cannot be used in a datastore name: slash (/), backslash (\), and percent (%).

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
VMHostVMHostSpecifies a host where you want to create the new datastore. Passing multiple values to this parameter is obsolete.truetrue (ByValue)
NameStringSpecifies a name for the new datastore.truefalse
BlockSizeMBInt32Specifies the maximum file size of VMFS in megabytes (MB). If no value is given, the maximum file size for the current system platform is used.falsefalse
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falsefalse
FileSystemVersionStringSpecifies the file system you want to use on the new datastore.falsefalse
KerberosSwitchParameterBy default, NFS datastores are created with AUTH_SYS as the authentication protocol. This parameter indicates that the NFS datastore uses Kerberos version 5 for authentication. This parameter is available only for NFS version 4.1 datastores.falsefalse
NfsSwitchParameterIndicates that you want to create an NFS datastore.falsefalse
NfsHostString[]Specifies the NFS host where you want to create the new datastore.truefalse
PathStringIf you want to create an NFS datastore, specify the remote path of the NFS mount point.
If you want to create a VMFS datastore, specify the canonical name of the SCSI logical unit that will contain new VMFS datastores.
truefalse
ReadOnlySwitchParameterIndicates that the access mode for the mount point is ReadOnly. The default access mode is ReadWrite.falsefalse
ServerVIServer[]Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
VmfsSwitchParameterIndicates that you want to create a VMFS datastore.falsefalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

The one or more newly created Datastore objects

Notes

Examples

-------------- Example 1 --------------

New-Datastore -VMHost $vmhost -Name Datastore -Path $scsiLun.CanonicalName -Vmfs -FileSystemVersion 3

Creates a VMFS datastore by specifying the file system type.

-------------- Example 2 --------------

New-Datastore -Nfs -VMHost 10.23.112.60 -Name NFSDatastore -Path /mynfs -NfsHost 10.23.84.73

Creates a NFS datastore.

-------------- Example 3 --------------

$vmhost1, $vmhost2 | New-Datastore -Nfs -Name NFS1 -Path "/mnt/nfs1/nfs11/test1" -NfsHost 10.23.113.55 -ReadOnly

Creates a read-only NFS datastore across multiple virtual machine hosts.


Copyright © VMware, Inc. All rights reserved.