Dela via


Configure Multiple Hard Drives

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

If you are deploying Windows to a computer that has multiple hard drives, you can verify that the image is applied to a specific hard drive by using hardware-specific identifiers such as the location path or the hardware interrupt value.

The location path is a string that specifies the physical location that each drive is connected to the computer, for example: PCIROOT(0)#PCI(0100)#ATA(C00T00L00). When manufacturing a computer, use a consistent physical location when connecting your drives, and then use the location path string to identify each hard drive.

For BIOS-based computers or a computer that is running Virtual Disk Service (VDS), you can use the SELECT DISK=SYSTEM and SELECT DISK=NEXT commands to select the appropriate hard drive.

In this topic:

  • Identifying a Disk Location Path

  • Selecting the System Drive

  • Selecting Non-System Drives

  • Identifying the System Drive After a Reboot

  • Formatting Non-System Drives

Identifying a Disk Location Path

  • Use the DiskPart commands: list disk and select disk <disk number> (Example: select disk 1) to navigate between the drives on your computer.

    To show the location path of a selected drive, use the DiskPart command detail disk.

    In the following example, the location path of the selected drive is PCIROOT(0)#PCI(0100)#ATA(C00T00L00).

    DISKPART> detail disk
    
    HITACHI HTS722016K9SA00
    Disk ID: 5E27161A
    Type   : ATA
    Bus    : 0
    Target : 0
    LUN ID : 0
    Location Path : PCIROOT(0)#PCI(0100)#ATA(C00T00L00)
    Read-only  : No
    Boot Disk  : Yes
    PagefileDisk  : Yes
    Hibernation File Disk  : No
    CrashdumpDisk  : Yes
    Clustered Disk  : No
    
    
      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 1     C                NTFS   Partition    149 GB  Healthy    System
    
    DISKPART>
    

Selecting Drives

Selecting the System Drive

  • BIOS-based computers: Use the command SELECT DISK=SYSTEM to select the default system drive.

    This command selects the drive that has an interrupt 13h value of 80h. If the value 80h is assigned to a USB flash drive, this command selects a hard drive that has a value of 81h. For more information, visit the following Microsoft Developer Network (MSDN) website:

    Converting Drive Letters to MS-DOS INT 13H Disk Drive Numbers

  • UEFI-based computers: To select a drive, use the DiskPart command SELECT DISK=<location path>.

Note

Do not use the SELECT DISK=SYSTEM command or the GetSystemDiskNTPath API on Unified Extensible Firmware Interface (UEFI)-based computers to select the system drive. The SELECT DISK=SYSTEM command and the GetSystemDiskNTPath API identify the drive that the operating system was booted from as the system drive. If you boot from Windows® PE, this command selects the Windows PE drive as the system drive. If you boot from a system that has multiple drives that include an EFI system partition (ESP), this command may select the wrong drive.

Selecting Non-System Drives

  • Select the drive by location path. To select a drive, use the DiskPart command SELECT DISK=<location path>, where <location path> is the location path of your drive. This command helps specify a drive by location.

    Example:

    SELECT DISK=PCIROOT(0)#PCI(0100)#ATA(C00T00L00)
    
  • Select the drive by using the "NEXT" drive. Use the DiskPart command SELECT DISK=NEXT. This command helps specify any remaining hard drives, regardless of location. To select more drives, repeat the SELECT DISK=NEXT command to select each drive in order. If there are no more drives to select, DiskPart returns an error.

Note

The computer maintains the context for the SELECT DISK=NEXT command as long as DiskPart continues running. If DISKPART exits, the computer loses this context.

UEFI-based example:

    SELECT DISK=PCIROOT(0)#PCI(0100)#ATA(C00T00L00)
    clean
    convert gpt
    create partition primary size=300
    format quick fs=ntfs label="Windows RE Tools"
    set id=27
    assign letter=t
    create partition primary size=100
    format quick fs=ntfs label="System"
    assign letter=s
    active
    create partition msr size=128
    create partition primary
    shrink minimum=15000
    format quick fs=ntfs label="Windows"
    assign letter=w
    format quick fs=ntfs label="Recovery image"
    attributes volume set nodefaultdriveletter
    assign letter="R"
    SELECT DISK=NEXT
    clean
    convert gpt
    create partition msr size=128
    create partition primary
    format quick fs=ntfs label="Data"
    assign letter=z

Identifying the System Drive After a Reboot

After you reboot, drive lettering may change. You can use the following example script to select the system drive and then reassign letters 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=t
select partition=3
assign letter=w

Formatting Non-System Drives

This example script selects the system drive and then skips past the drive without modifying the contents of the drive. The script then selects two non-system drives and creates a single, formatted, empty partition on each drive. The partitions do not receive an image, so it is not necessary to specifically identify them.

UEFI-based example:

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

See Also

Concepts

Hard Disk Location Path Format

Other Resources

DiskPart Command line syntax