summaryrefslogtreecommitdiffstats
path: root/perl-install/lvm.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/lvm.pm')
-rw-r--r--perl-install/lvm.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index 6f9ac2a20..46201f4a1 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -80,6 +80,11 @@ sub get_lv_size {
to_int(run_program::get_stdout('lvm2', 'lvs', '--noheadings', '--nosuffix', '--units', 's', '-o', 'lv_size', "/dev/$lvm_device"));
}
+sub lv_nb_segments {
+ my ($lv) = @_;
+ to_int(run_program::get_stdout('lvm2', 'lvs', '--noheadings', '--nosuffix', '-o', 'seg_count', "/dev/$lv->{device}"));
+}
+
sub get_lvs {
my ($lvm) = @_;
my @l = run_program::get_stdout('lvm2', 'lvs', '--noheadings', '--nosuffix', '--units', 's', '-o', 'lv_name', $lvm->{VG_name}) =~ /(\S+)/g;
@@ -139,6 +144,12 @@ sub lv_create {
suggest_lv_name($lvm, $lv);
$lv->{device} = "$lvm->{VG_name}/$lv->{lv_name}";
lvm_cmd_or_die('lvcreate', '--size', int($lv->{size} / 2) . 'k', '-n', $lv->{lv_name}, $lvm->{VG_name});
+
+ if ($lv->{mntpoint} eq '/boot' && lv_nb_segments($lv) > 1) {
+ lvm_cmd_or_die('lvremove', '-f', "/dev/$lv->{device}");
+ die "/boot on multiple segments Logical Volume is useless\n";
+ }
+
$lv->{size} = get_lv_size($lv->{device}); #- the created size is smaller than asked size
set_isFormatted($lv, 0);
my $list = $lvm->{primary}{normal} ||= [];