[PATCH] Use GPT on disks larger than 2TB (#671230)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 platform.py                  |   10 ++++++++--
 storage/formats/disklabel.py |    2 +-
 storage/partitioning.py      |    2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/platform.py b/platform.py
index bdb2357..d846d10 100644
--- a/platform.py
+++ b/platform.py
@@ -143,7 +143,7 @@ class Platform(object):
 
         return errors
 
-    def diskLabelType(self, deviceType):
+    def diskLabelType(self, deviceType, size=None):
         """Return the disk label type as a string."""
         return self._diskLabelType
 
@@ -481,7 +481,7 @@ class S390(Platform):
     def __init__(self, anaconda):
         Platform.__init__(self, anaconda)
 
-    def diskLabelType(self, deviceType):
+    def diskLabelType(self, deviceType, size=None):
         """Return the disk label type as a string."""
         if deviceType == parted.DEVICE_DASD:
             return "dasd"
@@ -523,6 +523,12 @@ class X86(EFI):
         else:
             self._diskLabelType = "msdos"
 
+    def diskLabelType(self, deviceType, size=None):
+        # Use GPT if the disk is larger than 2 TB (size is in MB)
+        if size and size > 2097152:
+            self._diskLabelType = "gpt"
+        return self._diskLabelType
+
     def bootDevice(self):
         if self.isEfi:
             return EFI.bootDevice(self)
diff --git a/storage/formats/disklabel.py b/storage/formats/disklabel.py
index f1fb1f0..f495fc3 100644
--- a/storage/formats/disklabel.py
+++ b/storage/formats/disklabel.py
@@ -121,7 +121,7 @@ class DiskLabel(DeviceFormat):
         """ Return a new, empty parted.Disk instance for this device. """
         log_method_call(self, device=self.device)
         platf = platform.getPlatform(None)
-        labelType = platf.diskLabelType(self.partedDevice.type)
+        labelType = platf.diskLabelType(self.partedDevice.type, size=self.size)
         return parted.freshDisk(device=self.partedDevice, ty=labelType)
 
     @property
diff --git a/storage/partitioning.py b/storage/partitioning.py
index d9a9dc9..3c1e073 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -438,7 +438,7 @@ def clearPartitions(storage):
         if filter(lambda p: p.dependsOn(disk), storage.protectedDevices):
             continue
 
-        nativeLabelType = _platform.diskLabelType(disk.partedDevice.type)
+        nativeLabelType = _platform.diskLabelType(disk.partedDevice.type, size=disk.size)
         if disk.format.labelType == nativeLabelType:
             continue
 
-- 
1.7.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux