Fixes for RAID with inactive devices
This commit is contained in:
@@ -38,6 +38,12 @@ namespace Barsik
|
||||
// 2930264896 blocks super 1.0 [2/2] [UU]
|
||||
// we need last characters in brackets []
|
||||
int last_pos = lines[i + 1].LastIndexOf(']');
|
||||
if (last_pos == -1)
|
||||
{
|
||||
// This can happen for inactive RAID devices. Skip this device for now
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
int pos;
|
||||
for (pos = last_pos; pos > 0 && lines[i + 1][pos] != '['; pos--) ;
|
||||
if (lines[i + 1][pos] != '[') knownRaids.Add(0);
|
||||
@@ -94,7 +100,8 @@ namespace Barsik
|
||||
var lines = File.ReadAllLines("/proc/mdstat");
|
||||
for (int i = 0; i < lines.Length;)
|
||||
{
|
||||
if (lines[i].StartsWith("md") && i < lines.Length - 1)
|
||||
if (lines[i].StartsWith("md") && i < lines.Length - 1 &&
|
||||
lines[i + 1].LastIndexOf(']') != -1)
|
||||
{
|
||||
// we found device description
|
||||
// second line of it is as follows:
|
||||
|
||||
Reference in New Issue
Block a user