PowerShell Commands

New-Volume

New-Volume [-StoragePool*] <CimInstance> [-AccessPath <String>] [-AllocationUnitSize <UInt32>] [-CimSession<CimSession>] [-DriveLetter <Char>] [-FileSystem <FileSystemType>] [-MediaType <New-Volume.MediaType>][-NumberOfColumns <UInt16>] [-NumberOfGroups <UInt16>] [-PhysicalDiskRedundancy <UInt16>] [-ProvisioningType<Microsoft.PowerShell.Cmdletization.GeneratedTypes.SetStoragePool.ProvisioningType>] [-ReadCacheSize <UInt64>][-ResiliencySettingName <String>] [-Size <UInt64>] [-StorageTierFriendlyNames <String[]>] [-StorageTiers<CimInstance[]>] [-StorageTierSizes <UInt64[]>] [-ThrottleLimit <Int32>] [-UseMaximumSize] [-WriteCacheSize<UInt64>] -FriendlyName* <String> [<CommonParameters>]
New-Volume [-AccessPath <String>] [-AllocationUnitSize <UInt32>] [-CimSession <CimSession>] [-DriveLetter <Char>][-FileSystem <FileSystemType>] [-ThrottleLimit <Int32>] -Disk*UniqueId <String> -FriendlyName* <String>[<CommonParameters>]
New-Volume [-AccessPath <String>] [-AllocationUnitSize <UInt32>] [-CimSession <CimSession>] [-DriveLetter <Char>][-FileSystem <FileSystemType>] [-ThrottleLimit <Int32>] -Disk*Path <String> -FriendlyName* <String>[<CommonParameters>]
New-Volume [-Disk*Number] <UInt32> [-AccessPath <String>] [-AllocationUnitSize <UInt32>] [-CimSession <CimSession>][-DriveLetter <Char>] [-FileSystem <FileSystemType>] [-ThrottleLimit <Int32>] -FriendlyName* <String>[<CommonParameters>]
New-Volume [-Disk*] <CimInstance> [-AccessPath <String>] [-AllocationUnitSize <UInt32>] [-CimSession <CimSession>][-DriveLetter <Char>] [-FileSystem <FileSystemType>] [-ThrottleLimit <Int32>] -FriendlyName* <String>[<CommonParameters>]
New-Volume [-AccessPath <String>] [-AllocationUnitSize <UInt32>] [-CimSession <CimSession>] [-DriveLetter <Char>][-FileSystem <FileSystemType>] [-MediaType <New-Volume.MediaType>] [-NumberOfColumns <UInt16>] [-NumberOfGroups<UInt16>] [-PhysicalDiskRedundancy <UInt16>] [-ProvisioningType<Microsoft.PowerShell.Cmdletization.GeneratedTypes.SetStoragePool.ProvisioningType>] [-ReadCacheSize <UInt64>][-ResiliencySettingName <String>] [-Size <UInt64>] [-StorageTierFriendlyNames <String[]>] [-StorageTiers<CimInstance[]>] [-StorageTierSizes <UInt64[]>] [-ThrottleLimit <Int32>] [-UseMaximumSize] [-WriteCacheSize<UInt64>] -FriendlyName* <String> -StoragePool*UniqueId <String> [<CommonParameters>]
New-Volume [-AccessPath <String>] [-AllocationUnitSize <UInt32>] [-CimSession <CimSession>] [-DriveLetter <Char>][-FileSystem <FileSystemType>] [-MediaType <New-Volume.MediaType>] [-NumberOfColumns <UInt16>] [-NumberOfGroups<UInt16>] [-PhysicalDiskRedundancy <UInt16>] [-ProvisioningType<Microsoft.PowerShell.Cmdletization.GeneratedTypes.SetStoragePool.ProvisioningType>] [-ReadCacheSize <UInt64>][-ResiliencySettingName <String>] [-Size <UInt64>] [-StorageTierFriendlyNames <String[]>] [-StorageTiers<CimInstance[]>] [-StorageTierSizes <UInt64[]>] [-ThrottleLimit <Int32>] [-UseMaximumSize] [-WriteCacheSize<UInt64>] -FriendlyName* <String> -StoragePool*Name <String> [<CommonParameters>]
New-Volume [-AccessPath <String>] [-AllocationUnitSize <UInt32>] [-CimSession <CimSession>] [-DriveLetter <Char>][-FileSystem <FileSystemType>] [-MediaType <New-Volume.MediaType>] [-NumberOfColumns <UInt16>] [-NumberOfGroups<UInt16>] [-PhysicalDiskRedundancy <UInt16>] [-ProvisioningType<Microsoft.PowerShell.Cmdletization.GeneratedTypes.SetStoragePool.ProvisioningType>] [-ReadCacheSize <UInt64>][-ResiliencySettingName <String>] [-Size <UInt64>] [-StorageTierFriendlyNames <String[]>] [-StorageTiers<CimInstance[]>] [-StorageTierSizes <UInt64[]>] [-ThrottleLimit <Int32>] [-UseMaximumSize] [-WriteCacheSize<UInt64>] -FriendlyName* <String> -StoragePool*FriendlyName <String> [<CommonParameters>]

The New-Volume cmdlet creates a volume with the specified file system. The cmdlet manages the creation of the virtual disk with the specified size and resiliency setting, initializes the disk, creates a partition on it and formats the volume with the specified file system, including Cluster Shared Volumes (CSVs).

Parameters

-AccessPath [<String>]

Specifies a drive letter, or a mount point.

-AllocationUnitSize [<UInt32>]

Specifies the allocation unit size to use when creating the volume.

-CimSession [<CimSession>]

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

-Disk <CimInstance>

  • This value is required
  • Accepts pipeline input ByValue

Specifies a Disk object. To obtain a Disk object, use the Get-Disk cmdlet.

-DiskNumber <UInt32>

  • This value is required

Specifies the disk number of the disk on which to create a volume.

-DiskPath <String>

  • This value is required

Specifies the path of the disk on which to create a volume.

-DiskUniqueId <String>

  • This value is required

Specifies the ID of the disk on which to create a volume.

-DriveLetter [<Char>]

Specifies the drive letter of the disk on which to create a volume.

-FileSystem [<FileSystemType>]

Specified the file system to use on the volume. The acceptable values for this parameter are: NTFS, and ReFS, as well as the cluster shared volume versions of these file systems for use on a scale-out file server: CSVFS_NTFS, and CSVFS_ReFS,

-FriendlyName <String>

  • This value is required

Specifies the friendly name to use for the volume.

-MediaType [<New-Volume.MediaType>]

Specifies the media type of the storage tier. The cmdlet creates the storage tier for the media type that you specify. The acceptable values for this parameter are:

-- SSD -- SCM -- HDD

Use SCM for storage-class memory such as NVDIMMs.

-NumberOfColumns [<UInt16>]

Specifies the number of columns to use when creating the volume on a Windows Storage subsystem. Columns represent the number of underlying physical disks across which one stripe of data for a volume is written.

-NumberOfGroups [<UInt16>]

Specifies the number of groups used by Local Reconstruction Coding (LRC) with a dual parity virtual disk. We recommend omitting this parameter and using the defaults.

-PhysicalDiskRedundancy [<UInt16>]

Specifies the physical disk redundancy value to use during the creation of a volume on a Windows Storage subsystem. This value represents how many failed physical disks the volume can tolerate without data loss. Redundancy values are as follows:

-- For two-way mirror spaces, the virtual disk can tolerate 1 failed physical disk without data loss. -- For three-way mirror spaces, the virtual disk can tolerate 2 failed physical disks without data loss. -- For single-parity spaces, the virtual disk can tolerate 1 failed physical disk without data loss. -- For dual-parity spaces the virtual disk can tolerate 2 failed physical disks without data loss.

-ProvisioningType [<Microsoft.PowerShell.Cmdletization.GeneratedTypes.SetStoragePool.ProvisioningType>]

Specifies the type of provisioning. The acceptable values for this parameter are: Fixed and Thin. Specify Fixed for storage spaces that use storage tiers or a clustered storage pool

-ReadCacheSize [<UInt64>]

This parameter is no longer supported.

-ResiliencySettingName [<String>]

Specifies the resiliency setting (storage layout) to use for the volume. Acceptable values vary by storage subsystem.

Allowed values for the Windows Storage subsystem are: Simple, Mirror, or Parity. By default, when you specify Mirror, Storage Spaces creates a two-way mirror, and when you specify Parity, Storage Spaces creates a single-parity space.

To create a three-way mirror space, specify 3 for the NumberofDataCopies parameter or 2 for the PhysicalDiskRedundancy parameter.

To create a dual-parity space, specify 2 for the PhysicalDiskRedundancy parameter and Fixed provisioning for the ProvisioningType parameter.

-Size [<UInt64>]

Specifies the size of the volume to create. The default unit is bytes. To specify a different unit, enter the size followed by one of the following unit values, with no spaces: Bytes, KB, MB, GB, or TB.

-StoragePool <CimInstance>

  • This value is required
  • Accepts pipeline input ByValue

Specifies the storage pool object in which you want to create a volume. To obtain a storage pool object, use the Get-StoragePool cmdlet.

-StoragePoolFriendlyName <String>

  • This value is required

Specifies the friendly name of the storage pool in which to create a volume.

-StoragePoolName <String>

  • This value is required

Specifies the name of the storage pool in which to create a volume.

-StoragePoolUniqueId <String>

  • This value is required

Specifies the unique ID of the storage pool in which to create a volume.

-StorageTierFriendlyNames [<String[]>]

Specifies the names of storage tiers to use when creating the volume.

-StorageTiers [<CimInstance[]>]

Specifies the storage tier objects to use when creating the volume.

-StorageTierSizes [<UInt64[]>]

Specifies how big to make each storage tier on this volume.

-ThrottleLimit [<Int32>]

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShellr calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

-UseMaximumSize [<SwitchParameter>]

Indicates that this cmdlet creates the largest volumn possible.

-WriteCacheSize [<UInt64>]

Specifies the size of the write-back cache. The cmdlet creates the write-back cache of the size that you specify when the cmdlet creates the virtual disk space.

The following describes the behavior of this parameter based on the value that you specify:

-- 1. If you do not specify this parameter, the cmdlet sets the value of the WriteCacheSizeDefault property from the storage pool. -- 2. The default setting of WriteCacheSizeDefault for a storage pool is Auto, which specifies that Windows Server automatically selects the optimal write-back cache size for your configuration. You can change the value of WriteCacheSizeDefault to a concrete value at any time. -- 3. The Auto setting for WriteCacheSize operates as follows: ---- a. If any of the following is true, Auto is set to 1 GB: ------ i. The storage pool contains at least N drives with enough capacity and you set the Usage parameter to Journal. N = 1 for simple spaces, N = 2 for two-way mirror and single parity, N = 3 for three-way mirror and dual parity. ------ ii. The storage pool contains at least N drives with enough capacity and the media type of the virtual disk is set to SSD. N = 1 for simple spaces, N = 2 for two-way mirror and single parity, N = 3 for three-way mirror and dual parity. ---- b. Otherwise, Auto is set to 0 (no log) for simple and mirror spaces, and 32 MB for parity spaces. -- 4. If you specify Auto or 0 (zero) for this parameter and the storage space is not a parity space, the cmdlet verifies that either 3.a.i or 3.a.ii is true. If either 3.a.i or 3.a.ii is not true, you cannot set WriteCacheSize to Auto or 0. ---- a. The objective of these conditions is to help you avoid scenarios in which you force the creation of a write-back cache in situations that result in slower performance.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Inputs
Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StoragePool
http://msdn.microsoft.com/library/windows/desktop/hh830551.aspx You can use the pipeline operator to pass an MSFT_StoragePool object to the InputObject parameter.
Outputs
Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/Storage/MSFT_Volume
http://msdn.microsoft.com/library/windows/desktop/hh830604.aspx This cmdlet outputs an object that represents the newly created volume.
Examples
  1. Create a volume on a mirror space:
    PS C:\>  New-Volume -StoragePoolName "CompanyData" -FriendlyName "TestVolume" -Size 10GB -ResiliencySettingName "Mirror" -FileSystem NTFS -AccessPath "M: "-ProvisioningType Fixed
    

    This command creates a new storage space in the CompanyData pool using the Mirror resiliency setting and fixed provisioning, and then formats the volume with the NTFS file system and assigns drive letter M.

  2. Create a volume on a new tiered storage space:
    PS C:\> New-Volume -StoragePoolFriendlyName "CompanyData" -FriendlyName "UserData" -AccessPath "M:" -ResiliencySettingName "Mirror" -ProvisioningType "Fixed" -StorageTiers (Get-StorageTier -FriendlyName "*SSD*"), (Get-StorageTier -FriendlyName "*HDD*") -StorageTierSizes 20GB, 80GB -FileSystem NTFS
    

    This command creates new storage space in the CompanyData pool using the Mirror resiliency setting, fixed provisioning, a 20 GB SSD storage tier, and an 80 GB HDD storage tier, and then formats the volume with the NTFS file system and assigns drive letter M.

Additional Notes
 To create a volume on a new storage space with enclosure-awareness enabled (providing resiliency for an entire 
 JBOD enclosure failure), use the Set-StoragePool cmdlet with the -EnclosureAwareDefault $true parameter to set 
 the storage pool to create storage spaces with enclosure awareness enabled by default.

This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

PowerShell Commands