diff options
Diffstat (limited to 'perl-install/fsedit.pm')
-rw-r--r-- | perl-install/fsedit.pm | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index bc2182255..5a25d55b3 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -60,7 +60,7 @@ sub typeOfPart { typeFromMagic(devices::make($_[0]), @partitions_signatures) } #-###################################################################################### sub hds { my ($drives, $flags) = @_; - my (@hds, @lvms); + my (@hds, @lvms, @raid); my $rc; foreach (@$drives) { @@ -104,7 +104,42 @@ sub hds { push @{$lvm->{disks}}, $_; } } - \@hds, \@lvms; + if ((my @parts = grep { isRAID($_) } map { partition_table::get_normal_parts($_) } @hds) && detect_devices::raidAutoStart()) { + my @mdstat = cat_("/proc/mdstat"); + for (my $i=0 ; $i<@mdstat ; $i++) { + next if $mdstat[$i] !~ /^md(.).* ([^ \[\]]+) ([^ ]+\[[^ \]]+\])(.*)$/; + my ($nb, $level, $partcar, $partcdr) = ($1, $2, $3, $4); + $level =~ /raid(.)/ and $level = $1; + $partcar =~ /([^\[]+)/ or next; + my @thisparts = ( $1 ); + while ($partcdr =~ /\s*([^\[]+)[^\]]+\](.*)/) { + push @thisparts, $1; + $partcdr = $2; + } + my $chunks = $mdstat[$i+1] =~ /([^ ]+) chunks/ ? $1 : "64k"; + my @disks; + foreach my $part (@parts) { + if (grep /$part->{device}/, @thisparts) { + $part->{raid} = $nb; + delete $part->{mntpoint}; + push @disks, $part; + } + } + my $type = typeOfPart("md$nb"); + my $notformat = 0; + log::l("RAID: found md$nb (raid $level) chunks $chunks ", $type ? "type $type " : "", "with parts ", join(", ", @thisparts)); + if (!$type) { + $type = 0x83; + $notformat = 1; + } + $raid[$nb] = { 'chunk-size' => $chunks, type => $type, disks => \@disks, + device => "md$nb", notFormatted => $notformat, level => $level }; + } + require raid; + raid::update(@raid); + } + + \@hds, \@lvms, \@raid; } sub readProcPartitions { |