From 532fd1d60df306e204bae79c5158ca2302739966 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 8 Jul 2016 11:44:16 +0200 Subject: sync libparted view with diskdrake one in order to prevent overlapping errors when adding partitions: (b/c libparted doesn't know that diskdrake already removed the partitions in its memory view) "failed to add partition #1 on /dev/vda" "Error: Can't have overlapping partitions." "add_partition failed" --- perl-install/partition_table/gpt.pm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'perl-install/partition_table/gpt.pm') diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm index c5af99275..47cfa842e 100644 --- a/perl-install/partition_table/gpt.pm +++ b/perl-install/partition_table/gpt.pm @@ -79,6 +79,9 @@ sub write { $partitions_killed = 1; } + # sync libparted view with diskdrake one in order to prevent overlapping errors when adding partitions: + c::disk_delete_all($hd->{file}) if delete $hd->{sync_with_libparted}; + foreach (@{$hd->{will_tell_kernel}}) { my ($action, $part_number, $o_start, $o_size) = @$_; my ($part) = grep { $_->{start} == $o_start && $_->{size} == $o_size } @$pt; @@ -113,6 +116,8 @@ sub write { sub initialize { my ($class, $hd) = @_; + # sync libparted view with diskdrake one in order to prevent overlapping errors when adding partitions: + $hd->{sync_with_libparted} = 1; # part_number starts at 1 my @raw = map { +{ part_number => $_ + 1 } } 0..$nb_primary-2; $hd->{primary} = { raw => \@raw }; -- cgit v1.2.1