## 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

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