Data ONTAP® PowerShell Toolkit

Switch to clustered Data ONTAP documentation.

Cmdlet: Set-NaVirtualDiskSize


NAME
Set-NaVirtualDiskSize

SYNOPSIS
Resize a VHD or VHDX format virtual disk.

SYNTAX
Set-NaVirtualDiskSize [-FullName] <String> [-Size] <String> [-Preserve] [<Co
mmonParameters>]

Set-NaVirtualDiskSize [-FullName] <String> -Minimum [-Preserve] [<CommonPara
meters>]


DESCRIPTION
Resize a VHD or VHDX format virtual disk. A VHD must reside on a Data ONTAP
LUN. A VHDX may reside on a Data ONTAP LUN or a Data ONTAP CIFS share. Th
e cmdlet supports growing and shrinking fixed size VHD and VHDX files. The
cmdlet also supports growing dynamic VHDX files. If necessary, the NTFS fil
e system inside the virtual disk is resized.

A new VHD size must be between 12 MB and 2040 GB. A new VHDX size must be b
etween 12 MB and 64 TB. Any blocks added or removed are zeroed on the Data
ONTAP storage controller. Growing the virtual disk consumes no space until
additional data is written, and shrinking the virtual disk reclaims all of t
he removed space.

The file to be resized must be specified with a fully-qualified path that re
sides on a Data ONTAP LUN or, for VHDX files, a Data ONTAP CIFS share. Clus
ter-shared volumes (CSVs) are supported. Administrator privileges are requi
red to use this cmdlet.


PARAMETERS
-FullName <String>
The fully-qualified name of the VHD file to be resized.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

-Size <String>
Specify the VHD size using the following format:

[+|-]<number>[k|m|g|t|%]

If a leading '+' or '-' appears, it indicates that the VHD size is to be
increased or decreased (respectively) by the indicated amount, else the
amount is the absolute size to set. The optional trailing 'k', 'm', 'g
', and 't' indicates the desired units, namely 'kilobytes', 'megabytes',
'gigabytes', and 'terabytes' (respectively). The optional trailing '%'
indicates to increase or decrease the size of the VHD by a percentage o
f its current size. If the trailing unit character doesn't appear, then
<number> is interpreted as the number of bytes desired.

Required? true
Position? 2
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

-Preserve
Specify to leave all partitions within the VHD untouched. This is usefu
l if the VHD file contains a non-Windows partition style, such as EXT3.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Minimum
Specify to shrink the VHD file as far as possible.

Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
System.IO.FileInfo


NOTES


Category: host

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

C:\PS>Set-NaVirtualDiskSize J:\GoldenVM1.vhd +100g


Increase the VHD file 'GoldenVM1.vhd' by 100 GB.


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 8/24/2011 4:46 PM 214748365312 GoldenVM1.vhd


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

C:\PS>Set-NaVirtualDiskSize E:\VM1.vhd +10%


Increase the size of VM1.vhd by 10%.


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 8/24/2011 4:46 PM 214748365312 VM1.vhd


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

C:\PS>Set-NaVirtualDiskSize C:\ClusterStorage\Volume2\VirtualDisks\Win2k8R2_
VM1.vhdx 90GB


Increase the size of the given VHDX format virtual disk.


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 5/15/2013 4:23 PM 96628375552 win2k8r2_vm1.vhdx



RELATED LINKS
New-NaVirtualDisk
Remove-NaHostFile







 Data ONTAP® PowerShell Toolkit