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 BIOS-based systems. For information about Unified Extensible Firmware Interface (UEFI)-based systems, see Manage Multiple UEFI-based Hard Disks.

In This Topic

Identifying a System Disk

  1. Start the destination computer by using Windows PE.

  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=SYSTEM. This command selects different disks based on what kind of computer you are using. For more information about diskpart, see Diskpart Command-line Syntax.

    On a BIOS-based computer, this command selects the disk with an interrupt 13h value of 80h. If the value 80h is assigned to a USB flash drive, this command selects a hard disk with a value of 81h. For more information, see the MSDN topic Converting Drive Letters to MS-DOS INT 13H Disk Drive Numbers.

    Note:

    If you specify a location path that is not assigned to a disk, the command fails and unselects any previously selected disks.

Example: Preparing a System Disk

This example diskpart script selects the predetermined system disk and creates three partitions: a system partition, 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=SYSTEM
clean
create partition primary size=300
format quick fs=ntfs label="System"
assign letter=s
active
create partition primary
format quick fs=ntfs label="Recovery"
set id=27
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 system, recovery, and Windows partitions.

SELECT DISK=SYSTEM
select partition=1
assign letter=s
select partition=2
assign letter=r
select partition=3
assign letter=w

Identifying Nonsystem Disks

To identify 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 the order of the secondary disks does not matter, 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=SYSTEM
SELECT DISK=NEXT
clean
create partition primary
format quick fs=ntfs label="DataDrive1"
assign letter=j
select disk=next
clean
create partition primary
format quick fs=ntfs label="DataDrive2"
assign letter=k

See Also