aligning gpt basic and dynamic disks

12
1 Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note P/N 300-004-075 A01 August, 2006 This technical note describes how to align partitions on GUID Partition Table (GPT) disks for a Microsoft Windows 2003 platform. The following topics are covered: Introduction ................................................................................................ 2 Windows 2003 GPT disk layout ............................................................... 3 How partitions are created on a GPT disk ............................................. 6 Creating an aligned GPT partition by using diskpart........................... 7 Creating a second aligned GPT partition by using diskpart................ 9 Aligning GPT dynamic volumes ........................................................... 11

Upload: fluffy-bunnies

Post on 13-Oct-2014

111 views

Category:

Documents


13 download

TRANSCRIPT

Page 1: Aligning GPT Basic and Dynamic Disks

1

Aligning GPT Basic and Dynamic Disks

For Microsoft Windows 2003

Technical Note P/N 300-004-075

A01 August, 2006

This technical note describes how to align partitions on GUID Partition Table (GPT) disks for a Microsoft Windows 2003 platform.

The following topics are covered:

Introduction ................................................................................................ 2 Windows 2003 GPT disk layout............................................................... 3 How partitions are created on a GPT disk ............................................. 6 Creating an aligned GPT partition by using diskpart........................... 7 Creating a second aligned GPT partition by using diskpart................ 9 Aligning GPT dynamic volumes ........................................................... 11

Page 2: Aligning GPT Basic and Dynamic Disks

2

Introduction

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

Introduction

Microsoft Windows 2003 introduced a new type of disk layout called GUID Partition Table (GPT) disks. This layout is designed to overcome some problems and deficiencies associated with the traditional master boot record (MBR) style disks. The advantages of GPT disks include:

Partition size that can be up to 18 exabytes. A GPT disk can contain up to 128 partitions. Integrity of primary and backup partition tables that allows

redundancy. Partition format that is well defined, fully self-identifying and

accommodates future expansion with version number and size fields.

Unique ID for each partition that prevents partition identifier collision.

Initially, only the IA64 (Itanium) version of Windows 2003 supported GPT disks. An IA64 system cannot boot unless the boot disk is a GPT disk. With Service Pack 1, support was added to 32-bit versions of Windows 2003, but a GPT disk is still not supported as the boot disk.

Note: The next version of Windows (currently called Longhorn or Vista) is planned to have boot-from-GPT support for 32-bit processors.

This technical note applies only to Windows 2003 platforms. The United Extended Firmware Interface (UEFI) standard is a platform-neutral standard and any vendor can enforce restrictions that they see fit. For example, Windows GPT disks will always require a Microsoft Reserved (MSR) partition, but GPT disks created with Linux may not require it.

GPT disks can have aligned partitions, but only if diskpart is used to create the partitions. Like MBR style disks, GPT disks can be either basic or dynamic.

One of the important characteristics of GPT disks is that all the system areas are protected by CRC checksums, so it is virtually impossible to manipulate disks without the vendor-supplied tools. Currently for Windows, this means that only the following tools can be used:

diskpart.exe diskmgmt.msc (the console GUI) diskpart.efi (the standalone version of diskpart that can be booted

from an EFI partition)

Page 3: Aligning GPT Basic and Dynamic Disks

3

Windows 2003 GPT disk layout

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

Windows 2003 GPT disk layout

The only way to create a basic GPT disk is to convert an existing empty MBR disk. There can be no partitions or data on the disk. The Microsoft tools to convert the disk will not function if there are existing partitions.

Once you have created a GPT disk, the layout is as follows:

Page 4: Aligning GPT Basic and Dynamic Disks

4

Windows 2003 GPT disk layout

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

LBA 0 – Protective master boot record

The protective master boot record (MBR) provides downward compatibility so that systems prior to Windows 2003 do not inadvertently corrupt the disk. If a legacy system accesses a GPT disk, then the disk appears to have a single partition of type 0xEE which is unknown to the legacy system. There is still a disk signature and the MBR signature, but no boot code.

LBN 0 0x0000 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ****** 0x01b0 00 00 00 00 00 00 00 00-1f dd b4 f8 00 00 00 00 0x01c0 02 00 EE FF FF FF 01 00-00 00 FF FF FF FF 00 00 0x01d0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 0x01e0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 0x01f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 55 aa

The signature is (0x01FDDB4F8). The single partition is defined as type 0xEE. The offset is always 0x00000001. The length is always 0xFFFFFFFF.

LBA 1 – Primary GUID partition table header

The GUID partition table header is always at LBA 1 and indicates how many partitions can be defined for the disk. For Windows GPT disks, there can be 128 partitions, but the standard does not define a limit. This GUID header is also duplicated at the very end of the disk.

Note: All addresses in GPT disk structures are 64-bits long.

LBN 1 0x0000 45 46 49 20 50 41 52 54-00 00 01 00 5c 00 00 00 EFI PART....\... 0x0010 bc 91 da 28 00 00 00 00-01 00 00 00 00 00 00 00 •æ•(............ 0x0020 ff ff ff 01 00 00 00 00-22 00 00 00 00 00 00 00 ....."....... 0x0030 de ff ff 01 00 00 00 00-da 28 ea 37 9a 78 6a 4a Ì .....•(Û7ÜxjJ 0x0040 b0 a4 68 1d 94 f5 e7 33-02 00 00 00 00 00 00 00 •ñh•ö§þ3........ 0x0050 80 00 00 00 80 00 00 00-75 68 eb a4 00 00 00 00 Ç...Ç...uhÙñ.... 0x0060 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ****** 0x01f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................

Note: The Microsoft 'secinspect' program has been used throughout this guide to display the contents of disk content.

Note the following fields:

Page 5: Aligning GPT Basic and Dynamic Disks

5

Windows 2003 GPT disk layout

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

Location of primary GUID partition table header (0x0000000000000001). Location of backup GUID partition table header (0x000000001FFFFFF). This is the address of the last block on the disk.

First block available for allocating partitions is 34 (0x0000000000000022).

The value (34) is determined by the fact that GPT disks can have 128 partitions, and each disk block can hold 4 partition definitions. The addition of the protective MBR and partition table header provides a total of 34.

Maximum number of partitions for this disk is 128 (0x00000080).

LBA 2 – Address of the first four GUID partition table entries

Each disk block can contain 4 partition definitions. LBA 2 will contain the first four partitions.

LBN 2 0x0000 16 e3 c9 e3 5c 0b b8 4d-81 7d f9 2d f0 02 15 ae •Ò•Ò\.©Mü}¨--.§« 0x0010 9c 0c 37 8a 5c ec d7 4d-bc 50 ce ac a0 62 35 fd £.7è\ýÎM•P•¼áb5² 0x0020 22 00 00 00 00 00 00 00-21 00 01 00 00 00 00 00 ".......!....... 0x0030 00 00 00 00 00 00 00 00-4d 00 69 00 63 00 72 00 ........M.i.c.r. 0x0040 6f 00 73 00 6f 00 66 00-74 00 20 00 72 00 65 00 o.s.o.f.t. .r.e. 0x0050 73 00 65 00 72 00 76 00-65 00 64 00 20 00 70 00 s.e.r.v.e.d. .p. 0x0060 61 00 72 00 74 00 69 00-74 00 69 00 6f 00 6e 00 a.r.t.i.t.i.o.n. 0x0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ****** 0x01f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................

In this example, the only defined partition is a system partition (Microsoft reserved partition). It starts as block address 0x0000000000000022 and ends at 0x0000000000010021. In this particular case, the first user partition, by default, will start at block address 0x0000000000010022.

LBA 34 – Address of the first partition (Microsoft reserved partition)

Converting an MBR disk to a GPT disk always creates at least one system type partition. The first partition will always start at block address 34. (0x22) and the length of the Microsoft reserved partition in every case will vary according to the size of the disk.

Normally, one or two system partitions are created depending on whether this is a boot disk on an IA64 system.

Either way, the address of the first user partition cannot be easily determined without first inspecting the partition table entry blocks.

Page 6: Aligning GPT Basic and Dynamic Disks

6

How partitions are created on a GPT disk

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

Fortunately, diskpart automatically performs this action when a partition is created.

LBN 34 0x0000 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ****** 0x01f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................

At this stage, the Microsoft reserved partition contains no data.

If a partition is created at this stage by using diskpart (or the GUI), and by also using default options, the user partition would be created at offset 0x0000000000010022. This address is not aligned since the address is not divisible by 128.

The only way to create a partition that is aligned is by using diskpart with the align option. The GUI offers no option for alignment.

How partitions are created on a GPT disk

When creating aligned partitions, it is useful to understand how the default creation of partitions on a GPT disk occurs. The first useable block for a partition is LBA 34 (0x22). When many partitions are created on a GPT disk, the layout can be visualized as follows:

All partitions are created in multiples of 1 MB (2048 Blocks). Since the first partition starts at LBA 34, all partitions start 34 blocks after a logical block address, which is a multiple of 2048.

This means that all partitions created will be misaligned by 34 blocks.

When partitions are aligned by using diskpart, we set the starting position of each partition to be a multiple of 128 blocks. Windows 2003 however, will always end the partition on a boundary as shown in preceding figure.

Page 7: Aligning GPT Basic and Dynamic Disks

7

Creating an aligned GPT partition by using diskpart

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

Use of diskpart to align a number of partitions results in the following:

Four aligned partitions were created with diskpart. Windows has ended these partitions at the same addresses as shown in the preceding misaligned example. This means that there is a gap between each of the partitions.

Creating an aligned GPT partition by using diskpart

To create a 1GB partition on an empty GPT disk:

C:\>diskpart Microsoft DiskPart version 5.2.3790.1830 Copyright (C) 1999-2001 Microsoft Corporation. On computer: W3KR2 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>

Page 8: Aligning GPT Basic and Dynamic Disks

8

Creating an aligned GPT partition by using diskpart

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

Note: The size is specified in megabytes.

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.

LBN 2 0x0000 16 e3 c9 e3 5c 0b b8 4d-81 7d f9 2d f0 02 15 ae •Ò•Ò\.©Mü}¨--.§« 0x0010 9c 0c 37 8a 5c ec d7 4d-bc 50 ce ac a0 62 35 fd £.7è\ýÎM•P•¼áb5² 0x0020 22 00 00 00 00 00 00 00-21 00 01 00 00 00 00 00 ".......!....... 0x0030 00 00 00 00 00 00 00 00-4d 00 69 00 63 00 72 00 ........M.i.c.r. 0x0040 6f 00 73 00 6f 00 66 00-74 00 20 00 72 00 65 00 o.s.o.f.t. .r.e. 0x0050 73 00 65 00 72 00 76 00-65 00 64 00 20 00 70 00 s.e.r.v.e.d. .p. 0x0060 61 00 72 00 74 00 69 00-74 00 69 00 6f 00 6e 00 a.r.t.i.t.i.o.n. 0x0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0x0080 a2 a0 d0 eb e5 b9 33 44-87 c0 68 b6 b7 26 99 c7 óáðÙÕ•3Dç•hÂÀ&Öà 0x0090 e4 fd e7 d2 8a f6 14 44-88 80 42 4e e0 e7 8d 86 õ²þÊè÷¶DêÇBNÓþìå 0x00a0 80 00 01 00 00 00 00 00-21 00 21 00 00 00 00 00 Ç.......! ...... 0x00b0 00 00 00 00 00 00 00 00-42 00 61 00 73 00 69 00 ........B.a.s.i. 0x00c0 63 00 20 00 64 00 61 00-74 00 61 00 20 00 70 00 c. .d.a.t.a. .p. 0x00d0 61 00 72 00 74 00 69 00-74 00 69 00 6f 00 6e 00 a.r.t.i.t.i.o.n. 0x00e0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ****** 0x01ff 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................

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.

Page 9: Aligning GPT Basic and Dynamic Disks

9

Creating a second aligned GPT partition by using diskpart

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

Creating a second aligned GPT partition by using diskpart

To create a second 2 GB partition:

C:\>diskpart Microsoft DiskPart version 5.2.3790.1830 Copyright (C) 1999-2001 Microsoft Corporation. On computer: W3KR2 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>

Page 10: Aligning GPT Basic and Dynamic Disks

10

Creating a second aligned GPT partition by using diskpart

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

After formatting, the partition table entry contains the following:

LBN 2 [C 0, H 0, S 3] 0x0000 16 e3 c9 e3 5c 0b b8 4d-81 7d f9 2d f0 02 15 ae •Ò•Ò\.©Mü}¨--.§« 0x0010 1c ca 7f c7 da 5e 2e 43-b6 6b ec f5 15 36 fa 58 •••Ã•^.CÂký§§6·X 0x0020 22 00 00 00 00 00 00 00-21 00 01 00 00 00 00 00 ".......!....... 0x0030 00 00 00 00 00 00 00 00-4d 00 69 00 63 00 72 00 ........M.i.c.r. 0x0040 6f 00 73 00 6f 00 66 00-74 00 20 00 72 00 65 00 o.s.o.f.t. .r.e. 0x0050 73 00 65 00 72 00 76 00-65 00 64 00 20 00 70 00 s.e.r.v.e.d. .p. 0x0060 61 00 72 00 74 00 69 00-74 00 69 00 6f 00 6e 00 a.r.t.i.t.i.o.n. 0x0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0x0080 a2 a0 d0 eb e5 b9 33 44-87 c0 68 b6 b7 26 99 c7 óáðÙÕ•3Dç•hÂÀ&Öà 0x0090 d6 e4 00 50 af 4d 1d 4d-8a 2f 10 55 9b b3 70 f6 Íõ.P»M•Mè/•Uø•p÷ 0x00a0 80 00 01 00 00 00 00 00-21 00 21 00 00 00 00 00 Ç.......!.!..... 0x00b0 00 00 00 00 00 00 00 80-42 00 61 00 73 00 69 00 .......ÇB.a.s.i. 0x00c0 63 00 20 00 64 00 61 00-74 00 61 00 20 00 70 00 c. .d.a.t.a. .p. 0x00d0 61 00 72 00 74 00 69 00-74 00 69 00 6f 00 6e 00 a.r.t.i.t.i.o.n. 0x00e0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0x00f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ 0x0100 a2 a0 d0 eb e5 b9 33 44-87 c0 68 b6 b7 26 99 c7 óáðÙÕ•3Dç•hÂÀ&Öà 0x0110 f0 07 06 4e 1d 5d 06 4a-81 cf 11 7e 31 1c 25 95 -..N•].Jü¤•~1•%ò 0x0120 80 00 21 00 00 00 00 00-21 00 61 00 00 00 00 00 Ç.!.....!.a..... 0x0130 00 00 00 00 00 00 00 80-42 00 61 00 73 00 69 00 .......ÇB.a.s.i. 0x0140 63 00 20 00 64 00 61 00-74 00 61 00 20 00 70 00 c. .d.a.t.a. .p. 0x0150 61 00 72 00 74 00 69 00-74 00 69 00 6f 00 6e 00 a.r.t.i.t.i.o.n. 0x0160 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................ ****** 0x01f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................

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.

Summary

You can use diskpart to align partitions on a Windows 2003 basic GPT disk as follows:

1. Ensure the disk is empty. Delete all volumes and partitions.

2. Convert the MBR disk to a GPT disk.

3. Using diskpart, create the appropriate partition size that is aligned at one of the following:

64 (128 blocks) if an EMC Symmetrix® volume 64 (128 blocks) if an EMC CLARiiON® LUN with default

element size 4. (optional) Create subsequent volumes that are aligned with diskpart

by using the align option.

Page 11: Aligning GPT Basic and Dynamic Disks

11

Aligning GPT dynamic volumes

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

Note: You cannot use the disk management GUI or diskpar to align partitions.

Aligning GPT dynamic volumes

You cannot align dynamic volumes on GPT disks unless they were present as aligned partitions when the disk was converted. You cannot create any volumes on a dynamic GPT disk that will be aligned.

Creating a dynamic GPT partition is similar to creating a dynamic MBR disk. You can convert an empty GPT disk, or convert a GPT disk with existing partitions.

GPT dynamic disk created from an empty disk

Once a GPT disk has been converted to dynamic, there is no way to align a volume because there is no align option to the create volume command in diskpart.

All volumes will be created at the same boundary as basic GPT disks (34 blocks after an alignment boundary).

GPT dynamic disk created from a non-empty disk

If a GPT disk contains existing partitions, those partitions are converted to dynamic simple volumes in place. Any alignment remains the same. This means that you could create aligned partitions when the disk was a basic disk and then convert the disk to dynamic. The resulting simple volumes would still be aligned. The problem is that you are restricted to this layout which means that you lose all of the dynamic volume management features. Limitations include:

You cannot create any more volumes that will be aligned. You cannot extend the existing volumes without misaligning the

additional subvolumes. You cannot create a mirror image that is aligned.

Summary

You cannot use diskpart to align partitions on a Windows 2003 dynamic GPT disk because the align option is not available. Any existing partitions will retain their alignment when the disk is converted.

Page 12: Aligning GPT Basic and Dynamic Disks

12

Aligning GPT dynamic volumes

Aligning GPT Basic and Dynamic Disks For Microsoft Windows 2003 Technical Note

Copyright © 2006 EMC Corporation. All Rights Reserved.

EMC believes the information in this publication is accurate as of its publication date. The information is subject to change without notice.

THE INFORMATION IN THIS PUBLICATION IS PROVIDED "AS IS." EMC CORPORATION MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WITH RESPECT TO THE INFORMATION IN THIS PUBLICATION, AND SPECIFICALLY DISCLAIMS IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Use, copying, and distribution of any EMC software described in this publication requires an applicable software license.

For the most up-to-date listing of EMC product names, see EMC Corporation Trademarks on EMC.com.

All other trademarks used herein are the property of their respective owners.