-----Original Message-----
From: Richard W.M. Jones [mailto:rjones@redhat.com]
Sent: Thursday, May 28, 2015 7:16 PM
To: Chen, Hanxiao/陈 晗霄
Cc: libguestfs(a)redhat.com
Subject: Re: [Libguestfs] [PATCH v2 04/11] resize: add support for logical partitions
for calculate_surplus
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(a)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)?
My fault, we don't need the surplus of logical partitions.
For resizing extended partition, is in:
[10/11] resize: add support resize extended partition
https://www.redhat.com/archives/libguestfs/2015-May/msg00103.html
For dealing with alignment of logical partitions, is in:
[06/11] resize: add support for logical partitions of calculate_target_partitions
https://www.redhat.com/archives/libguestfs/2015-May/msg00098.html
Regards,
- Chen