Export (0) Print
Expand All

Create vdisk

Updated: April 17, 2012

Applies To: Windows 7, Windows Server 2008 R2

Creates a new virtual hard disk (VHD) file by using the available disk space on the computer, and then saves it to the location that you specify. When you first create a VHD, it is similar to an uninitialized hard disk drive. You can then create one or more partitions in the VHD and format the partition(s) by using FAT, ExFAT, or NTFS. You can create three types of VHDs:

  • Fixed-size VHDs. A fixed VHD has an allocated size that does not change. To create a fixed VHD, use the type=fixed parameter.

  • Dynamically expanding VHDs. A dynamically expanding VHD resizes to accommodate the data that it contains. To create a dynamically expanding VHD, use the type=expandable parameter.

  • Differencing VHDs. A differencing VHD is similar to a dynamically expanding VHD, but it contains only the modified disk blocks of the associated parent VHD. To create a differencing VHD, use the parent parameter.

For more information about how to create and manage VHDs, see the following resources:

create vdisk file=<file path> {[type=<fixed|expandable>] | [parent=<file path>] | [source=<file path>]} [maximum=<n>] [sd=<SDDL>] [noerr]

 

Parameter Description

file=<file path>

Specifies the full path and file name of the VHD file to create. If type, parent, or source is not specified, a fixed VHD is created. The file path can be to a network share.

type=<fixed|expandable>

Specifies one of the following parameters:

  • Fixed (default): Creates a fixed VHD, which has an allocated size that does not change. For example, if you create a fixed VHD that is 24 gigabytes (GB), the file will be approximately 24 GB (with some space used for the internal VHD structure) regardless of the data that is written to it. Creating a fixed VHD takes longer than creating an expandable VHD because the entire file is allocated at the time it is created.

  • Expandable: Creates a dynamically expanding VHD, which expands to accommodate the data that it contains. For example, a 24 GB dynamically expanding VHD is initially around 80 megabytes (MB) on the host file system. As data is written to the VHD, the file grows, but it has a maximum size of 24 GB.

parent=<file path>

Specifies to create a differencing VHD file that is a child of the parent VHD at <file path>. The differencing VHD contains only the changes from the parent VHD. The parent can be any type of VHD (fixed, dynamically expanding, or differencing). The parent VHD is read-only, so you must modify the differencing VHD. When you use this parameter to create a differencing VHD, you cannot specify the type parameter. This is because the differencing VHD file always uses the type from the parent VHD.

source=<file path>

Specifies to create a new VHD file that is a copy of the source file at <file path>. Note that there is no parent-child relationship established between the new VHD and the source VHD.

maximum=<n>

The maximum amount of space that is exposed by the VHD file in megabytes (MB). You should only specify maximum when you are creating a fixed or dynamically expanding VHD file.

sd=<SDDL>

Sets the user filter on the VHD file. The filter string must be in the Security Descriptor Definition Language (SDDL) format. If you do not specify a security descriptor, the security descriptor from the parent directory is used.

SDDL strings can be complex but in its simplest form, a security descriptor that protects access is knows as a discretionary access control list (DACL). It is of the form: D:<dacl_flags><string_ace1><string_ace2>... <string_acen>

Common DACL flags are:

  • A – Allow access

  • D – Deny access

Common rights are:

  • GA – All access

  • GR – Read access

  • GW – Write access

Common user accounts are:

  • BA – Built in administrators

  • AU – Authenticated users

  • CO – Creator owner

  • WD - Everyone

Examples:

D:P:(A;;GR;;;AU gives read-access to all authenticated users

D:P:(A;;GA;;;WD gives everyone full access

noerr

Used for scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

To create a 1 GB fixed VHD file, type either of the following:

Create vdisk file=”c:\test\test.vhd” maximum=1000
Create vdisk file=”c:\test\test.vhd” type=fixed maximum=1000

To create a 2 GB dynamically expanding VHD file, type:

Create vdisk file=”c:\test\test.vhd” maximum=2000 type=expandable

To create a differencing VHD file that describes a modification of Parent.vhd, type:

Create vdisk file=”c:\test\test.vhd” parent=”c:\test\parent.vhd”

To create a new VHD that is a duplicate of Test.vhd, type:

Create vdisk file=”c:\test\new.vhd” source=”c:\test\test.vhd”

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft