vSphere PowerCLI Cmdlets Reference

New-Datastore

Synopsis

Creates a new datastore.

Syntax

New-Datastore [-Server <VIServer[]>] [-VMHost] <VMHost[]> [-Name] <String> -Path <String> -NfsHost <String> [-ReadOnly] [-Cifs] -Username <String> -Password <String> [-WhatIf] [-Confirm] [<CommonParameters>]
New-Datastore [-Server <VIServer[]>] [-VMHost] <VMHost[]> [-Name] <String> -Path <String> [-Local] [-WhatIf] [-Confirm] [<CommonParameters>]
New-Datastore [-Server <VIServer[]>] [-VMHost] <VMHost[]> [-Name] <String> -Path <String> [-Nfs] -NfsHost <String> [-ReadOnly] [-WhatIf] [-Confirm] [<CommonParameters>]
New-Datastore [-Server <VIServer[]>] [-VMHost] <VMHost[]> [-Name] <String> -Path <String> [-Vmfs] [-BlockSizeMB <Int32>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Get-Datastore
Remove-Datastore
Set-Datastore

Detailed Description

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

Parameters

NameDescriptionRequired?Pipeline InputDefault Value
ServerSpecify the vSphere servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
VMHostSpecify a host where you want to create the new datastore.truetrue (ByValue)
NameSpecify a name for the new datastore.truefalse
PathIf you want to create a local datastore, specify the file path to the directory where the virtual machine data is stored.
If you want to create a NFS/CIFS 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
NfsHostSpecify the NFS host where you want to create the new datastore.truefalse
ReadOnlyIndicate that the access mode for the mount point is ReadOnly. The default access mode is ReadWrite.falsefalse
CifsIndicate that you want to create a CIFS datastore.falsefalse
UsernameSpecify the username you want to use for authentication with the CIFS server.truefalse
PasswordSpecify the password you want to use for authentication with the CIFS server.truefalse
WhatIfIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse
ConfirmIf 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$true
LocalIndicate that you want to create a Local datastore.falsefalse
NfsIndicate that you want to create a NFS datastore.falsefalse
VmfsIndicate that you want to create a VMFS datastore.falsefalse
BlockSizeMBSpecify 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

Return Type

Datastore

Notes

Examples

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

New-Datastore -Nfs -VMHost 10.23.112.345 -Name Datastore -Path $remotePath -NfsHost $remoteHost

Creates a new Nfs datastore named Datastore on the virtual machine host with IP address 10.23.112.345 with the specified parameters.

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

Get-VMHost | New-Datastore -Nfs -Name NFS1 -Path "/mnt/nfs1/nfs11/test1" -NfsHost 10.91.246.21

Adds a NFS storage across multiple hosts.


Copyright © 1998 - 2010 VMware, Inc. All rights reserved.