Skip to content

Using Sysprep to Extend Disk Partitions

Just found out that there is a command – ExtendOEMPartition – in sysprep that will allow you to expand NTFS disk partitions. From the Microsoft site:
Using Sysprep to Extend Disk PartitionsWhen installing Windows XP Professional, you might find it necessary to extend the partition of the destination computer. You can use Sysprep with the appropriate entries in the answer file to extend an NTFS partition. You might want to extend an NTFS partition for the following reasons:

  • To create images that can be extended into larger disk partitions and take advantage of hard disks that might have greater capacity than the original hard disk on the reference computer.
  • To create images on smaller hard disks.

Review the following steps and choose the method that works best for you, based on the third-party tools that you are using to create an image of the operating system.

Caution

  • Make sure that you do not accidentally delete the Setupapi.log and Hyberfil.sys files (if applicable) when modifying the image. These files are recreated when the MiniSetup Wizard runs on the destination computer. Deleting these files on an active system can cause the system to function improperly.

When used in an answer file, the ExtendOemPartition key causes Setup to extend the destination partition into any available unpartitioned space that physically follows it on the hard disk.

The values for ExtendOemPartition are 0, 1, and extra size in MB

where:

  • 0 Setup does not extend the partition.
  • 1 Setup extends the partition to fill out the hard disk.
  • extra size in MB Setup increases the current partition size by this amount.

ExtendOemPartition automatically leaves the last cylinder on the hard disk free to allow dynamic disk support. ExtendOemPartition can be set to a number other than 1 to indicate a specific disk size for extending the hard disk. This is useful if more than one partition is requested on a computer.

Important

  • Only NTFS partitions can be extended. If the destination partition you plan to extend is FAT or FAT32, run convert.exe /fs:ntfs from the command line before running Sysprep. The file system is converted when the image is applied to the destination computer before the MiniSetup Wizard starts. Setup does not extend FAT16 and FAT32 partitions.
  • ExtendOemPartition can be used with both the Unattend.txt and Sysprep.inf Setup files.
  • When used in Sysprep.inf for imaged computers, the destination computer’s hard disk must be the same size or larger than the reference computer’s hard disk.
  • To enable the extension, the partition to be extended must have contiguous unpartitioned space available.

To extend a hard disk partition when using a third-party disk-imaging product or a hardware-imaging device that supports the version of NTFS that is used by Windows XP Professional

  1. Create a partition on the reference computer hard disk that is just large enough to install Windows XP Professional with all the components and applications that you intend to add. This helps keep the size of the reference image file to a minimum.
  2. If the destination partition you plan to extend is FAT or FAT32, run convert.exe /fs:ntfs from the command line before running Sysprep. The file system is converted when the image is applied to the destination computer before the MiniSetup Wizard starts.
  3. Note

    • ConvertNTFS does not work in Sysprep.inf because this is a text mode-only function and Sysprep does not go through text mode.
  4. In the [Unattended] section of Sysprep.inf, include the statement:
  5. ExtendOemPartition = 1
    

    You can also set the additional size in megabytes to extend the partition.

  6. Install Windows XP Professional on the reference computer. Sysprep shuts down the system automatically.
  7. Generate the image.
  8. Place the image on the destination computer where the destination computer has the same size system partition as the reference computer.
  9. Restart the destination computer.
  10. When you place the reference image on a destination computer, drive C is converted to NTFS when the computer starts. The computer then restarts and starts MiniSetup. During MiniSetup, Windows extends drive C to the rest of the unpartitioned space on the hard disk. The destination computer then restarts, and the end user can log on and begin using Windows XP Professional.

    The MiniSetup Wizard starts and the partition is extended.

To extend a hard disk partition when using a disk-imaging product that does not support NTFS used by Windows XP Professional

  1. In the [Unattended] section of Sysprep.inf, include the statement:
    ExtendOemPartition = 1
    

    Or additional size in megabytes to extend the partition.

  2. Use Cmdlines.txt to convert short file names.
  3. Run Sysprep.

The following actions occur when you restart the destination computer:

  • The computer initially starts in conversion mode to convert the system partition on the destination computer to NTFS.
  • The computer automatically restarts.
  • The MiniSetup Wizard starts, and the partition is extended almost instantaneously.

Leave a Reply

Your email address will not be published. Required fields are marked *