Sample: Configure More than Four Partitions on a BIOS/MBR-Based Hard Disk by using Windows PE and DiskPart

Applies To: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2

This topic shows how to configure disk partitions for a BIOS-Based computer, with more than four partitions, as described in the topic: 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:

Configuring Disk Partitions by Using a DiskPart Script in Windows PE

For image-based deployment, boot the computer by using Windows PE, and then use the DiskPart tool to create the partition structures on your destination computers. For more information, see Apply Images Using DISM.

Note

Windows PE reassigns disk letters alphabetically, beginning with the letter "C", without regard to the configuration in Windows Setup. This configuration can change based on the presence of different drives, including USB flash drives.
In these DiskPart examples, the partitions are assigned the letters "U", "V", "S", "W", and "R" to avoid drive-letter conflicts. After the computer reboots, Windows PE automatically assigns the letter "C" to the Windows partition. The Utility1, Utility2, system, and recovery image partitions do not receive drive letters.

The following steps describe how to partition your hard drives and prepare to apply images. You can use the code in the sections that follow to complete these steps.

To partition hard drives and prepare to apply images

  1. Save the code in the following sections as a text file (PrepareMyPartitions.txt) on a USB flash drive.

  2. Use Windows PE to boot the destination computer.

  3. Use the DiskPart /s F:\PrepareMyPartitions.txt command, where F: is the letter of the USB flash drive, to partition the drives.

Sample code

Save the following code as "PrepareMyPartitions.txt", and then run the script by using the DiskPart tool to automate the configuration of the Utility1, Utility2, system, extended, Windows, and recovery image partitions:

select disk 0
clean
create partition primary size=100
format quick fs=ntfs label="Utility1"
assign letter="U"
set id=27
create partition primary size=200
format quick fs=ntfs label="Utility2"
assign letter="V"
set id=27
create partition primary size=100
format quick fs=ntfs label="System"
assign letter="S"
active
create partition extended
create partition logical size=75000
format quick fs=ntfs label="Windows"
assign letter="W"
create partition logical
format quick fs=ntfs label="Recovery image"
assign letter="R"
set id=27
exit

Next Steps

After you create the partitions, you can use a deployment script to apply the Windows images on the newly created partitions. For more information, see Samples: Applying Windows, System, and Recovery Partitions by using a Deployment Script.

See Also

Tasks

Sample: Configure More than Four Partitions on a BIOS/MBR-Based Hard Disk by using Windows Setup
Sample: Configure BIOS/MBR-Based Hard Disk Partitions by Using Windows PE and DiskPart
Samples: Applying Windows, System, and Recovery Partitions by using a Deployment Script

Concepts

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