File /proc/mdstat indicates a dying RAID device with an output section such as
File /proc/mdstat indicates a dying RAID device with an output section such as
md3 : active raid1 sdg6[0]
871885632 blocks super 1.0 [2/1] [U_]
bitmap: 4/7 pages [16KB], 65536KB chunk
Note the [U-].
I think that '==' is the wrong tool. That is testing for string
equality, whilst you are looking for a partial match. This is what I was
able to get working after hacking on it for a minute or two:
#! /bin/bash -u
set -x
BAD=0;
while read L;
do if [[ $L =~ \[(U_|_U|__)\] ]]; then BAD=1; break; fi;
done < /proc/mdstat;
echo $BAD
I think that '==' is the wrong tool.
I would like to scan /proc/mdstat and set a flag if [U-], [-U] or [--]
occur.
File /proc/mdstat indicates a dying RAID device with an output section such as
md3 : active raid1 sdg6[0]
871885632 blocks super 1.0 [2/1] [U_]
bitmap: 4/7 pages [16KB], 65536KB chunk
Note the [U-].
The "-" says /dev/sdh is dead. I would like to scan
/proc/mdstat and set a flag if [U-], [-U] or [--] occur.
while read L;
do if [[ $L == *"[U-]"* ]]; then B=1; fi;
if [[ $L == *"[-U]"* ]]; then B=1; fi;
if [[ $L == *"[--]"* ]]; then B=1; fi;
done < /proc/mdstat;
File /proc/mdstat indicates a dying RAID device with an output section such as
md3 : active raid1 sdg6[0]
871885632 blocks super 1.0 [2/1] [U_]
bitmap: 4/7 pages [16KB], 65536KB chunk
Note the [U-]. The "-" says /dev/sdh is dead. I would like to scan /proc/mdstat and set a flag if [U-], [-U] or [--] occur.
My current attempt is
#! /bin/bash -u
set -x
BAD=0;
while read L;
do if [[ $L == *"[U-]"* ]]; then B=1; fi;
if [[ $L == *"[-U]"* ]]; then B=1; fi;
if [[ $L == *"[--]"* ]]; then B=1; fi;
done < /proc/mdstat;
echo $BAD
Far from elegant, but I still can't get it to work.
The trace contains lines such as
+ 1164021 1164021 [4]read L
+ 1164021 1164021 [5][[ 20970368 blocks super 1.0 [2/1] [U_] == *\[\U\-\]* ]]
The test always fails, but I can't see why. Any hint would be very welcome.
On Tue, Dec 24, 2024 at 15:45:31 +0100, Roger Price wrote:
md3 : active raid1 sdg6[0]
871885632 blocks super 1.0 [2/1] [U_]
bitmap: 4/7 pages [16KB], 65536KB chunk
Note the [U-].
There isn't any [U-] in that output. There is [U_].
File /proc/mdstat indicates a dying RAID device with an output
section such as
md3 : active raid1 sdg6[0]
871885632 blocks super 1.0 [2/1] [U_]
bitmap: 4/7 pages [16KB], 65536KB chunk
Note the [U-]. The "-" says /dev/sdh is dead. I would like to scan /proc/mdstat and set a flag if [U-], [-U] or [--] occur.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (0 / 16) |
Uptime: | 168:47:44 |
Calls: | 10,385 |
Calls today: | 2 |
Files: | 14,057 |
Messages: | 6,416,551 |