Partitioning a GPT disk in WinPE using a Diskpart script to prepare for image or OS deployment
search cancel

Partitioning a GPT disk in WinPE using a Diskpart script to prepare for image or OS deployment

book

Article ID: 367922

calendar_today

Updated On:

Products

Deployment Solution

Issue/Introduction

Deployment Solution offers a built in task for partitioning a disk for imaging. However, in some scenarios it may be preferred to create an EFI system partition which is larger than 100 MB. The built in 'Partition Disk' task creates EFI system partition as 100 MB by default and doesn't allow for custom sizing.

Environment

Deployment Solution 8.x

Cause

'Partition Disk' built in task limitation

Resolution

Disk partitioning for Windows imaging or OS deployment can be performed in WinPE with a 'Run Script' task using Diskpart as an alternative to using the built in 'Partition Disk' task*

*Custom run script tasks should be modified and used at your own risk. The following script is given as an example and should only be used with a clear understanding of how it works. The script will remove any pre-existing data on a disk which will result in permanent data loss. It is important to back-up any needed data on the disk prior to running the script. Broadcom Technical Support does not assist with creating or modifying custom scripts.

'Run Script' disk partitioning with Diskpart example (run in WinPE pre-boot environment only):

rem ==Wipe drive and convert to GPT ======================
echo select disk 0 >> x:\diskpart.txt

echo clean >> x:\diskpart.txt

echo convert gpt >> x:\diskpart.txt

 

rem ==System partition ==================================

echo create partition efi size=100 >> x:\diskpart.txt

rem ** NOTE: For Advanced Format 4K drives, change this value to size = 260 **

echo format quick fs=fat32 label="System" >> x:\diskpart.txt

echo assign letter="S" >> x:\diskpart.txt

rem ==Microsoft Reserved (MSR) partition ===================

echo create partition msr size=16 >> x:\diskpart.txt

 

rem ==Create the Windows partition ========================

echo create partition primary >> x:\diskpart.txt

echo shrink minimum=650 >> x:\diskpart.txt
echo format quick fs=ntfs label="Windows" >> x:\diskpart.txt

echo assign letter="W" >> x:\diskpart.txt

rem ==Recovery tools partition =============================

echo create partition primary >> x:\diskpart.txt

echo format quick fs=ntfs label="Recovery tools" >> x:\diskpart.txt

echo assign letter="R" >> x:\diskpart.txt

echo set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" >> x:\diskpart.txt

echo gpt attributes=0x8000000000000001 >> x:\diskpart.txt

echo exit >> x:\diskpart.txt


rem ==Run the script with supplied echo commands============

diskpart /s x:\diskpart.txt


The first section of the script containing 'Wipe drive and convert to GPT' can be substituted with the built in 'Erase Disk' task 

Lines in the script starting with 'rem' are remarks that explain commands below

Lines starting with 'echo' can be adjusted for size to suit specific partition requirements

The script should be run in WinPE prior to deploying an image or installing Windows