[Parted-maintainers] Bug#349718: parted: last partition in EFI GPT overlaps alternate table

Steinar H. Gunderson sgunderson at bigfoot.com
Fri Jun 9 21:20:15 BST 2006


tags 349718 + patch
thanks

On Tue, Jan 24, 2006 at 10:56:53PM +0200, Kalle Olavi Niemitalo wrote:
> I think this means parted should have placed the alternative
> partition table at the LBA range 0x12a19e8f-0x12a19eae, rather
> than 0x12a19e8e-0x12a19ead.

The attached patch moves the backup partition table one sector further out;
based on your analysis I'm fairly sure this is the right thing to do, but I
have zero experience with both parted code and GPT partitions, so I'd
appreciate if somebody could review it. It seems to plug the "hole", though,
from what I can see.

/* Steinar */
-- 
Homepage: http://www.sesse.net/
-------------- next part --------------
--- parted-1.7.1.orig/libparted/labels/gpt.c	2006-05-25 19:28:55.000000000 +0200
+++ parted-1.7.1/libparted/labels/gpt.c	2006-06-09 22:10:19.000000000 +0200
@@ -893,7 +893,7 @@
 		gpt->MyLBA = PED_CPU_TO_LE64 (disk->dev->length - 1);
 		gpt->AlternateLBA = PED_CPU_TO_LE64 (1);
 		gpt->PartitionEntryLBA
-			= PED_CPU_TO_LE64 (disk->dev->length - 2 - ptes_size);
+			= PED_CPU_TO_LE64 (disk->dev->length - 1 - ptes_size);
 	} else {
 		gpt->MyLBA = PED_CPU_TO_LE64 (1);
 		gpt->AlternateLBA = PED_CPU_TO_LE64 (disk->dev->length - 1);
@@ -984,7 +984,7 @@
 	if (!ped_device_write (disk->dev, pth_raw, disk->dev->length - 1, 1))
 		goto error_free_ptes;
 	if (!ped_device_write (disk->dev, ptes,
-			       disk->dev->length - 2 - ptes_size / disk->dev->sector_size,
+			       disk->dev->length - 1 - ptes_size / disk->dev->sector_size,
 			       ptes_size / disk->dev->sector_size))
 		goto error_free_ptes;
 


More information about the Parted-maintainers mailing list