This topic discusses how to create a customized hard disk partition structure for a BIOS-based computer during Windows® Setup. For instructions on customizing a hard disk partition structure for computers that support the Unified Extended Firmware Interface (UEFI), see Create UEFI-based Hard-Disk Partitions by Using Windows SIM.

Plan your partition structure

Plan your partition structure using information from the topic, Understanding Disk Partitions.

For examples of partition structures, see Recommended BIOS-Based Disk-Partition Configurations.

In your plan, include details such as the Type, Order, and PartitionID of each partition. You will need these details to complete your partition structure, as explained later in this topic.

To prepare the hard disks

In this section, you identify each of the hard disks you will be using on your system.

  1. Open Windows System Image Manager (Windows SIM), and open an answer file.

  2. Add the setting: Microsoft-Windows-Setup\DiskConfiguration\Disk to the windowsPE configuration pass.

  3. For each additional hard disk, right-click DiskConfiguration, and select Insert New Disk.

  4. For each disk, set DiskID. The first hard disk has the value of 0 (zero), the second has the value of 1, and so on.

  5. For each disk, set WillWipeDisk to true.

To create the partitions

In this section, you create the partition structure.

Important:
  • Note the differences among these parts of the partition structure:
    • An extended partition (which is a container for logical partitions).

    • The setting: Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition\Extend (which defines which of the primary or extended partitions fills the remaining space on a hard drive).

    • The setting: Microsoft-Windows-Setup\DiskConfiguration\Disk\ModifyPartitions\ModifyPartition\Extend (which in this example defines which logical partition fills the remaining space within the extended partition).

  • See Understanding Disk Partitions for information about partition rules.

To create the partition structure:

  1. Add the setting: Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions to the windowsPE configuration pass.

  2. Right-click CreatePartitions, and select CreatePartition. Repeat this step for each partition.

  3. In the CreatePartition setting, add an Order setting for each partition. The first partition on a disk has the value of 1, the second, 2, and so on.

  4. In CreatePartition, specify the type of each partition.

    Set the system partition as Type = Primary. Set other partitions as Type = Primary, Extended, or Logical.

  5. In CreatePartition, configure the size of the partitions. Use either Size = <size> or Extend = true for each partition; do not use both:

    • Use Size to specify the partition size in megabytes (for example, 15000).

    • For the last of the primary or extended partitions, use Extend = true to instruct Windows Setup to set the partition to fill the remainder of the hard disk.

    • If you use logical partitions, you can select the last logical partition to fill the remainder of the extended partition. In Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition\Extend, set Extend = false, and set Size = 100. This size will initially be created as a 100 MB partition, which you will modify in the next section.

To modify the partitions

In this section, you modify the partitions.

  1. Add the setting: Microsoft-Windows-Setup\DiskConfiguration\Disk\ModifyPartitions to the windowsPE configuration pass.

  2. Right-click ModifyPartitions, and select ModifyPartition. Repeat this step for each partition you want to modify.

    • If you use only primary partitions, then add a ModifyPartition element for every partition. With this structure, you will be able to use the same values for ModifyPartition\Order, and PartitionID in the next two steps that you used for CreatePartition\Order.

    • If you use an extended partition, then add a ModifyPartition element for every partition but one. Typically the extended partition does not need further modification. With this structure, you can use the same values for ModifyPartition\Order and PartitionID in the next two steps.

  3. In ModifyPartition, use Order to specify the sequence that partition modifications will follow. The first partition modification has the value of 1, the second, 2, and so on.

  4. In ModifyPartition, use PartitionID to identify each partition.

    • If you use only primary partitions, then the PartitionID value will be the same as the Order value.

    • If you use an extended partition, then the first primary partitions receive a PartitionID value that is the same as the Order value. The extended partition itself does not receive a PartitionID. However, each logical partition inside the extended partition does receive a PartitionID, starting with the Order value of the extended partition, and continuing incrementally from there. Each primary partition following the extended partition continues this sequence.

      For example:

      Primary (PartitionID 1)

      Extended

      Logical (PartitionID 2)

      Logical (PartitionID 3)

      Logical (PartitionID 4)

      Primary (PartitionID 5)

      Primary (PartitionID 6)

  5. In ModifyPartition, specify the system partition as Active = true. If there is no separate system partition, specify the Windows partition.

  6. In ModifyPartition, use Label to label to each primary and logical partition.

  7. In ModifyPartition, use Letter to specify drive letters for Windows and data partitions. For the Windows partition, we recommend using Letter = C. If you do not specify a letter, the default setting is the first available letter from C through Z.

  8. If you use logical partitions, select the last logical partition, and set ModifyPartition\Extend = true to modify this partition to fill the remaining space in the extended partition.

To identify the Windows partition

In this section, you identify a single partition where Windows will be installed.

  1. In the setting: Microsoft-Windows-Setup \ImageInstall\OSImage, either clear the setting InstallToAvailablePartition, or set it to false.

  2. Add the setting: Microsoft-Windows-Setup \ImageInstall\OSImage\InstallTo.

  3. In InstallTo, set DiskID to the hard disk where you want to install Windows.

  4. In InstallTo, set PartitionID to the partition where you want to install Windows.

XML Example

The following diagram and XML output shows Autounattend.xml Disk Configuration settings for the standard configuration: a system with two primary partitions:



Diagram of the default BIOS partition structure
<DiskConfiguration>
   <Disk wcm:action="add">
	<DiskID>0</DiskID> 
	<WillWipeDisk>true</WillWipeDisk> 
	<CreatePartitions>
		 <CreatePartition wcm:action="add">
			<Order>1</Order> 
			<Size>300</Size> 
			<Type>Primary</Type> 
		 </CreatePartition>
		 <CreatePartition wcm:action="add">
			<Order>2</Order> 
			<Extend>true</Extend> 
			<Type>Primary</Type> 
		 </CreatePartition>
	</CreatePartitions>
	<ModifyPartitions>
		 <ModifyPartition wcm:action="add">
			<Order>1</Order> 
			<PartitionID>1</PartitionID> 
			<Active>true</Active> 
			<Format>NTFS</Format> 
			<Label>System</Label> 
			<Letter>S</Letter> 
			<TypeID>0x27</TypeID> 
		 </ModifyPartition>
		 <ModifyPartition wcm:action="add">
			<Order>2</Order> 
			<PartitionID>2</PartitionID> 
			<Format>NTFS</Format> 
			<Label>Windows</Label> 
		 </ModifyPartition>
	</ModifyPartitions>
   </Disk>
</DiskConfiguration>
<ImageInstall>
   <OSImage>
	<InstallTo>
		 <DiskID>0</DiskID> 
		 <PartitionID>2</PartitionID> 
	</InstallTo>
   </OSImage>
</ImageInstall>

The following diagram and XML output shows Autounattend.xml Disk Configuration settings for a system with primary, extended, and logical partitions:



Diagram of a BIOS disk with logical partitions
<DiskConfiguration>
   <Disk wcm:action="add">
	<DiskID>0</DiskID> 
	<WillWipeDisk>true</WillWipeDisk> 
	<CreatePartitions>
		 <CreatePartition wcm:action="add">
			<Order>1</Order> 
			<Size>1234</Size> 
			<Type>Primary</Type> 
		 </CreatePartition>
		 <CreatePartition wcm:action="add">
			<Order>2</Order> 
			<Extend>false</Extend> 
			<Type>Primary</Type> 
			<Size>250</Size> 
		 </CreatePartition>
		 <CreatePartition wcm:action="add">
			<Order>3</Order> 
			<Size>300</Size> 
			<Type>Primary</Type> 
		 </CreatePartition>
		 <CreatePartition wcm:action="add">
			<Order>4</Order> 
			<Extend>true</Extend> 
			<Type>Extended</Type> 
		 </CreatePartition>
		 <CreatePartition wcm:action="add">
			<Order>5</Order> 
			<Size>15000</Size> 
			<Type>Logical</Type> 
		 </CreatePartition>
		 <CreatePartition wcm:action="add">
			<Order>6</Order> 
			<Type>Logical</Type> 
			<Extend>false</Extend> 
			<Size>100</Size> 
		 </CreatePartition>
	</CreatePartitions>
	<ModifyPartitions>
		 <ModifyPartition wcm:action="add">
			<Order>1</Order> 
			<PartitionID>1</PartitionID> 
			<Format>NTFS</Format> 
			<Label>Utility1</Label> 
			<Letter>U</Letter> 
		 </ModifyPartition>
		 <ModifyPartition wcm:action="add">
			<Order>2</Order> 
			<PartitionID>2</PartitionID> 
			<Format>NTFS</Format> 
			<Label>Utility2</Label> 
			<TypeID>0x27</TypeID> 
		 </ModifyPartition>
		 <ModifyPartition wcm:action="add">
			<Order>3</Order> 
			<PartitionID>3</PartitionID> 
			<Active>true</Active> 
			<Format>NTFS</Format> 
			<Label>System</Label>
			<TypeID>0x27</TypeID>
		 </ModifyPartition>
		 <ModifyPartition wcm:action="add">
			<Order>4</Order> 
			<PartitionID>4</PartitionID> 
			<Format>NTFS</Format> 
			<Label>Windows</Label> 
			<Letter>C</Letter> 
		 </ModifyPartition>
		 <ModifyPartition wcm:action="add">
			<Order>5</Order> 
			<PartitionID>5</PartitionID> 
			<Format>NTFS</Format> 
			<Label>Logical2</Label> 
			<Letter>D</Letter> 
			<Extend>true</Extend> 
		 </ModifyPartition>
	</ModifyPartitions>
   </Disk>
</DiskConfiguration>
<ImageInstall>
   <OSImage>
	<InstallTo>
		 <DiskID>0</DiskID> 
		 <PartitionID>4</PartitionID> 
	</InstallTo>
   </OSImage>
</ImageInstall>

See Also