[Libguestfs] [PATCH v2 04/11] resize: add support for logical partitions for calculate_surplus

Richard W.M. Jones rjones at redhat.com
Thu May 28 11:15:32 UTC 2015


On Thu, May 28, 2015 at 12:11:17PM +0100, Richard W.M. Jones wrote:
> On Wed, May 20, 2015 at 06:51:30AM -0400, Chen Hanxiao wrote:
> > Add support for logical partitions.
> >  - count number of logical_partition (we've split partitions list)
> >  - don't count size of extended partition
> >    For it'll duplicate with logical partition, we'll count it later
> >  - we need at leat 1 gap between logical partitions.
> >    so --aligment=1 will be increased by 1
> > 
> > Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> > ---
> >  resize/resize.ml | 17 +++++++++++++++--
> >  1 file changed, 15 insertions(+), 2 deletions(-)
> > 
> > diff --git a/resize/resize.ml b/resize/resize.ml
> > index 92f7304..a0ed713 100644
> > --- a/resize/resize.ml
> > +++ b/resize/resize.ml
> > @@ -741,8 +741,10 @@ read the man page virt-resize(1).
> >      (* We need some overhead for partitioning. *)
> >      let overhead =
> >        let maxl64 = List.fold_left max 0L in
> > +      (* We need at least 1 sector gap between logical partitions *)
> > +      let alignment = if alignment = 1L then 2L else alignment in
> >  
> > -      let nr_partitions = List.length partitions in
> > +      let nr_partitions = List.length partitions + List.length logical_partitions in
> 
> I don't understand this at all.  Why do logical partitions count
> towards the surplus?  I don't think they do.

OK I guess the answer is because logical partitions now need their
own alignment (within the extended partition), and that contributes
to the required surplus for the disk.

Do we resize the extended partition sufficiently (eg. if the extended
partition has 100 aligned logical partitions)?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list