Re: Bash expression to detect dying RAID devices

2024-12-24 Thread Charles Curley
On Tue, 24 Dec 2024 15:45:31 +0100 (CET) Roger Price wrote: > 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-]. Th

Re: Bash expression to detect dying RAID devices

2024-12-24 Thread Roger Price
On Tue, 24 Dec 2024, Greg Wooledge wrote: 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_].

Re: Bash expression to detect dying RAID devices

2024-12-24 Thread Andy Smith
Hi, On Tue, Dec 24, 2024 at 03:45:31PM +0100, Roger Price wrote: > I would like to scan /proc/mdstat and set a flag if [U-], [-U] or [--] > occur. Others have pointed out your '-' vs '_' confusion. But are you sure you wouldn't rather just rely on the "mdadm --monitor" command that emails you whe

Re: Bash expression to detect dying RAID devices

2024-12-24 Thread Nicolas George
Roberto C. Sánchez (12024-12-24): > I think that '==' is the wrong tool. string1 == string2 string1 = string2 True if the strings are equal. = should be used with the test command for POSIX conformance. When used with the [[ command,

Re: Bash expression to detect dying RAID devices

2024-12-24 Thread Greg Wooledge
On Tue, Dec 24, 2024 at 10:37:29 -0500, Roberto C. Sánchez wrote: > 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

Re: Bash expression to detect dying RAID devices

2024-12-24 Thread Roberto C . Sánchez
Hi Roger, On Tue, Dec 24, 2024 at 03:45:31PM +0100, Roger Price wrote: > 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 [

Re: Bash expression to detect dying RAID devices

2024-12-24 Thread Stefan Monnier
> 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 can't see a "[U-]", only a "[U_]" Stefan

Re: Bash expression to detect dying RAID devices

2024-12-24 Thread Greg Wooledge
On Tue, Dec 24, 2024 at 15:45:31 +0100, Roger Price wrote: > 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-]. There i

Re: Bash expression to detect dying RAID devices

2024-12-24 Thread Nicolas George
Roger Price (12024-12-24): > File /proc/mdstat indicates a dying RAID device with an output section such > as Maybe try to find a more script-friendly source for that information in /sys/class/block/md127/md/? Regards, -- Nicolas George

Bash expression to detect dying RAID devices

2024-12-24 Thread Roger Price
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