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.

This topic is about identifying disks on UEFI-based computers. For information about BIOS-based or VDS-based computers, see Manage Multiple BIOS-based Hard Disks.

In This Topic

Prerequisites

To uniquely identify UEFI disks, you must know the location path of each disk. For more information, see Understanding Disk Location Paths.

Identifying a System Disk

  1. Start the destination computer by using Windows PE.

    Important:

    For UEFI-based computers, you must start Windows PE by using the EFI boot-mode option in the EFI shell. For more information, see your EFI firmware documentation.

  2. At the Windows PE command prompt, type diskpart to start the DiskPart tool.

    X:> diskpart
    DISKPART>
    
  3. 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.

Caution:

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

SELECT DISK=PCIROOT(0)#PCI(0100)#ATA(C01T01L00)
clean
convert gpt
create partition primary size=100
format quick fs=fat32 label="System"
assign letter=s
create partition msr size=128
create partition primary
format quick fs=ntfs label="Recovery"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
assign letter=r
create partition primary
format quick fs=ntfs label="Windows"
assign letter=w

Example: Identifying the System Disk After a Reboot

After you reboot, disk lettering may change. You can use the following example script to select the system disk and then reassign letters back to the ESP, recovery, and Windows partitions.

SELECT DISK=PCIROOT(0)#PCI(0100)#ATA(C01T01L00)
select partition=1
assign letter="s"
select partition=2
assign letter="r"
select partition=3
assign letter="w"

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.

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

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

  3. 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.

SELECT DISK=PCIROOT(0)#PCI(0100)#ATA(C01T01L00)
SELECT DISK=NEXT
clean
create partition primary
format quick fs=ntfs label="DataDrive1"
SELECT DISK=NEXT
clean
create partition primary
format quick fs=ntfs label="DataDrive2"

See Also