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

Petr Uzel puzel at suse.cz
Thu Jul 21 14:36:36 UTC 2016


On Tue, Apr 22, 2014 at 05:18:45PM -0700, Brian C. Lane wrote:
> 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.

For the record, this issue has been meanwhile addressed
by following commit:

commit 4126d0292c75cf7d50a2f4e9d485a52b5beafccc
Author: Wang Dong <dongdwdw at linux.vnet.ibm.com>
Date:   Tue Jun 14 12:19:40 2016 +0200

    libparted/dasd: correct the offset where the first partition
    begins



-- 
Petr Uzel
TL SUSE L3 Team 2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20160721/32fbb676/attachment.sig>


More information about the parted-devel mailing list