All of lore.kernel.org
 help / color / mirror / Atom feed
* Programmatically check "global" RAID state?
@ 2020-07-16 13:38 Ian Pilcher
  2020-07-16 13:54 ` Reindl Harald
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Pilcher @ 2020-07-16 13:38 UTC (permalink / raw)
  To: linux-raid

I want to write a quick script/program for my NAS that will initiate a
check of one of my RAID devices every night.  However, I want it to skip
the check if either of the following is true:

* Another check/resync is in process on any RAID device, or

* Any of the RAID devices on the system are unhealthy (degraded or
   failed).

Is there any way to programmatically check the "global" status of the
RAID subsystem like this, or am I stuck iterating through all of the
devices (likely via sysfs) and checking them individually?  (I'm pretty
sure that I am "stuck" but wanted to check just in case.)

Thanks!

-- 
========================================================================
                  In Soviet Russia, Google searches you!
========================================================================

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Programmatically check "global" RAID state?
  2020-07-16 13:38 Programmatically check "global" RAID state? Ian Pilcher
@ 2020-07-16 13:54 ` Reindl Harald
  0 siblings, 0 replies; 2+ messages in thread
From: Reindl Harald @ 2020-07-16 13:54 UTC (permalink / raw)
  To: Ian Pilcher, linux-raid



Am 16.07.20 um 15:38 schrieb Ian Pilcher:
> I want to write a quick script/program for my NAS that will initiate a
> check of one of my RAID devices every night.  However, I want it to skip
> the check if either of the following is true:
> 
> * Another check/resync is in process on any RAID device, or
> 
> * Any of the RAID devices on the system are unhealthy (degraded or
>   failed).
> 
> Is there any way to programmatically check the "global" status of the
> RAID subsystem like this, or am I stuck iterating through all of the
> devices (likely via sysfs) and checking them individually?  (I'm pretty
> sure that I am "stuck" but wanted to check just in case.)

cat /proc/mdstat | grep -P 'cond1|cond2|cond3' should do the trick, if
the output is empty: go

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-16 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-16 13:38 Programmatically check "global" RAID state? Ian Pilcher
2020-07-16 13:54 ` Reindl Harald

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.