Windows Enterprise Desktop

Jun 16 2017   10:51AM GMT

Partition UEFI/GPT HDD Using Diskpart

Ed Tittel Ed Tittel Profile: Ed Tittel

Tags:
Disk partitioning
System Partition
Windows 10
Windows installation
windows installer

The most common way to set up a hard disk for Windows installation is by default. That is, users present the installer with a clean or wiped disk drive, and let the Windows Installer take things from there. While this works perfectly well, this comes with certain consequences. In this guest blog post from Kari the Finn,  he describes a series of diskpart commands one can enter while booted into the Windows Recovery Environment to do the job manually. These commands show how to partition UEFI/GPT HDD using Diskpart. For those smart or informed enough to understand that the Recovery Partition works best as the final partition on a boot/system drive, this technique lets them set things up “properly.” The rest of this post is straight from Kari himself. Here goes:

How to Partition UEFI/GPT HDD Using Diskpart

Let’s do this once manually to see how it works in this blog post. In the next post that follows this one, we’ll collect all these commands into a script so it can run in a single step.

To start, boot the target PC from your install media. Instead of selecting region and keyboard layout, press SHIFT + F10 to open Command Prompt. Type diskpart and press Enter to start Disk Partitioning Utility.

First, you need to select the correct disk (that’s Disk 0 in my case). Type the following commands one at a time, pressing Enter after each of them (three commands):

select disk 0
clean
convert gpt

OK, now let’s create partition 1, the 100 MB EFI System partition, format it using the FAT32 file system and label it as System (in two commands):

create partition efi size=100
format quick fs=fat32 label=”System”

The hidden 16 MB MSR partition comes next. It will neither be formatted nor will it get a label:

create partition msr size=16

Next comes the Windows partition, the proverbial C: drive. Because we want all available space on Disk 0 to be used for this partition, we do not use the size=XXX option at the end of the create partition command. Instead, we create this partition using all available free space, then shrink it by 450 MB, which is the recommended size for the Windows 10 WinRE (recovery) partition. We format this partition using NTFS and label it as Windows, where this partition’s type is Primary. No drive letter need be assigned: Windows setup assigns C: to this partition automatically (two commands):

create partition primary shrink minimum=450
format quick fs=ntfs label=”Windows”

Last but not least comes the recovery partition. It must be an NTFS formatted primary partition, it should have a specific label, and it requires a specific ID. Because no size=xxx option is used, it consumes all available disk space. Because of the setup for the Windows partition in the preceding step, this is 450 MB. (That’s what we took away from C: partition using the shrink minimum=450 item; three commands follow.)

create partition primary
format quick fs=ntfs label=”WinRE”
set id=”de94bba4-06d1-4d40-a16a-bfd50179d6ac”

That’s it! Now, the boot/system disk is configured just the way we like it. Type Exit to quit DISKPART, then close the Command Prompt. You are now free to continue installing Windows. When you get to disk configuration screen you will see that the boot/system drive is partitioned exactly as we wanted it:

Partition UEFI/GPT HDD Using Diskpart

The sequence of Diskpart commands shown in this post creates this disk layout captured running the Windows Installer in a VM.

In the next blog post, we’ll show how to automate this process as a script you can run during the install process. Stay tuned!

2  Comments on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.
  • KariFinn
    One thing that I seem to have forgotten from original post: be careful with DISKPART > SELECT DISK X >  CLEAN command!

    CLEAN will wipe the selected disk. It does not ask you to confirm the action, it simply does what's told wiping the disk empty. Even some experienced users and admins overconfidently think that first HDD (DISK 0) is always the system disk where Windows is installed, that cleaning DISK 0 will remove the old OS and make system disk completely unallocated.

    Just to give an example, I have one laptop that when booted from USB sees it as DISK0 and the OS HDD as DISK1. Selecting DISK 0 in this case and cleaning it wipes the USB drive, not the disk I intended to clean.

    Although adding a command and a few seconds to workflow, it's always a good idea to check this. Run DISKPART, then LIST DISK to see which disk is what, and first then run rest of DISKPART commands told to be sure that correct disk will be selected and cleaned.
    40 pointsBadges:
    report
  • dommer2000
    Your command  - 
    create partition primary
    format quick fs=ntfs label=”WinRE”
    set id=”de94bba4-06d1-4d40-a16a-bfd50179d6ac”

    Can you explain the significance of the id - does it have to be that id, or can it be anything? 

    Thanks!
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: