Sample: Configure UEFI/GPT-Based Hard Drive Partitions by Using Windows Setup
Applies To: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2
You can add answer-file settings to automatically configure disk partitions during Windows® installation. This topic describes how to configure disk partitions for a Unified Extensible Firmware Interface (UEFI)–based and GUID partition table (GPT)–based computer, as described in Configure UEFI/GPT-Based Hard Drive Partitions. This topic covers the following partition configurations:
Default configuration. Includes a Windows Recovery Environment (Windows RE) Tools partition, a system partition (also known as an Extensible Firmware Interface System Partition or ESP), a Microsoft® Reserved Partition (MSR), and a Windows partition. The following diagram shows this configuration.
Recommended configuration. Includes a Windows RE Tools partition, an ESP, an MSR, a Windows partition, and a recovery image partition. The following diagram shows this configuration.
In this topic:
Manually Select the Default Partition Configuration
Example: Automatically Install the Default Partition Configuration
Example: Automatically Install the Recommended Partition Configuration
Manually Select the Default Partition Configuration
For new installations, Windows Setup prompts you to configure your partitions. If you select the default configuration, Windows Setup creates a Windows RE Tools partition, a system partition, an MSR, and a primary Windows partition when the following conditions are true:
The computer does not already have a Windows partition. When you upgrade Windows from an earlier version, Windows Setup does not change the arrangement of your partitions.
The computer does not already have a system partition.
The computer does not already have three partitions.
The computer has sufficient disk space for the partitions.
Example: Automatically Install the Default Partition Configuration
To automate the configuration of a Windows RE Tools partition, a system partition, ESP, an MSR, and a Windows partition, add the following settings to an answer file.
Microsoft-Windows-Setup\DiskConfiguration\Disk |
DiskID = 0 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ CreatePartitions\CreatePartition |
Order = 1 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ CreatePartitions\CreatePartition |
Order = 2 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ CreatePartitions\CreatePartition |
Order = 3 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ CreatePartitions\CreatePartition |
Extend = true |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ ModifyPartitions\ModifyPartition |
Format = NTFS |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ ModifyPartitions\ModifyPartition |
Format = FAT32 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ ModifyPartitions\ModifyPartition |
Order = 3 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ ModifyPartitions\ModifyPartition |
Format = NTFS |
Microsoft-Windows-Setup\ImageInstall\OSImage\InstallTo |
DiskID = 0 |
XML Example
<DiskConfiguration>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<!-- Windows RE Tools partition -->
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>Primary</Type>
<Size>300</Size>
</CreatePartition>
<!-- System partition (ESP) -->
<CreatePartition wcm:action="add">
<Order>2</Order>
<Type>EFI</Type>
<Size>100</Size>
<!-- Note: for Advanced Format Generation One drives, change to size=260 -->
</CreatePartition>
<!-- Microsoft reserved partition (MSR) -->
<CreatePartition wcm:action="add">
<Order>3</Order>
<Type>MSR</Type>
<Size>128</Size>
</CreatePartition>
<!-- Windows partition -->
<CreatePartition wcm:action="add">
<Order>4</Order>
<Type>Primary</Type>
<Extend>true</Extend>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<!-- Windows RE Tools partition -->
<ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<Label>WINRE</Label>
<Format>NTFS</Format>
<TypeID>de94bba4-06d1-4d40-a16a-bfd50179d6ac</TypeID>
</ModifyPartition>
<!-- System partition (ESP) -->
<ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>2</PartitionID>
<Label>System</Label>
<Format>FAT32</Format>
</ModifyPartition>
<!-- MSR partition does not need to be modified -->
<Order>3</Order>
<PartitionID>3</PartitionID>
<!-- Windows partition -->
<ModifyPartition wcm:action="add">
<Order>4</Order>
<PartitionID>4</PartitionID>
<Label>Windows</Label>
<Letter>C</Letter>
<Format>NTFS</Format>
</ModifyPartition>
</ModifyPartitions>
</Disk>
<WillShowUI>OnError</WillShowUI>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>4</PartitionID>
</InstallTo>
</OSImage>
</ImageInstall>
Example: Automatically Install the Recommended Partition Configuration
To automate the configuration of a Windows RE Tools partition, a system partition, an MSR, a Windows partition, and a recovery image partition, add the following settings to an answer file.
Microsoft-Windows-Setup\DiskConfiguration\Disk |
DiskID = 0 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ CreatePartitions\CreatePartition |
Order = 1 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ CreatePartitions\CreatePartition |
Order = 2 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ CreatePartitions\CreatePartition |
Order = 3 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ CreatePartitions\CreatePartition |
Order = 4 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ CreatePartitions\CreatePartition |
Order = 5 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ ModifyPartitions\ModifyPartition |
Format = NTFS |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ ModifyPartitions\ModifyPartition |
Format = FAT32 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ ModifyPartitions\ModifyPartition |
Order = 3 |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ ModifyPartitions\ModifyPartition |
Format = NTFS |
Microsoft-Windows-Setup\DiskConfiguration\Disk\ ModifyPartitions\ModifyPartition |
Format = NTFS |
Microsoft-Windows-Setup\ImageInstall\OSImage\InstallTo |
DiskID = 0 |
XML Example
<DiskConfiguration>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<!-- Windows RE Tools partition -->
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>Primary</Type>
<Size>300</Size>
</CreatePartition>
<!-- System partition (ESP) -->
<CreatePartition wcm:action="add">
<Order>2</Order>
<Type>EFI</Type>
<Size>100</Size>
</CreatePartition>
<!-- Microsoft reserved partition (MSR) -->
<CreatePartition wcm:action="add">
<Order>3</Order>
<Type>MSR</Type>
<Size>128</Size>
</CreatePartition>
<!-- Windows partition -->
<CreatePartition wcm:action="add">
<Order>4</Order>
<Type>Primary</Type>
<Size>75000</Size>
</CreatePartition>
<!-- Recovery image partition -->
<CreatePartition wcm:action="add">
<Order>5</Order>
<Type>Primary</Type>
<Size>15000</Size>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<!-- Windows RE Tools partition -->
<ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<Label>WinRE</Label>
<Format>NTFS</Format>
<TypeID>de94bba4-06d1-4d40-a16a-bfd50179d6ac</TypeID>
</ModifyPartition>
<!-- System partition (ESP) -->
<ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>2</PartitionID>
<Label>System</Label>
<Format>FAT32</Format>
</ModifyPartition>
<!-- MSR partition does not need to be modified -->
<Order>3</Order>
<PartitionID>3</PartitionID>
<!-- Windows partition -->
<ModifyPartition wcm:action="add">
<Order>4</Order>
<PartitionID>4</PartitionID>
<Label>Windows</Label>
<Letter>C</Letter>
<Format>NTFS</Format>
</ModifyPartition>
<!—Recovery image partition -->
<ModifyPartition wcm:action="add">
<Order>5</Order>
<PartitionID>5</PartitionID>
<Label>Recovery image</Label>
<Format>NTFS</Format>
<TypeID>de94bba4-06d1-4d40-a16a-bfd50179d6ac</TypeID>
</ModifyPartition>
</ModifyPartitions>
</Disk>
<WillShowUI>OnError</WillShowUI>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>4</PartitionID>
</InstallTo>
</OSImage>
</ImageInstall>
See Also
Tasks
Sample: Configure UEFI/GPT-Based Hard Drive Partitions by Using Windows PE and DiskPart
Sample: Configure BIOS/MBR-Based Hard Drive Partitions by Using Windows Setup