Create BIOS-based Hard-Disk Partitions by Using Windows SIM

Applies To: Windows 7, Windows Server 2008 R2

Note

This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.

This topic discusses how to create a customized hard disk partition structure for a BIOS-based computer during Windows® Setup.

In this topic:

  • Plan Your Partition Structure

  • To prepare the hard disks

  • To create the partitions

  • To modify the partitions

  • To identify the Windows partition

  • XML Example

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 use 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 that defines which of the primary or extended partitions fills the remaining space on a hard drive: Microsoft-Windows-Setup\DiskConfiguration\Disk\CreatePartitions\CreatePartition\Extend.

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

For information about partition rules, see Understanding Disk Partitions.
  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

Default Configuration

The following diagram and XML output show Autounattend.xml Disk Configuration settings for the standard configuration: a system partition and a Windows partition.

<DiskConfiguration>

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

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

      <!-- Windows partition -->
      <CreatePartition wcm:action="add">
        <Order>2</Order> 
        <Type>Primary</Type> 
        <Extend>true</Extend> 
      </CreatePartition>

    </CreatePartitions>
    <ModifyPartitions>

      <!-- System partition -->
      <ModifyPartition wcm:action="add">
        <Order>1</Order> 
        <PartitionID>1</PartitionID> 
        <Label>System</Label> 
        <Letter>S</Letter> 
        <Format>NTFS</Format> 
        <Active>true</Active> 
      </ModifyPartition>

      <!-- Windows partition -->
      <ModifyPartition wcm:action="add">
        <Order>2</Order> 
        <PartitionID>2</PartitionID> 
        <Label>Windows</Label> 
        <Letter>C</Letter> 
        <Format>NTFS</Format> 
      </ModifyPartition>
    </ModifyPartitions>
  </Disk>


  <WillShowUI>OnError</WillShowUI> 
</DiskConfiguration>


<ImageInstall>
  <OSImage>
    <InstallTo>
      <DiskID>0</DiskID> 
      <PartitionID>2</PartitionID> 
    </InstallTo>
  </OSImage>
</ImageInstall>

Recommended Configuration: System Recovery

The following diagram and XML output show Autounattend.xml Disk Configuration settings for the recommended configuration: a system partition, a Windows partition, and a recovery image partition:

<DiskConfiguration>

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

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

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

      </CreatePartition>
    </CreatePartitions>

      <!-- Recovery image partition -->
      <CreatePartition wcm:action="add">
        <Order>1</Order> 
        <Type>Primary</Type> 
        <Size>15000</Size> 
      </CreatePartition>

    <ModifyPartitions>

      <!-- System partition -->
      <ModifyPartition wcm:action="add">
        <Order>1</Order> 
        <PartitionID>1</PartitionID> 
        <Label>System</Label> 
        <Letter>S</Letter> 
        <Format>NTFS</Format> 
        <Active>true</Active> 
      </ModifyPartition>

      <!-- Windows partition -->
      <ModifyPartition wcm:action="add">
        <Order>2</Order> 
        <PartitionID>2</PartitionID> 
        <Label>Windows</Label> 
        <Letter>C</Letter> 
        <Format>NTFS</Format> 
      </ModifyPartition>

      <!-- Recovery image partition -->
      <ModifyPartition wcm:action="add">
        <Order>3</Order> 
        <PartitionID>3</PartitionID> 
        <Label>Recovery</Label> 
        <Format>NTFS</Format> 
        <TypeID>0x27</TypeID>
      </ModifyPartition>

    </ModifyPartitions>
  </Disk>
  <WillShowUI>OnError</WillShowUI> 
</DiskConfiguration>

<ImageInstall>
  <OSImage>
    <InstallTo>
      <DiskID>0</DiskID> 
      <PartitionID>2</PartitionID> 
    </InstallTo>
  </OSImage>
</ImageInstall>

Using a Single Partition

The following diagram and XML output shows Autounattend.xml Disk Configuration settings for a system with a single Windows partition:

<DiskConfiguration>

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


      <!-- Windows partition -->
      <CreatePartition wcm:action="add">
        <Order>1</Order> 
        <Type>Primary</Type> 
        <Extend>true</Extend> 
      </CreatePartition>

    </CreatePartitions>
    <ModifyPartitions>

      <!-- Windows partition -->
      <ModifyPartition wcm:action="add">
        <Order>1</Order> 
        <PartitionID>1</PartitionID> 
        <Label>Windows</Label> 
        <Format>NTFS</Format> 
      </ModifyPartition>
    </ModifyPartitions>
  </Disk>


  <WillShowUI>OnError</WillShowUI> 
</DiskConfiguration>


<ImageInstall>
  <OSImage>
    <InstallTo>
      <DiskID>0</DiskID> 
      <PartitionID>1</PartitionID> 
    </InstallTo>
  </OSImage>
</ImageInstall>

Using More Than Four Partitions

The following diagram and XML output show Autounattend.xml Disk Configuration settings for a system with primary partitions, and an extended partition containing two logical partitions:

<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

Concepts

Understanding Disk Partitions