[parted-devel] [RFC PATCH] dasd: reserve first 2 tracks for VTOC

Petr Uzel petr.uzel at suse.cz
Thu Mar 20 15:44:02 UTC 2014


Attempt to create a partition on ECKD DASD resulted in a rather cryptic
error if the partition placed at the very start of the disk:

linux:~ # parted /dev/dasdb mkpart ext2 0G 2G
BUG: specified free space extent for deleting doesn't match free space
currently shown in FMT7 DSCB!
exiting...

This patch reserves first two tracks on the disk, preventing
parted to overwrite VTOC metadata. This is what fdasd utility
seems to be doing.

* libparted/labels/dasd.c (_primary_constraint):
Reserve frist two tracks on the disk for VTOC metadata.
---
 libparted/labels/dasd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index f5b0f2b..4593b10 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -805,7 +805,8 @@ _primary_constraint (PedDisk* disk)
 	if (!ped_alignment_init (&end_align, -1,
 						     disk->dev->hw_geom.sectors * sector_size))
 		return NULL;
-	if (!ped_geometry_init (&max_geom, disk->dev, 0, disk->dev->length))
+	if (!ped_geometry_init (&max_geom, disk->dev, 2 * disk->dev->hw_geom.sectors * sector_size,
+				disk->dev->length - 2 * disk->dev->hw_geom.sectors * sector_size))
 		return NULL;
 
 	return ped_constraint_new(&start_align, &end_align, &max_geom,
-- 
1.8.1.4




More information about the parted-devel mailing list