Skip to contentSkip to conversation

sfdisk: warn if partition size exceeds 2 TiB limit

PATCH New Petr Uzel 1 participant 1 message Jul 1, 2011 Util-Linux package

lore
Share & tools
lore

Petr Uzel

author
#0 lore raw

PATCH 1/1 sfdisk: warn if partition size exceeds 2 TiB limit

From: Roberto Angelino <[email protected]>

---
 fdisk/sfdisk.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
fdisk/sfdisk.c +11 -0
index 6cd85a2..4ed5d37 100644
@@ -1293,6 +1293,17 @@ partitions_ok(struct disk_desc *z) {
 	    }
     }
 
+    /* Are the partitions within the DOS 2TiB limit? */
+    {
+	for (p = partitions; p < partitions + partno; p++)
+	    if (p->size > (unsigned long) UINT32_MAX) {
+	        my_warn(_("Warning: partition %s of size %lu sectors exceeds "
+		          "msdos 2TiB limit\n"),
+		        PNO(p), p->size);
+	        return 0;
+	    }
+    }
+
     /* At most one chain of DOS extended partitions ? */
     /* It seems that the OS/2 fdisk has the additional requirement
        that the extended partition must be the fourth one */
Signature · 8 lines
1.7.3.4


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode