Share via


Configuring a Hard Drive with Diskpart and Windows PE

To configure your target device's hard disk for deployment, you can use the Diskpart command-line utility, which manages your hard disks. It is used to add, edit, or remove partitions on your hard drive.

Note   You should back up any data on the disk before using Diskpart because the utility reconfigures hard drive partitions.

Diskpart can be used to configure a device that does not have an operating system (OS), and is included with the Windows Pre-Installation Environment (Windows PE). After booting Windows PE, you can configure the hard disks on your system. For more information, see Windows Preinstallation Environment.

Note   Do not use Diskpart to configure a CompactFlash device. Because of the way Windows XP reports disk geometry on CompactFlash devices, repartitioning your CompactFlash device may render it inoperable. Contact your CompactFlash manufacturer for assistance repartitioning the device.

Diskpart is also available as a component (Disk Management Command Line Utility), which can be added to a run-time image. The Disk Management Command Line Utility requires the following additional components:

  • Disk Management Services
  • Disk Management Basic Volume Runtime
  • Disk Management Dynamic Volume Runtime

Additional information about using Diskpart is available at this Microsoft Web site.

**Note   **Windows PE is on Windows XP Embedded CD-ROM Disc 1, or a separate Windows PE disc, depending on whether you have the Full Price Product or the Upgrade Product.

To use Diskpart to configure a hard drive

  1. Boot Windows PE or your run-time image on the device.

  2. At the command prompt, type diskpart. The Diskpart command prompt is displayed.

  3. Type ? to display the Diskpart help.

  4. Use the Diskpart commands to list the current configurations, select a disk, and edit a partition. For example, to create a 400 MB primary partition on the second disk in your system, use the following Diskpart commands:

    list disk
    select disk 1
    list partition
    create partition primary size=400
    
  5. After configuring the hard disk, stop the utility by typing exit.

  6. Reboot the system.

  7. Format any newly created partitions with the format command.

Note   The Diskpart utility includes an override option, which can be used to delete a Microsoft Reserved (MSR) partition or other protected partition. Use extreme caution when using the override option.

You can also create a script for Diskpart with the commands needed to deploy mass systems. By booting Windows PE and bringing the device up on the network, you can run a Diskpart script with the following command:

diskpart /s <script name>

For more information, see Connecting a Device to a Network with Windows PE.

See Also

Windows Preinstallation Environment

© 2006 Microsoft Corporation. All rights reserved.