Saturday, March 1, 2014

What's the Difference Between GPT and MBR When Partitioning

Master Boot Record Vs. GUID Partition table

Introduction:

We make several partitions of our hard disk to keep various types of data or to make an isolation between system data and user data. The question is, how does the OS know the partition structure of the hard disk? That information has to come from somewhere. This is where MBR (Master Boot Record) and GPT (GUID Partition Table) come into play. While both are architecturally different, both play the same role in governing and provide information for the partitions in the hard disk.

Master Boot Record (MBR)

MBR is the old standard for managing the partition in the hard disk, and it is still being used extensively. The MBR resides at the very beginning of the hard disk and it holds the information on how the logical partitions are organized in the storage device. In addition, the MBR also contains executable code that can scan the partitions for the active OS and load up the boot-up code/procedure for the OS.

A master boot record (MBR) is a special type of boot sector at the beginning of partitioned computer mass storage devices like fixed disks or removable drives. The concept of MBRs was publicly introduced in 1983 with PC DOS 2.0.

The MBR holds the information on how the logical partitions, containing file systems, are organized on that medium. Besides that, the MBR also contains executable code to function as a loader for the installed operating system—usually by passing control over to the loader's second stage, or in conjunction with each partition's volume boot record (VBR). This MBR code is usually referred to as a boot loader.

The organization of the partition table in the MBR limits the maximum addressable storage space of a disk to 2 TB per partition with a total no of four partitions.
This is how a typical MBR disk layout looks like:

There are several pitfalls with MBR. First of all, you can only have 4 partitions in the hard disk and each partition is limited to the only 2TB in size. This is not going to work well with the hard disk of big storage space, say 100TB. Secondly, the MBR is the only place that holds the partition information. If it ever gets corrupted (and yes, it can get corrupted very easily), the entire hard disk is unreadable.

GUID Partition Table (GPT)

GPT is a standard for the layout of the partition table on a physical hard disk, using globally unique identifiers (GUID). Although it forms a part of the Unified Extensible Firmware Interface (UEFI) standard (Unified EFI Forum proposed replacement for the PC BIOS), it is also used on some BIOS systems because of the limitations of master boot record (MBR) partition tables, which use 32 bits for storing logical block addresses (LBA) and size information.

With GPT, you can create theoretically unlimited partitions on the hard disk, even though it is generally restricted to 128 partitions. Unlike MBR that limits each partition to only 2TB in size, each partition in GPT can hold up to 9.44ZB for a 512-byte block (1 ZB is 1 billion terabytes). In Microsoft Windows, that size is limited to 256 TB.
This is how a GPT disk layout looks like:
From the GPT Table Scheme diagram above, you can see that there is a primary GPT at the beginning of the hard disk and a secondary GPT at the end. This is what makes GPT more useful than MBR. GPT stores a backup header and partition table at the end of the disk so it can be recovered if the primary tables are corrupted. It also carries out CRC32 checksums to detect errors and corruption of the header and partition table.

You can also see that there is a protective MBR in the first sector of the hard disk. Such a hybrid setup is to allow a BIOS-based system to boot from a GPT disk using a boot loader stored in the protective MBR’s code area. In addition, it protects the GPT disk from damage by GPT-unaware disk utilities.

Conclusion

In most cases, you will be fine with either MBR or GPT. It is only in a situation where you need four primary partitions or when you need to have a partition bigger than 2TB, that you need to use GPT, or convert MBR to GPT. Also, for the newer model of computer that uses UEFI, it will only support GPT.

(References: Wikipedia)

How to convert MBR to GPT and vice-versa

The conversion is possible only when the disk is raw or unformatted. If we convert a disk partition from MBR to GPT or vice-versa, the entire data will be lost.

(1) When we plug a new hard disk in the system, it shows as 'Not initialized'. Right-click on the Disk and click 'initialize Disk'.




(2) Now it will prompt you to select the partition style (MBR or GPT). Select the partition style as per your requirement. If you want to make more than 4 primary partitions and each partition is more than 2 TB then select GPT otherwise select MBR.




(3)  After initializing and selecting partition style, you can check it in disk properties.




 (4) Now again right-click on Disk to change the partition style and click on 'Convert to MBR Disk' or 'Convert to GPT Disk', whichever the case may be.





------------------------------------------------------------------------------------------



 (5) Once you converted and formatted the disk, you can not change its partition style until 
you erase the disk.





 Alternatively, you can use the DISKPART command-line utility to achieve the task.




Make sure that the command-line does not prompt you for any confirmation, even for 'erase' command it does not ask for confirmation and erases the entire disk. Be careful ;)




No comments:

Post a Comment