diff options
author | Roderick W. Smith <rodsmith@rodsbooks.com> | 2013-09-12 12:37:44 -0400 |
---|---|---|
committer | Roderick W. Smith <rodsmith@rodsbooks.com> | 2013-09-12 12:37:44 -0400 |
commit | 427c799b611e357223da28c778a08451fb789590 (patch) | |
tree | 7651635958c1f1555bc7f097daf21cc34f6107dc | |
parent | 042f38a2f716fd4a3b9b03c35951e69f1d1bc942 (diff) | |
download | sgdisk-427c799b611e357223da28c778a08451fb789590.tar.gz |
Fixed hybrid creation bug on over-2TiB disks & improved verification
('v') detection of disks with 0xEE partitions that don't begin on
sector 1.
-rw-r--r-- | NEWS | 14 | ||||
-rw-r--r-- | basicmbr.cc | 20 | ||||
-rw-r--r-- | parttypes.cc | 1 | ||||
-rw-r--r-- | support.h | 2 |
4 files changed, 30 insertions, 7 deletions
@@ -1,6 +1,20 @@ 0.8.8 (?/??/2013): ------------------ +- Fine-tuned verification ('v') check for 0xEE partition that doesn't begin + on sector 1: Previously, a disk with multiple 0xEE partitions would + always trigger this warning. Now, the warning occurs only if NONE of the + 0xEE partitions begins on sector 1. + +- Fixed hybrid MBR creation on disks larger than 2TiB: Previously, if one + opted to create an extra partition to cover unused space following + hybridized partitions, gdisk would hang. + +- Added support for new partition type code, + 47CB5633-7E3E-408B-B7B8-2D915B7B21B1 (0x8302), which parted (git versions + leading up to 3.2) uses for HFS+ partitions that hold Linux boot files on + Macs. This type code corresponds to the "hfs_esp" flag in parted. + - Added check for an active/bootable 0xEE protective partition to the verify ('v') function. If found, this is not counted as an error, but it is called out to the user, since it can cause some EFIs (such as diff --git a/basicmbr.cc b/basicmbr.cc index 080de76..6cea80f 100644 --- a/basicmbr.cc +++ b/basicmbr.cc @@ -701,10 +701,11 @@ int BasicMBRData::LBAtoCHS(uint64_t lba, uint8_t * chs) { return (retval); } // BasicMBRData::LBAtoCHS() -// Look for overlapping partitions. +// Look for overlapping partitions. Also looks for a couple of non-error +// conditions that the user should be told about. // Returns the number of problems found int BasicMBRData::FindOverlaps(void) { - int i, j, numProbs = 0, numEE = 0; + int i, j, numProbs = 0, numEE = 0, ProtectiveOnOne = 0; for (i = 0; i < MAX_MBR_PARTS; i++) { for (j = i + 1; j < MAX_MBR_PARTS; j++) { @@ -717,14 +718,17 @@ int BasicMBRData::FindOverlaps(void) { } // for (j...) if (partitions[i].GetType() == 0xEE) { numEE++; - if (partitions[i].GetStartLBA() != 1) - cout << "\nWarning: 0xEE partition doesn't start on sector 1. This can cause " - << "problems\nin some OSes.\n"; + if (partitions[i].GetStartLBA() == 1) + ProtectiveOnOne = 1; } // if } // for (i...) + if (numEE > 1) cout << "\nCaution: More than one 0xEE MBR partition found. This can cause problems\n" << "in some OSes.\n"; + if (!ProtectiveOnOne) + cout << "\nWarning: 0xEE partition doesn't start on sector 1. This can cause " + << "problems\nin some OSes.\n"; return numProbs; } // BasicMBRData::FindOverlaps() @@ -927,7 +931,7 @@ int BasicMBRData::IsEEActive(void) { int i, IsActive = FALSE; for (i = 0; i < MAX_MBR_PARTS; i++) { - if (partitions[i].GetStatus() & 0x80) + if ((partitions[i].GetStatus() & 0x80) && (partitions[i].GetType() == 0xEE)) IsActive = TRUE; } return IsActive; @@ -1056,6 +1060,7 @@ int BasicMBRData::MakeBiggestPart(int i, int type) { uint64_t selectedSegment = UINT64_C(0); // location of largest segment uint64_t selectedSize = UINT64_C(0); // size of largest segment in blocks int found = 0; + string anything; do { firstBlock = FindFirstAvailable(start); @@ -1375,6 +1380,9 @@ uint64_t BasicMBRData::FindFirstAvailable(uint64_t start) { uint64_t i; int firstMoved; + if ((start >= (UINT32_MAX - 1)) || (start >= (diskSize - 1))) + return 0; + first = start; // ...now search through all partitions; if first is within an diff --git a/parttypes.cc b/parttypes.cc index a4a3182..c47b864 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -110,6 +110,7 @@ void PartType::AddAllTypes(void) { AddType(0x8200, "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F", "Linux swap"); // Linux swap (or Solaris on MBR) AddType(0x8300, "0FC63DAF-8483-4772-8E79-3D69D8477DE4", "Linux filesystem"); // Linux native AddType(0x8301, "8DA63339-0007-60C0-C436-083AC8230908", "Linux reserved"); + AddType(0x8302, "47CB5633-7E3E-408B-B7B8-2D915B7B21B1", "Linux HFS+"); // Used by Fedora on Macs // Used by Intel Rapid Start technology AddType(0x8400, "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593", "Intel Rapid Start"); @@ -8,7 +8,7 @@ #ifndef __GPTSUPPORT #define __GPTSUPPORT -#define GPTFDISK_VERSION "0.8.7.1" +#define GPTFDISK_VERSION "0.8.7.2" #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64 |