M100818: Hard disk preparation before Windows deployment

Summary

You may need to prepare the hard drive of a computer on which an unattended installation is to be performed, or on which an image is to be applied. This article describes the necessary preparation and how to perform it.

Before an image is applied or an unattended installation is started on a computer using the ManageSoft Windows Deployment imaging agent, the hard disk may require preparation. Preparation includes partitioning and formatting the hard disk, or removing an existing operating system or files.

You can perform the necessary disk preparation using the Microsoft diskpart utility, or an alternative tool of your choice.

Using diskpart

Before starting to apply an image, the ManageSoft imaging agent runs the Microsoft disk-part utility in the WinPE environment. Disk-part is run using a script found at:
X:\Windows\Temp\ManageSoft\Prework\OSDriveConfig.txt

This script:

  • Clears existing partitions from disk 0
  • Creates a single new partition covering the entire disk
  • Formats the partition using NTFS.

Following this, a batch file is run to perform post-drive configuration. The batch file is located at:
X:\Windows\Temp\ManageSoft\Prework\PostOSDriveConfig.cmd

If you want to customize these scripts, mount the bootable WIM image from the OS image library and edit the files.

The diskpart script offers flexibility in disk preparation. Refer to the diskpart help for details about supported commands.

Example 1

To create a 30 GB operating system partition, with the remaining hard disk space assigned as a data partition, use the following OSDriveConfig.txt:

 rem --- Select disk 0 and delete partitions select disk 0 clean rem --- Create 30 GB OS drive partition create partition primary align=16065 size=32000 active format FS=NTFS OVERRIDE QUICK rem --- Create data partition create partition primary format FS=NTFS OVERRIDE QUICK LABEL="Data" exit 

Note that the partitions are quick-formatted using NTFS, and the operating system partition is aligned to the 16065 kilobyte boundary for Windows 2000 compatibility.

Example 2

This simple script formats a single drive in preparation for an new operating system, allowing an existing partition structure to remain intact and data on partitions other than the first to remain safe.

 rem --- Select disk 0, partition 1 and format select disk 0 select partition 1 format FS=NTFS OVERRIDE QUICK exit 

Preventing disk preparation

If you want to install images on to existing drives, or use a disk preparation tool other than diskpart, create an empty OSDriveConfig.txt file.

Using other tools

You can use alternative tools to prepare the disk. For example:

  • A Windows Vista unattended installation is capable of partitioning and formatting the hard disk through the Autounattend.xml file.
  • The PostOSDriveConfig.cmd batch file can be used to run other drive preparation utilities. One application of the PostOSDriveConfig.cmd would be to recursively remove files from a drive or directory.

Known problems

There is a known issue with disk preparation on machines with more than one SATA hard disk. The order in which the drives are enumerated is not guaranteed. There is a Microsoft KB article, http://support.microsoft.com/kb/937251, which documents this issue for Windows Vista. Since Windows PE is derived from Vista, it too exhibits the flaw. Take care when selecting the disk to be prepared on computers with multiple SATA drives.

Comments

Powered by Zendesk