Manage Multiple UEFI-based Hard Disks

If you are deploying Windows to a computer with multiple hard disks, you can use the diskpart tool to make sure your images are applied to the intended disks.

Note

The system disk does not necessarily appear as disk 0 in the diskpart tool. The system may assign different numbers to disks when you reboot, and different computers with the same disk configuration can have different disk numbers.

To select a disk, use the diskpart command SELECT DISK=<location path>. For more information about location paths, see Understanding Disk Location Paths. This command selects different disks based on what kind of computer you are using. For more information about diskpart, see Diskpart Command-line Syntax.

Note

To prevent inconsistent disk selection, do not use the SELECT DISK=SYSTEM command on UEFI-based computers to select the system disk. The SELECT DISK=SYSTEM command selects the disk that the operating system was booted from as the system disk. If you boot from Windows PE, this command selects the Windows PE disk is the system disk. If you boot from a system with multiple disks that include an EFI system partition (ESP), this command may select the wrong disk.

Example: Preparing a System Disk

This example diskpart script identifies a predetermined system disk and creates four partitions: an ESP, a Microsoft Reserved partition (MSR), a recovery partition, and a Windows partition. For more information about diskpart, see Diskpart Command line syntax.

Warning

The primary Windows disk is assigned the letter "W" to avoid potential disk-letter conflicts. After rebooting, this disk is assigned the letter "C".

Identifying Nonsystem Disks

If you are installing two or more unique nonsystem disks, use the diskpart command SELECT DISK=<location path> to identify each disk. For more information on using this command, see Understanding Disk Location Paths.

If you have only one other disk, or if you are imaging all of the secondary disks in the same way, use the diskpart command SELECT DISK=NEXT to select nonsystem disks.

Use the SELECT DISK=SYSTEM command described earlier in this topic to identify the system disk.

Use the SELECT DISK=NEXT command to select the next disk.

To select more disks, repeat the SELECT DISK=NEXT command to select each disk in order. If there are no more disks to select, diskpart returns an error.

Note

The context for SELECT DISK=NEXT is maintained as long as DISKPART continues running. If DISKPART exits, this context is lost.

Example: Formatting Nonsystem Disks

This example script selects the system disk and then skips past it without modifying its contents. It then selects two nonsystem disks and creates a single, formatted, empty partition on each. The partitions do not receive an image, so it is not necessary to specifically identify them.