Show partition sector data and target partition sector data
in debug_partition.
Also, if --verbose, call debug_partition again before
parted partitions.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
resize/resize.ml | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/resize/resize.ml b/resize/resize.ml
index 8e69d44..ae8339d 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -80,11 +80,15 @@ and partition_type =
| LogicalPartition
| NoTypePartition
-let rec debug_partition p =
+let rec debug_partition ?(sectsize=512L) p =
printf "%s:\n" p.p_name;
printf "\tpartition data: %ld %Ld-%Ld (%Ld bytes)\n"
p.p_part.G.part_num p.p_part.G.part_start p.p_part.G.part_end
p.p_part.G.part_size;
+ printf "\tpartition sector data: %Ld-%Ld\n"
+ (p.p_part.G.part_start /^ sectsize) (p.p_part.G.part_end /^ sectsize);
+ printf "\ttarget partition sector data: %Ld-%Ld \n"
+ p.p_target_start p.p_target_end;
printf "\tbootable: %b\n" p.p_bootable;
printf "\tpartition ID: %s\n"
(match p.p_id with
@@ -545,7 +549,7 @@ read the man page virt-resize(1).
if verbose then (
printf "%d partitions found\n" (List.length partitions);
- List.iter debug_partition partitions
+ List.iter (debug_partition ~sectsize:sectsize) partitions
);
(* Build a data structure describing LVs on the source disk. *)
@@ -1119,6 +1123,11 @@ read the man page virt-resize(1).
calculate_target_partitions 1 start ~create_surplus:true partitions in
+ if verbose then (
+ printf "After calculate target partitions:\n";
+ List.iter (debug_partition ~sectsize:sectsize) partitions
+ );
+
let mbr_part_type x =
match parttype, x.p_part.G.part_num <= 4_l, x.p_type with
(* for GPT, all partitions are regarded as Primary Partition. *)
--
2.1.0