summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/fsedit.pm10
-rw-r--r--perl-install/lvm.pm11
2 files changed, 16 insertions, 5 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 2b5a81cf0..dcc87b6db 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -385,13 +385,13 @@ sub check_mntpoint {
cdie N("You've selected a software RAID partition as root (/).
No bootloader is able to handle this without a /boot partition.
Please be sure to add a /boot partition") if $mntpoint eq "/" && isRAID($part) && !fs::get::has_mntpoint("/boot", $all_hds);
+
+ #- NB: if the LV doesn't exist, lv_nb_segments returns undef
die N("You can not use a LVM Logical Volume for mount point %s", $mntpoint)
- if $mntpoint eq '/boot' && isLVM($part);
+ if $mntpoint eq '/boot' && isLVM($part) && lvm::lv_nb_segments($part) > 1;
cdie N("You've selected a LVM Logical Volume as root (/).
-The bootloader is not able to handle this without a /boot partition.
-Please be sure to add a /boot partition") if $mntpoint eq "/" && isLVM($part) && !fs::get::has_mntpoint("/boot", $all_hds);
- cdie N("You may not be able to install lilo (since lilo does not handle a LV on multiple PVs)")
- if 0; # arch() =~ /i.86/ && $mntpoint eq '/' && isLVM($hd) && @{$hd->{disks} || []} > 1;
+The bootloader is not able to handle this when the volume spans physical volumes.
+You should create a /boot partition first") if $mntpoint eq "/" && isLVM($part) && lvm::lv_nb_segments($part) != 1 && !fs::get::has_mntpoint("/boot", $all_hds);
cdie N("This directory should remain within the root filesystem")
if member($mntpoint, qw(/root));
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} ||= [];