diff options
author | Roderick W. Smith <rodsmith@rodsbooks.com> | 2014-01-25 23:46:42 -0500 |
---|---|---|
committer | Roderick W. Smith <rodsmith@rodsbooks.com> | 2014-01-25 23:46:42 -0500 |
commit | 4a702a2e26420e14592cba64701d85ec9f1f70dc (patch) | |
tree | 6b4ba9de774382a6f7e9f0f44ca486dabf671bba | |
parent | b784e0c95a11cdaad05b0f62806114ead678a2b0 (diff) | |
download | sgdisk-4a702a2e26420e14592cba64701d85ec9f1f70dc.tar.gz |
New checks for an oversized 0xEE protective (or any hybrid MBR)
partition. Auto-corrects on loading if protective & otherwise valid;
if not, verify and save operations warn of the problem.
-rw-r--r-- | NEWS | 15 | ||||
-rw-r--r-- | gpt.cc | 21 | ||||
-rw-r--r-- | support.h | 2 |
3 files changed, 37 insertions, 1 deletions
@@ -1,6 +1,21 @@ 0.8.9 (??/??/2014): ------------------- +- Added check for an oversized 0xEE protective partition. The program now + auto-repairs this condition on loading if the GPT data seem otherwise + valid. This is done because I've been receiving reports of some disks + (possibly from some OEM Windows 8 loads) that violate the GPT spec in + this way, and gdisk was reporting write errors when saving data. + +- If the GPT data seem to be damaged in some way or if the disk seems to + be a hybrid MBR and if the MBR partition(s) don't fit on the disk, the + verify (v) function now warns of this condition, and writing the disk if + it exists also displays a more specific error message about the problem. + +- Added new type codes (3000, 7412F7D5-A156-4B13-81DC-867174929325 and + 3001, D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149) for Open Network Install + Environment (ONIE) boot and config partitions, respectively. + - Added new type ccde (ED01, BFBFAFE7-A34F-448A-9A5B-6213EB736C22), for Lenovo's ESP-like partition. @@ -291,6 +291,12 @@ int GPTData::Verify(void) { // Verify that partitions don't run into GPT data areas.... problems += CheckGPTSize(); + if (!protectiveMBR.DoTheyFit()) { + cout << "\nPartition(s) in the protective MBR are too big for the disk! Creating a\n" + << "fresh protective or hybrid MBR is recommended.\n"; + problems++; + } + // Check that partitions are aligned on proper boundaries (for WD Advanced // Format and similar disks).... for (i = 0; i < numParts; i++) { @@ -681,6 +687,15 @@ void GPTData::PartitionScan(void) { // Load the GPT data, whether or not it's valid ForceLoadGPTData(); + // Some tools create a 0xEE partition that's too big. If this is detected, + // normalize it.... + if ((state == gpt_valid) && !protectiveMBR.DoTheyFit() && (protectiveMBR.GetValidity() == gpt)) { + if (!beQuiet) { + cerr << "\aThe protective MBR's 0xEE partition is oversized! Auto-repairing.\n\n"; + } // if + protectiveMBR.MakeProtectiveMBR(); + } // if + if (!beQuiet) { cout << "Partition table scan:\n"; protectiveMBR.ShowState(); @@ -1056,6 +1071,12 @@ int GPTData::SaveGPTData(int quiet) { cerr << "Aborting write operation!\n"; } // if + // Check that protective MBR fits, and warn if it doesn't.... + if (!protectiveMBR.DoTheyFit()) { + cerr << "\nPartition(s) in the protective MBR are too big for the disk! Creating a\n" + << "fresh protective or hybrid MBR is recommended.\n"; + } + // Check for mismatched MBR and GPT data, but let it pass if found // (function displays warning message) FindHybridMismatches(); @@ -8,7 +8,7 @@ #ifndef __GPTSUPPORT #define __GPTSUPPORT -#define GPTFDISK_VERSION "0.8.8" +#define GPTFDISK_VERSION "0.8.8.2" #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64 |