Example
Example
Table of Contents
Introduction……………………………………………………………………………….1
General Advantages and Disadvantages of GPT and MBR……………………………....1
Critical Comparison Between MBR and GPT……………………………………………2
Partitions Creation and How they are Accommodated…………………………...2
Partitions Order Management…………………………………………………….6
Partition Size Information…..………………………...………………………….10
Sector Size Information……..……………………………………………………13
File System Information…..……………………………………………………...13
Volume Name Information…..………………………………………………...…16
Endian Representation…..…………….……………………………….…………17
Windows 10/11 Boot Process Security…………………………………………………...18
Conclusion………………………………………………………………………………..19
Reference List………………………………………………………………………….....20
18093906 7COSC003W: CW1
1- Introduction
Data can be found in two states: either at rest, or in transit. In transit state is when
data travels through wired or wireless communication channels. Data travels from a
source to a destination, and vice versa. These sources and destinations are where data
resides, or where data is in the at-rest state. But what is required to have at-rest data?
A storage location. Devices that store data have hard disks, these disks store data, but
data cannot be stored on a blank disk.
For a disk to be able to store data, it must be first formatted with a certain drive letter,
cluster size, storage size, and file system. This way, the disk can now act as a
container, or a Partition. Is one partition enough to store and process data? The
answer is yes. But partitioning a disk (i.e., logically creating more than one partition)
comes with greater benefits. Taking Windows as an example, one benefit can be to
better organize data, such as using a partition (other than the C: drive that holds the
operating system information) to store applications installation packages and using a
third one to store personal data. This way, data can be easily organized, backed up,
and, in case of encountering a problem that requires Windows to be reinstalled, this
can be done seamlessly within the system partition without affecting other data.
Partitions are not organized or managed randomly, each disk operates according to a
partition table, or a partitioning scheme. A partitioning scheme is data stored at the
beginning of a storage device to determine the layout and the organization of the
partitions within the device. There are two schemes, the MBR (Master Boot Record)
and GPT (GUID Partitioning Table).
This document explains the advantages and disadvantages of both MBR and GPT and
critically compares their technical similarities and differences.
Page | 1
18093906 7COSC003W: CW1
Page | 2
18093906 7COSC003W: CW1
For creating the partitions, the CLI (Command Line Interface) utility DISKPART
will be used.
3.1.1 MBR USB Stick
Page | 3
18093906 7COSC003W: CW1
Page | 4
18093906 7COSC003W: CW1
Page | 5
18093906 7COSC003W: CW1
Page | 6
18093906 7COSC003W: CW1
The MBR’s initial sector contains 445 bytes boot code, then partitions information
with 16 bytes each, followed by a 2-byte MBR signature.
The order in which the partitions are managed in MBR is determined by their
order of creation and their physical location on the disk. In the example shown
earlier, the first created partition which was Mohammed (A:) is the first one to be
stored physically in the disk and should be the active partition if it is required for
it to be bootable.
3.2.2 GPT
For GPT, the architecture is made up of a 512-byte protective MBR that prevents
data loss when GPT is used with older systems, a 512-byte GPT header that hold
general information about the disk, a 128-partition entry array with 128 bytes
each which hold information about each partition such as its size and GUID
partition type.
Page | 7
18093906 7COSC003W: CW1
Page | 8
18093906 7COSC003W: CW1
As shown in figure 8, offset 0x28 to 0x30 determines the first usable LBA
(Logical Block Addressing) where the first actual partition starts and can
store data. To better illustrate, the GPT header of the second USB stick will
be examined as an example using the dd command in Linux. The first 512
bytes for protective MBR are skipped to show only the GPT header.
Highlighted in yellow is first usable LBA:
Page | 9
18093906 7COSC003W: CW1
Figure 11: Using dd and xxd to Extract the 1st Partition Entry
Page | 10
18093906 7COSC003W: CW1
Figure 12: Using dd and xxd to Calculate the Size of the 1st MBR Partition
Bytes highlighted in yellow in figure 11 are bytes 12-15 that hold the information
about the partition size. These bytes are stored in little endian. The following steps
will be taken to calculate the size:
Converting little endian to big endian: 00 50 1C 00 00 1C 50 00
Converting hex to decimal: 160×0 + 161×0 + 162×0 + 163×5 + 164×C +
165×1 + 166×0 + 167×0 = 20,480 + 786,432 + 1,048,576 = 1,855,488
The partition contains 1,855,488 sectors. Now, this should be multiplied
by the single sector size (512 bytes) to determine the size in bytes
Partition size in bytes = 1,855,488×512 = 950,009,856 bytes
To get the exact value in Megabytes, the value in bytes should be divided
by 220 (since computers only understand the binary system, and 220 is the
closest number to 106 which represents 1 Megabyte)
The final actual size in Megabytes is 950,009,856 / 220 = 906 MB
Here, the process has resulted in showing the actual partition size which is the
same as what was allocated to the partition during the creation in 3.1.1
3.3.2 GPT
When it comes to GPT, partition size information is stored in the partition entry
table that consists of 128 entries with 128 bytes for each single partition. Each
entry identifies the starting and ending LBA of the partition (i.e., the first and last
sector the partition uses to store data). Using these values, the total number of
sectors can be calculated to determine the partition size.
Page | 11
18093906 7COSC003W: CW1
Since both partitions were created with the same size in the second GPT USB
stick, the first partition will be taken as an example to examine the first and last
LBA and calculate the partition size.
According to GPT’s architecture shown in figure 9, starting LBA is located
between offset 0x20 and 0x28, and ending LBA is located between 0x28 and
0x30.
Figure 13: Using dd and xxd to Calculate the Size of the 1st GPT Partition
Page | 12
18093906 7COSC003W: CW1
Byte 4 in each partition represents the file system installed on the partition. To
verify that MBR sector holds the same information about the file system already
created in 3.1, dd and xxd will be used to extract each of the partitions’ 16-byte.
Page | 13
18093906 7COSC003W: CW1
Byte 4 for each partition is 0x07. This value is used for both NTFS and exFAT
[3], which proves that the first partition is formatted with NTFS file system and
the second one is formatted with exFAT.
3.5.2 GPT
After analyzing the GPT USB stick, it was found that GPT stores file system
information in the first sector of each partition (the sector that is the starting LBA
of the partition). This information starts from byte 3 and each byte represents a
character in ASCII.
The starting LBA of each partition is stored in the 128-byte partition entry table
of GPT. It was already calculated in 3.3.2 that the starting LBA of partition 1 is
0x800 which is 2,048 (first sector the partition uses to store data). To determine
the exact offset, this value must be multiplied by the single sector size (512
bytes). It appears that the first partition starts at 1,048,576. Using dd and xxd, the
first sector of the partition will be examined to verify the file system installed on
the partition.
Here it shows that bytes 3 to 6 represent the ASCII codes of the file system’s
name installed on the partition which is NTFS.
Regarding the second partition, the 128-byte partition entry will be examined to
determine the starting LBA of the partition, then dd will be used to extract the
first sector of the partition to verify the file system installed. The partition entry
Page | 14
18093906 7COSC003W: CW1
of the second partition starts at byte 1,152 (512 protective MBR + 512 GPT
header + 128 first partition entry).
Figure 17: Using dd and xxd to Extract the 2nd Partition Entry
Figure 18: Using dd and xxd to Extract the 1st Sector of the 2nd Partition
Here it shows that ASCII representation of exFAT is stored from byte 3 to byte
7, and this verifies the file system installed on the partition in 3.1.2 which is
exFAT.
Page | 15
18093906 7COSC003W: CW1
For the second exFAT partition, it was already determined in 3.5.2 that the
partition starts at offset 951,058,432. Therefore, the examination of the partition
started from this offset, and it was found that volume name information is stored
at offset 951,320,576 which is the Root Directory that holds the volume label
entry [4].
Page | 16
18093906 7COSC003W: CW1
Partition type GUIDs are stored in the first 16 bytes of the partition entry. GPT
stores the abovementioned value in this format: A2A0D0EB-E5B9-3344-87C0-
68B6B72699C7. This means that the first 3 dashed values: EBD0A0A2-B9E5-
Page | 17
18093906 7COSC003W: CW1
4433 are stored in little endian, while the next 2 are stored in big endian: 87C0-
68B6B72699C7.
Page | 18
18093906 7COSC003W: CW1
5- Conclusion
In conclusion, this document has shown that the GPT partitioning scheme has way
more advantages than the traditional MBR. GPT fits more into modern computer
systems and meets the necessity of having a proper storage scheme with greater
storage capacity and more partitions number. GPT also uses the CRC32 error
correction mechanism, ensure redundancy, and identifies the purpose and role of each
partition using multiple identifiers and attributes.
The technical differences and similarities between the two partitioning schemes were
also discussed:
MBR works with the legacy BIOS, while GPT was introduced with UEFI
MBR can only have 4 partitions up to 2 Terabytes each, while GPT can have
128 partitions with 9 Zettabytes each
MBR stores partitions according to their order of creation, with the first
partition being the bootable one. GPT offers more flexibility as it does not
necessarily follow the order of creation
MBR stores partitions’ size information in sector 0 by calculating the total
number of sectors each partition has, while in GPT the size is determined
through the partition entry table through subtracting the starting LBA from the
ending LBA for each partition
MBR and GPT both do not store volume label information
Both MBR and GPT do not store sector size information
MBR stores the file system information within the partition entries in MBR’s
sector 0, while GPT stores this information in ASCII in the first sector of each
partition
MBR uses little endian, unlike GPT that uses mixed endian
Boot process has been made way more secure with the introduction of UEFI
and GPT
Today’s modern computer systems require knowledge about these two
partitioning schemes, and which one should be used to meet certain requirements.
This way, more informed decisions can be made to cope with the increasing
storage and security requirements.
Page | 19
18093906 7COSC003W: CW1
Reference List
[1] B. Nikkel, "Forensic analysis of GPT disks and GUID partition tables," Digital
Investigations, volume 6, issues 1-2, pages 39-47, 2009. doi:
https://doi.org/10.1016/j.diin.2009.07.001
[2] Unified Extensible Firmware Interface (UEFI) Specification, 2022. [Online]. Available:
https://uefi.org/sites/default/files/resources/UEFI_Spec_2_10_Aug29.pdf
[3] A. Brouwer. "List of partition identifiers for PCs." Eindhoven University of Technology.
Accessed: Nov. 4, 2023. [Online]. Available:
https://www.win.tue.nl/~aeb/partitions/partition_types-1.html
[4] "exFAT Filesystem." ELM. Accessed: Nov. 4, 2023. [Online]. Available: http://elm-
chan.org/docs/exfat_e.html#dir_struct
[6] "UEFI vs. BIOS: How Do They Differ?." phoenixNAP. Accessed: Nov. 5, 2023. [Online].
Available: https://phoenixnap.com/kb/uefi-vs-bios
[7] Microsoft. "Secure boot." Microsoft. Accessed: Nov. 5, 2023. [Online]. Available:
https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/oem-
secure-boot
[8] Microsoft. "TPM fundamentals." Microsoft. Accessed: Nov. 5, 2023. [Online]. Available:
https://learn.microsoft.com/en-us/windows/security/hardware-security/tpm/tpm-
fundamentalst
Page | 20