Sample: Configure More than Four Partitions on a BIOS/MBR-Based Hard Disk 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 shows how to configure disk partitions for a BIOS-based computer that has more than four partitions, as described in Configure More than Four Partitions on a BIOS/MBR-Based Hard Disk.

This sample configuration includes three primary partitions and an extended partition. The primary partitions include two utility partitions and a system partition. The extended partition includes two logical partitions. These include the Windows partition and a recovery image partition. The following diagram shows this configuration:

To extend the last logical partition in an extended partition by Using Windows Setup

To create a logical partition that uses the rest of the extended partition through Windows Setup, create a partition that has an initial fixed size, and then modify the partition. For example, set CreatePartition: Size=100, and then set ModifyPartition: Extend=true.

Microsoft-Windows-Setup\DiskConfiguration\Disk

DiskID = 0
WillWipeDisk = true

Microsoft-Windows-Setup\DiskConfiguration\Disk\
CreatePartitions\CreatePartition

Order = 1
Size = Size of Utility1 in megabytes; for example, 100
Type = Primary

Microsoft-Windows-Setup\DiskConfiguration\Disk\
CreatePartitions\CreatePartition

Order = 2
Size = Size of Utility2 in megabytes; for example, 200
Type = Primary

Microsoft-Windows-Setup\DiskConfiguration\Disk\
CreatePartitions\CreatePartition

Order = 3
Size = 350
Type = Primary

Microsoft-Windows-Setup\DiskConfiguration\Disk\
CreatePartitions\CreatePartition

Extend = true
Order = 4
Type = Extended

Microsoft-Windows-Setup\DiskConfiguration\Disk\
CreatePartitions\CreatePartition

Order = 5
Size = 75000
Type = Logical

Microsoft-Windows-Setup\DiskConfiguration\Disk\
CreatePartitions\CreatePartition

Order = 6
Size = 100 (this will be changed in the ModifyPartition section)
Type = Logical

Microsoft-Windows-Setup\DiskConfiguration\Disk\
ModifyPartitions\ModifyPartition

Format = NTFS
Label = Utility1
Order = 1
PartitionID = 1
TypeID = 0x27

Microsoft-Windows-Setup\DiskConfiguration\Disk\
ModifyPartitions\ModifyPartition

Format = NTFS
Label = Utility2
Order = 2
PartitionID = 2
TypeID = 0x27

Microsoft-Windows-Setup\DiskConfiguration\Disk\
ModifyPartitions\ModifyPartition

Active = true
Format = NTFS
Label = System
Order = 3
PartitionID = 3

Microsoft-Windows-Setup\DiskConfiguration\Disk\
ModifyPartitions\ModifyPartition

Format = NTFS
Label = Windows
Order = 4
PartitionID = 4

Microsoft-Windows-Setup\DiskConfiguration\Disk\
ModifyPartitions\ModifyPartition

Format = NTFS
Extend = true (this overrides the CreatePartition:Size value)
Label = Recovery image
Order = 5
PartitionID = 5

Microsoft-Windows-Setup\ImageInstall\OSImage\InstallTo

DiskID = 0
PartitionID = 4
TypeID = 0x27

XML example:

<DiskConfiguration>

  <Disk wcm:action="add">
    <DiskID>0</DiskID> 
    <WillWipeDisk>true</WillWipeDisk> 
    <CreatePartitions>

      <!-- Utility1 partition -->
      <CreatePartition wcm:action="add">
        <Order>1</Order> 
        <Type>Primary</Type> 
        <Size>350</Size> 
      </CreatePartition>

      <!-- Utility2 partition -->
      <CreatePartition wcm:action="add">
        <Order>2</Order> 
        <Type>Primary</Type> 
        <Size>200</Size> 
      </CreatePartition>

      <!-- System partition -->
      <CreatePartition wcm:action="add">
        <Order>3</Order> 
        <Type>Primary</Type> 
        <Size>350</Size> 
      </CreatePartition>

      <!-- Extended partition -->
      <CreatePartition wcm:action="add">
        <Order>4</Order> 
        <Type>Extended</Type> 
        <Extend>true</Extend> 
      </CreatePartition>

      <!-- Windows partition -->
      <CreatePartition wcm:action="add">
        <Order>5</Order> 
        <Type>Logical</Type> 
        <Size>75000</Size> 
      </CreatePartition>

      <!-- Recovery image partition -->
      <CreatePartition wcm:action="add">
        <Order>6</Order> 
        <Type>Logical</Type> 
        <Size>100</Size> 
          <!-- Note: To create a logical partition that fills 
                     the rest of the extended partition, create the 
                     data partition so that it has an initial size of 100.
                     This will be changed in the ModifyPartition section. -->
      </CreatePartition>

    </CreatePartitions>
    <ModifyPartitions>

      <!-- Recovery partition -->
      <ModifyPartition wcm:action="add">
        <Order>1</Order> 
        <PartitionID>1</PartitionID> 
        <Label>Utility1</Label> 

        <Format>NTFS</Format> 
        <TypeID>0x27</TypeID>
      </ModifyPartition>

      <!-- Utility partition -->
      <ModifyPartition wcm:action="add">
        <Order>2</Order> 
        <PartitionID>2</PartitionID> 
        <Label>Utility2</Label> 

        <Format>NTFS</Format> 
        <TypeID>0x27</TypeID>
      </ModifyPartition>

      <!-- System partition -->
      <ModifyPartition wcm:action="add">
        <Order>3</Order> 
        <PartitionID>3</PartitionID> 
        <Label>System</Label>

        <Format>NTFS</Format> 
        <Active>true</Active> 
      </ModifyPartition>

      <!-- Extended partition:
           This partition does not need to receive a partition number. 
           It also does not need to be modified. -->

      <!-- Windows partition -->
      <ModifyPartition wcm:action="add">
        <Order>4</Order>
        <PartitionID>4</PartitionID> 
        <Label>Windows</Label> 

        <Format>NTFS</Format> 
      </ModifyPartition>

      <!-- Recovery image partition -->
      <ModifyPartition wcm:action="add">
        <Order>5</Order> 
        <PartitionID>5</PartitionID> 
        <Label>Recovery image</Label> 

        <Format>NTFS</Format> 
        <Extend>true</Extend>
          <!-- Note: When you modify a logical partition, setting
                     "ModifyPartition|Extend=true" sets the partition to  
                     fill the remainder of the extended partition.
                     This overrides the "CreatePartition|Size" value. -->
        <TypeID>0x27</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 More than Four Partitions on a BIOS/MBR-Based Hard Disk by using Windows PE and DiskPart
Sample: Configure BIOS/MBR-Based Hard Drive Partitions by Using Windows Setup

Concepts

Configure More than Four Partitions on a BIOS/MBR-Based Hard Disk