Fixed hybrid creation bug on over-2TiB disks & improved verification
('v') detection of disks with 0xEE partitions that don't begin on
sector 1.
diff --git a/NEWS b/NEWS
index d61cb41..fcd5bdd 100644
--- a/NEWS
+++ b/NEWS
@@ -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 @@
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 @@
} // 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 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 @@
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 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 @@
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");
diff --git a/support.h b/support.h
index 53e6405..0e7b504 100644
--- a/support.h
+++ b/support.h
@@ -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