Export (0) Print
Expand All

New-IscsiVirtualDisk

Windows Server 2012 R2 and Windows 8.1

Updated: October 17, 2013

Applies To: Windows 8.1, Windows PowerShell 4.0, Windows Server 2012 R2

New-IscsiVirtualDisk

Creates an iSCSI virtual disk with the specified file path and size.

Syntax

Parameter Set: Dynamic
New-IscsiVirtualDisk [-Path] <String> [-SizeBytes] <UInt64> [-BlockSizeBytes <UInt32> ] [-ComputerName <String> ] [-Credential <PSCredential> ] [-Description <String> ] [-LogicalSectorSizeBytes <UInt32> ] [-PhysicalSectorSizeBytes <UInt32> ] [ <CommonParameters>]

Parameter Set: Differencing
New-IscsiVirtualDisk [-Path] <String> [[-SizeBytes] <UInt64> ] -ParentPath <String> [-BlockSizeBytes <UInt32> ] [-ComputerName <String> ] [-Credential <PSCredential> ] [-Description <String> ] [-PhysicalSectorSizeBytes <UInt32> ] [ <CommonParameters>]

Parameter Set: Fixed
New-IscsiVirtualDisk [-Path] <String> [-SizeBytes] <UInt64> -UseFixed [-BlockSizeBytes <UInt32> ] [-ComputerName <String> ] [-Credential <PSCredential> ] [-Description <String> ] [-DoNotClearData] [-LogicalSectorSizeBytes <UInt32> ] [-PhysicalSectorSizeBytes <UInt32> ] [ <CommonParameters>]




Detailed Description

The New-IscsiVirtualDisk cmdlet creates a new iSCSI Virtual Hard Disk (VHDX) object with the specified file path and size. After the iSCSI VHDX object has been created, the virtual disk can be assigned to an iSCSI target. Once a virtual disk has been assigned to a target, and an initiator connects to that target, the iSCSI initiator can then access the virtual disk after the initiator connects to the target.

If the virtual hard disk file path does not exist, then a new VHDX file will then be created.
If the VHDX file path exists, then the server will return an error. Use the Import-IscsiVirtualDisk cmdlet to import existing virtual hard disks.

If an error is displayed during the creation of the virtual disk, please check the following conditions:
-- An absolute file path must be specified for the Path and ParentPath parameters.
-- The virtual disk file name must have a .vhdx file extension.
-- The VHDX file cannot be a network file, or be in a compressed, sparse, or transacted folder.

Parameters

-BlockSizeBytes<UInt32>

Specifies the block size, in bytes, for the VHDX. For fixed VHDX, if the value of the SizeBytes parameter is less than 32 MB, the default size if 2 MB. Otherwise, the default value is 32 MB. For dynamic VHDX, the default size is 2 MB. For differencing VHDX, the default size is the parent BlockSize.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerName<String>

Specifies the computer name, or IP address, of the remote computer, if this cmdlet is run on a remote computer.
Specifies the cluster resource group network name, or cluster node name, if this cmdlet is run on a cluster configuration.

If you do not specify a value for this parameter, the cmdlet uses the local computer.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Credential<PSCredential>

Specifies the credentials when connecting to a remote computer.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Description<String>

Specifies the description for the iSCSI virtual disk.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-DoNotClearData

Indicates that the cmdlet does not clear the fixed VHDX. Because failing to clear data can reveal pre-existing data, we do not recommend this option.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LogicalSectorSizeBytes<UInt32>

Specifies the logical sector size, in bytes, for the VHDX. The acceptable values for this parameter are:  512 and 4096. The default value is 512.


Aliases

none

Required?

false

Position?

named

Default Value

512

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ParentPath<String>

Specifies the parent virtual disk path if the VHDX is a differencing disk.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Path<String>

Specifies the path of the VHDX file that is associated with the iSCSI virtual disk.
If the VHDX file path does not exist, then a new VHDX file will then be created.
If the virtual hard drive file path exists, then the server will return an error. Use the Import-IscsiVirtualDisk cmdlet to import existing virtual hard drives.


Aliases

DevicePath

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-PhysicalSectorSizeBytes<UInt32>

Specifies the physical sector size, in bytes, for the VHDX. The acceptable values for this parameter are:  512 and 4096. The default value is 4096.


Aliases

none

Required?

false

Position?

named

Default Value

4096

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SizeBytes<UInt64>

Specifies the size, in bytes, of the iSCSI virtual disk.


Aliases

Size

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-UseFixed

Indicates that the cmdlet creates a fixed VHDX.


Aliases

Fixed

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Iscsi.Target.Commands.IscsiVirtualDisk

Examples

EXAMPLE 1

This example creates a fixed VHDX with 10GB in size.


PS C:\> New-IscsiVirtualDisk –Path "E:\temp\test.vhdx" -Size 10GB

EXAMPLE 2

This example creates a differencing VHDX, with the parent path E:\temp\test.vhdx and the differencing VHDX path is E:\temp\child\diff.vhdx.


PS C:\> New-IscsiVirtualDisk -ParentPath "E:\temp\test.vhdx" -Path "E:\temp\child\diff.vhdx"

EXAMPLE 3

This example creates a fixed VHDX with the size 10GB at E:\temp\test.vhdx on the computer named iscsisvr.


PS C:\> New-IscsiVirtualDisk –Path "E:\temp\test.vhdx" -Size 10GB -ComputerName "iscsisvr"

EXAMPLE 4

This example creates a VHDX with the size 20MB. This VHDX will not be saved, the VHDX will be lost if the wintarget service is restarted or the system is restarted.


PS C:\> New-IscsiVirtualDisk –Path ramdisk:test.vhdx –Size 20MB

Related topics

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft