New-Datastore
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 (%).
Syntax
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
Name | String | 1 |
|
Specifies a name for the new datastore. |
required
|
NfsHost | String[] | named |
|
Specifies the NFS host where you want to create the new datastore. |
required
|
Path | String | named |
|
If 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. |
required
|
VMHost | VMHost | named |
|
Specifies a host where you want to create the new datastore. Passing multiple values to this parameter is obsolete. |
optional | FileSystemVersion | String | named |
|
Specifies the file system you want to use on the new datastore. |
optional | Kerberos | SwitchParameter | named |
|
By 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. |
optional | Nfs | SwitchParameter | named |
|
Indicates that you want to create an NFS datastore. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | ReadOnly | SwitchParameter | named |
|
Indicates that the access mode for the mount point is ReadOnly. The default access mode is ReadWrite. |
optional | Server | VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null 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. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
Name | String | 1 |
|
Specifies a name for the new datastore. |
required
|
Path | String | named |
|
If 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. |
required
|
VMHost | VMHost | named |
|
Specifies a host where you want to create the new datastore. Passing multiple values to this parameter is obsolete. |
optional | BlockSizeMB | Int32 | named |
|
Specifies 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. |
optional | FileSystemVersion | String | named |
|
Specifies the file system you want to use on the new datastore. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | Server | VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null 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. |
optional | Vmfs | SwitchParameter | named |
|
Indicates that you want to create a VMFS datastore. |
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
Name | String | 1 |
|
Specifies a name for the new datastore. |
required
|
VMHost | VMHost | named |
|
Specifies a host where you want to create the new datastore. Passing multiple values to this parameter is obsolete. |
required
|
VvolStorageContainer | StorageContainer | named |
|
Specifies the backing virtual volume (vVol) storage container to create the datastore. You can retrieve the storage container objects by using the Get-VvolStorageContainer cmdlet. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | Server | VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null 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. |
Output
VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.DatastoreExamples
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.
Example 4
New-Datastore -Name VvolDatastore -VMHost $vmHost -VvolStorageContainer $vvolContainer
Creates a virtual volume datastore.
Related Commands
Datastore
This cmdlet retrieves the datastores available on a vCenter Server system.
This cmdlet moves datastores from one location to another.
This cmdlet creates a new datastore.
This cmdlet removes the specified datastores from their locations.
This cmdlet modifies the properties of the specified datastore.
DatastoreCluster
This cmdlet retrieves datastore clusters.
This cmdlet creates a new datastore cluster.
This cmdlet deletes the specified datastore clusters.
This cmdlet modifies the configuration of the specified datastore cluster.
DatastoreItem
This cmdlet copies items between datastores and between a datastore and a local file system provider.