Windows: Creating an aligned GPT partition by using diskpart

To create a 1GB partition on an empty GPT disk:
C:>diskpart
Microsoft DiskPart version 5.1.3565

Copyright (C) 1999-2003 Microsoft Corporation.
On computer: NNII0280

DISKPART> Select Disk 1

Disk 1 is now the selected disk.

DISKPART> create partition primary size=1024 align=64

DiskPart succeeded in creating the specified partition.

DISKPART>
The alignment is not an absolute address (as in diskpar), but is an alignment value to be applied to the next free block on the disk. The alignment is expressed in 1 KB increments instead of blocks.

  • diskpar uses a block count and is the actual address of the partition to create.
  • diskpart creates a partition at the next available block that is a multiple of 64 KB (128 Blocks).
  • After formatting, the partition table entry appears as follows.

    You can see the address of the first four GUID partition table entries. The new partition definition starts at offset 0x0080 in this block. The offset to the user partition is 0x0000000000010080 (65664.), which is a multiple of 128 and therefore aligned for performance purposes.
    The length of the partition is 0x0000000000210021 minus 0x0000000000010080 plus 1. This value is 0x1FFFA2.
    This length is not quite the requested size. It is 0x5e (94) blocks short of the full 2 GB partition. What diskpart has done is round down the request to fit the rules for ending addresses on the boundary as shown in the preceding figure. By default, the next partition will be created at 0x0000000000210022.
    The value 0x0000000000210022 (2,162,722) divided by 1024 leaves a remainder of 34.

    Creating a second aligned GPT partition by using diskpart

    To create a second 2 GB partition:

    C:>diskpart

    Microsoft DiskPart version 5.1.3565

    Copyright (C) 1999-2003 Microsoft Corporation.
    On computer: NNII0280
    DISKPART> Select Disk 1
    Disk 1 is now the selected disk.
    DISKPART> create partition primary size=2048 align=64
    DiskPart succeeded in creating the specified partition.
    DISKPART>

    After formatting, the partition table entry contains the following:

    The second partition actually starts at 0x000000000210080 which is aligned to 128. The first partition ended at 0x0000000000210021 and there is a gap between the two partitions.

    Leave a Comment

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

    CAPTCHA * Time limit is exhausted. Please reload the CAPTCHA.

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Scroll to Top