[Top][All Lists]

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

[PATCH] GPT PMBR disk >2TB fix

From: Matt Domsch
Subject: [PATCH] GPT PMBR disk >2TB fix
Date: Mon, 8 Nov 2004 10:45:03 -0600
User-agent: Mutt/1.4.1i

Patch below (applies against 1.6.11 and 1.6.16 at least) sets the
SizeInLBA field in the Protective MBR on GPT disks to be 0xFFFFFFFF if
the disk size is really larger than that.  This is to be consistent
with the EFI Specification.

Necessary to prevent overflowing this field on really large disks.
The 2.6.10 Linux kernel partitioning code will start checking
this value for sanity, and 0xFFFFFFFF is a special value there now.

Matt Domsch
Sr. Software Engineer, Lead Engineer
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

--- parted-1.6.11/libparted/disk_gpt.c~ Wed Mar 10 16:11:42 2004
+++ parted-1.6.11/libparted/disk_gpt.c  Mon Nov  8 09:37:17 2004
@@ -689,7 +689,10 @@ _write_pmbr(PedDevice * dev)
        pmbr.PartitionRecord[0].EndSector   = 0xFF;
        pmbr.PartitionRecord[0].EndTrack    = 0xFF;
        pmbr.PartitionRecord[0].StartingLBA = PED_CPU_TO_LE32(1);
-       pmbr.PartitionRecord[0].SizeInLBA   = PED_CPU_TO_LE32(dev->length - 1);
+       if ((dev->length - 1ULL) > 0xFFFFFFFFULL) 
+               pmbr.PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32(0xFFFFFFFF);
+       else
+               pmbr.PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32(dev->length 
- 1UL);
        return ped_device_write(dev, &pmbr, GPT_PMBR_LBA, GPT_PMBR_SECTORS);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]