Wednesday, 24 April 2019

partitioning - Are GPT reserved and EFI system partitions important?


I wonder what the GPT Reserved Partition and the GPT EFI System Partition are for. Do I need them and what would happen if I removed them?


Also what is it for?


I mean the 2nd and 3rd one in the picture.


Partition manager screenshot



Answer



I think that proper answer needs some technical details.


Introduction


Your computer probably has only one hard disk. What you can see in the window presented on a screenshot are in fact partitions, even if your system refers to them as disks.


Generally speaking, drives can be used without partitioning. Most pendrives work like that.[1] But using partitions has many advantages, just to name some of them:



  • You can have two OSes sitting on the same hard drive and not interfering with each other. Each one will treat its partition as a logical drive and won't mess with other ones unless you tell it to.

  • You can logically separate your data. If one partition becomes corrupted for some reason, other partitions will very likely remain intact.

  • Using partitions is better than using multiple smaller hard drives, because your system is quieter, consumes less energy and you can resize, delete, move them around etc.

  • You can use some parts of the hard drive for some special purposes.


Partition tables


Your hard drive has a partition table on it. It's a structure that describes its partition layout.


Until recently, MBR partitioning scheme was used in most cases. It was called so because the partition table was inside a Master Boot Record – a reserved part of the disk (the very first physical sector) that contains the first bootstrap code that's read from the disk, and also contains the partition table for the drive - which tells how many partitions there are, where they are, and what file system type each one uses (eg. FAT32, NTFS etc.)


During bootstrap, the machine's firmware reads the MBR code and transfers control to it. The MBR code in turn reads the first block of the Volume Boot Record from the active partition that's identified in the partition table, and transfers control to it. That code in turn reads the rest of the VBR, which, finally, loads appropriate files from the partition and boots the operating system.


This scheme had a number of advantages. It was very simple to implement and use, even on old hardware or when only limited disk space was available. What's more, the VBR code (written during OS installation) is the first executed piece of code that has to understand file systems, so BIOSes could be kept relatively simple and compact. But MBR partition tables are now 30 years old. Hardware and software has changed. A major limit is that the format of the partition table only supports hard drives of about 2 TiB in size. There were many other problems with MBR partitioning.


MBR partition tables are now superseded by GUID Partition Tables, or GPT for short. That's the type of partition table you have on your hard disk (if you didn't, you wouldn't have an "EFI system partition"). GPTs don't have an MBR[2] and are complemented by UEFI – new type of firmware that replaces legacy BIOSes. (That is, to boot from a GPT disk, your machine must have UEFI firmware.) UEFI doesn't have to rely on Volume Boot Records provided by single partitions, but can rather use OS loaders provided by OSes.


How booting works


When BIOS is booting from a hard disk, it's first looking at the MBR; the partition table in the MBR allows the MBR code to locate and identify the active partition; the code from the active partition's Volume Boot Record locates, reads, and transfers control to the OS's loader.


UEFI is more sophisticated. The UEFI firmware is capable of understanding at least some details of a FAT-formatted partition, enough to locate an executable file, load it into RAM, and transfer control to it. For Windows this file is bootmgr.exe.


The UEFI firmware looks for a partition containing such files. It's the one called "EFI System partition" on your screenshot. (It's identified as an "EFI system partition" by a numeric identifier, a GUID, that's inside the partition. Only one such partition is permitted per hard drive. And since the UEFI firmware only understands the FAT family of file systems, the EFI system partition should preferably be formatted with FAT32.)


Then it reads all available OS loaders from that partition and checks if the one you've specified as default is present. It's likely that you can press some button before UEFI starts booting to choose another OS loader. So UEFI is independent from any boot code found in an MBR or VBR; instead it's relying on loaders provided by installed OSes.


It's worth noting that UEFIs contain a Compatibility Support Module, which is usually disabled by default. It restores backwards compatibility with MBR-based BIOS boot sequence. Unfortunately, BIOS booting requires some additional initialization to be performed by system firmware, which makes booting slower overall.


So, can I remove the EFI System Partition?


At this point you should understand that deleting the EFI System partition will erase all OS loaders, thus making it impossible to boot that hard drive with UEFI.


The Reserved Partition


It's a placeholder invented by Microsoft. It doesn't contain any meaningful data and it's there just in case you'd ever need to create some additional partition for special uses. In that case, Windows will shrink the Reserved partition and create a new one in the recovered place. Deleting it shouldn't do any harm now, but you may face some problems in the future.


The Big Question


Now, before you delete any of these, you should ask yourself a question: "why would I do that?"


The free disk space you gain probably isn't worth it. Your hard drive has 700 GB of usable disk space. Those two partitions take up less than 400 MB combined. That's 0,05714% of your hard drive. You'll recover just a little piece of the disk, while risking boot failure and possible problems with Windows in the future.


Another reason why you would do that made sense for MBR partition tables – they had a limitation of 4 partitions, so every single one was precious. That's not the case with GPT, so no reason to delete those two here.




[1] Pendrives can be partitioned, but out of the box they don't have a proper partition table. The single partition that's on them doesn't have a bootsector and more partitions can't be created unless a new partition table is created.


[2] Thats's not entirely true. GPT contains a dummy MBR table with a pseudo-partition that spans over first 2 TB of the hard drive. It's used to trick legacy tools that don't support GPT into thinking that a drive contains valid MBR partition table and a single partition with no free space. It's safer than letting a legacy tool read the GPT, because it could interpret it as a corrupted MBR and attempt to fix it.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...