All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Justinas Naruševičius" <contact@junaru.com>
To: linux-raid@vger.kernel.org
Subject: Possibly wrong exit status for mdadm --misc --test
Date: Mon, 15 Jul 2024 07:59:36 +0300	[thread overview]
Message-ID: <ZpSsuO1hhmCKrexX@bbqfortress> (raw)

Hello,

After reboot raid1 array with one failed drive is reported as degraded (failed drive reported as removed):

> root@rico ~ # mdadm --detail /dev/md127
> /dev/md127:
>            Version : 1.2
>      Creation Time : Thu Feb 21 13:28:21 2019
>         Raid Level : raid1
>         Array Size : 57638912 (54.97 GiB 59.02 GB)
>      Used Dev Size : 57638912 (54.97 GiB 59.02 GB)
>       Raid Devices : 2
>      Total Devices : 1
>        Persistence : Superblock is persistent
>
>        Update Time : Mon Jul 15 07:25:12 2024
>              State : clean, degraded
>     Active Devices : 1
>    Working Devices : 1
>     Failed Devices : 0
>      Spare Devices : 0
>
> Consistency Policy : resync
>
>               Name : sabretooth:root-raid1
>               UUID : 1f1f3113:0b87a325:b9ad1414:0fe55600
>             Events : 323644
>
>     Number   Major   Minor   RaidDevice State
>        -       0        0        0      removed
>        2       8        2        1      active sync   /dev/sda2


However testing such state with mdadm --misc --test returns 0


> root@rico ~ # mdadm --misc --test /dev/md127
> root@rico ~ # echo $?
> 0
> root@rico ~ #

From man page:

> if the --test option is given, then the exit status
>               will be:
>               0      The array is functioning normally.
>               1      The array has at least one failed device.
>               2      The array has multiple failed devices such that it is unusable.
>               4      There was an error while trying to get information about the device.

From --help output:

> root@rico ~ # mdadm --misc --help| grep test
>   --test        -t   : exit status 0 if ok, 1 if degrade, 2 if dead, 4 if missing

Would expect the exit code to be 1.

Can anyone confirm this is expected behaviour?

> root@rico ~ # mdadm -V
> mdadm - v4.3 - 2024-02-15
> root@rico ~ #

--

Regards,
Justinas Naruševičius

             reply	other threads:[~2024-07-15  4:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-15  4:59 Justinas Naruševičius [this message]
2024-07-15 14:34 ` Possibly wrong exit status for mdadm --misc --test Mariusz Tkaczyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZpSsuO1hhmCKrexX@bbqfortress \
    --to=contact@junaru.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.