New-IscsiVirtualDisk

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

Syntax

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

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.

Examples

EXAMPLE 1

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

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

EXAMPLE 2

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

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.

EXAMPLE 3

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

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

EXAMPLE 4

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

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.

Parameters

-BlockSizeBytes

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.

Type:UInt32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ComputerName

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.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Credential

Specifies the credentials when connecting to a remote computer.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Description

Specifies the description for the iSCSI virtual disk.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
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.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LogicalSectorSizeBytes

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.

Type:UInt32
Position:Named
Default value:512
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ParentPath

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

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Path

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.

Type:String
Aliases:DevicePath
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PhysicalSectorSizeBytes

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.

Type:UInt32
Position:Named
Default value:4096
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SizeBytes

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

Type:UInt64
Aliases:Size
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-UseFixed

Indicates that the cmdlet creates a fixed VHDX.

Type:SwitchParameter
Aliases:Fixed
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

Microsoft.Iscsi.Target.Commands.IscsiVirtualDisk