Syntax
New-Datastore [-VMHost] <VMHost> [-Name] <String> [-BlockSizeMB <Int32>] [-FileSystemVersion <String>] -Path <String> [-Server <VIServer[]>] [-Vmfs] [-Confirm] [-WhatIf] [<CommonParameters>]Related Commands
Online VersionDetailed 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
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
VMHost | VMHost | Specifies a host where you want to create the new datastore. Passing multiple values to this parameter is obsolete. | true | True (ByValue) | |
Name | String | Specifies a name for the new datastore. | true | False | |
BlockSizeMB | Int32 | 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. | false | False | |
Confirm | SwitchParameter | If 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. | false | False | |
FileSystemVersion | String | Specifies the file system you want to use on the new datastore. | false | False | |
Kerberos | SwitchParameter | 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. | false | False | |
Nfs | SwitchParameter | Indicates that you want to create an NFS datastore. | false | False | |
NfsHost | String[] | Specifies the NFS host where you want to create the new datastore. | true | False | |
Path | String | 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. | true | False | |
ReadOnly | SwitchParameter | Indicates that the access mode for the mount point is ReadOnly. The default access mode is ReadWrite. | false | False | |
Server | VIServer[] | 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. | false | False | |
Vmfs | SwitchParameter | Indicates that you want to create a VMFS datastore. | false | False | |
WhatIf | SwitchParameter | Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified. | false | False |
Return Type
The one or more newly created Datastore objectsNotes
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.