Condividi tramite


New-IscsiVirtualDisk

New-IscsiVirtualDisk

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

Syntax

Parameter Set: Fixed
New-IscsiVirtualDisk [-Size] <UInt64> [ <CommonParameters>]

Parameter Set: __AllParameterSets
New-IscsiVirtualDisk [-Path] <String> [-ComputerName <String> ] [-Credential <PSCredential> ] [-Description <String> ] [ <CommonParameters>]

Parameter Set: Differencing
New-IscsiVirtualDisk -ParentPath <String> [ <CommonParameters>]

Detailed Description

The New-IscsiVirtualDisk cmdlet creates a new iSCSI Virtual Hard Disk (VHD) object with the specified file path and size. After the iSCSI VHD 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 VHD file path does not exist, then a new VHD file will then be created.
If the VHD file path exists, then the server will return an error. Use the Import-IscsiVirtualDisk cmdlet to import existing VHDs.

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 .VHD file extension. The iSCSI software target does not support the .VHDX file extension in this release.
-- The VHD file cannot be a network file, or be in a compressed, sparse, or transacted folder.

Parameters

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

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

-ParentPath<String>

Specifies the parent virtual disk path if the VHD 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 VHD file that is associated with the iSCSI virtual disk.
If the VHD file path does not exist, then a new VHD file will then be created.
If the VHD file path exists, then the server will return an error. Use the Import-IscsiVirtualDisk cmdlet to import existing VHDs.

Aliases

DevicePath

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Size<UInt64>

Specifies the size of the iSCSI virtual disk.
Note: This parameter takes a number and a unit as input, such as 10GB, 20MB, 1TB.
If this parameter is not provided, then a prompt for the input of this parameter with be displayed, as it is a required field. At that time, the value will need to be provided in Bytes; since no unit can be entered at the prompt.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

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 VHD with 10GB in size.

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

EXAMPLE 2

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

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

EXAMPLE 3

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

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

EXAMPLE 4

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

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

Checkpoint-IscsiVirtualDisk

Convert-IscsiVirtualDisk

Expand-IscsiVirtualDisk

Get-IscsiVirtualDisk

Import-IscsiVirtualDisk

Remove-IscsiVirtualDisk

Restore-IscsiVirtualDisk

Set-IscsiVirtualDisk