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

Brian C. Lane bcl at redhat.com
Wed Apr 23 00:18:45 UTC 2014


On Thu, Mar 20, 2014 at 04:44:02PM +0100, Petr Uzel wrote:
> 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
> 
> 

This looks reasonable to me, but I'd like to hear what IBM thinks about
it.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)



More information about the parted-devel mailing list