summaryrefslogtreecommitdiffstats
path: root/perl-install/fsedit.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/fsedit.pm')
-rw-r--r--perl-install/fsedit.pm20
1 files changed, 17 insertions, 3 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index e53648a37..d209b0196 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -82,11 +82,11 @@ sub recompute_loopbacks {
}
sub raids {
- my ($hds) = @_;
+ my ($hds, $raw_hds) = @_;
my @parts = fs::get::hds_fstab(@$hds);
- my @l = grep { isRawRAID($_) } @parts or return [];
+ my @l = grep { isRawRAID($_) } ( @parts, @$raw_hds ) or return [];
log::l("looking for raids in " . join(' ', map { $_->{device} } @l));
@@ -197,6 +197,20 @@ sub get_hds {
foreach my $hd (@drives) {
$hd->{readonly} = $flags->{readonly};
+ #- We only create RAID components in disk partitions, but users may have used
+ #- mdadm directly to create them on raw disk devices. Detect that now, before
+ #- looking for a partition table (which is likely to fail badly - mga#26707).
+ if (my $type = fs::type::type_subpart_from_magic($hd)) {
+ if (isRawRAID($type)) {
+ #- Add the necessary information to the raw device to allow the RAID
+ #- array to be properly characterised in diskdrake.
+ put_in_hash($hd, $type);
+ $hd->{size} = $hd->{totalsectors};
+ push @raw_hds, $hd;
+ next;
+ }
+ }
+
eval { partition_table::raw::test_for_bad_drives($hd) if !$flags->{no_bad_drives} };
if (my $err = $@) {
log::l("test_for_bad_drives returned $err");
@@ -310,7 +324,7 @@ Do you agree to lose all the partitions?
}
#- detect raids before LVM allowing LVM on raid
- my $raids = raids(\@hds);
+ my $raids = raids(\@hds, \@raw_hds);
my $all_hds = { %{ fs::get::empty_all_hds() }, hds => \@hds, raw_hds => \@raw_hds, lvms => [], raids => $raids };
$all_hds->{lvms} = [ lvms($all_hds) ];