All of lore.kernel.org
 help / color / mirror / Atom feed
* --detail --export doesn't show all properties
@ 2021-07-05 12:20 BW
       [not found] ` <CAOaDVC6yNDOVAvMu4gBuc+sTH50UrXD3z4sODa1NtFsV9SEZ9Q@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: BW @ 2021-07-05 12:20 UTC (permalink / raw)
  To: linux-raid

This is an example of the --export output:

# mdadm --detail --export /dev/md127
MD_DEVICES=3
MD_METADATA=1.2
MD_UUID=70bc1acd:f879f9cd:dca76d79:d9ce624a
MD_DEVNAME=debian:R5
MD_NAME=debian:R5
MD_DEVICE_dev_sdc_ROLE=spare
MD_DEVICE_dev_sdc_DEV=/dev/sdc
MD_DEVICE_dev_sdd_ROLE=spare
MD_DEVICE_dev_sdd_DEV=/dev/sdd
MD_DEVICE_dev_sdb_ROLE=spare
MD_DEVICE_dev_sdb_DEV=/dev/sdb

This is the same command in "normal" format-output:

# mdadm --detail /dev/md127
/dev/md127:
           Version : 1.2
        Raid Level : raid5
     Total Devices : 3
       Persistence : Superblock is persistent
             State : inactive
   Working Devices : 3
              Name : debian:R5
              UUID : 70bc1acd:f879f9cd:dca76d79:d9ce624a
            Events : 358
    Number   Major   Minor   RaidDevice
       -       8       32        -        /dev/sdc
       -       8       48        -        /dev/sdd
       -       8       16        -        /dev/sdb


It would be nice if the --export included the properties "Raid Level",
"State", "Persistence" (the first two most important).

Another thing, is it correct that "MD_DEVNAME" and "MD_NAME" should be the same?
Or perhaps "MD_NAME" should show the kernel/Device-Mapper name e.g.
"md127", that would be helpful (by the way, what do you call this mdxx
name?)

Thanks
Brian, Denmark

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

* Re: --detail --export doesn't show all properties
       [not found] ` <CAOaDVC6yNDOVAvMu4gBuc+sTH50UrXD3z4sODa1NtFsV9SEZ9Q@mail.gmail.com>
@ 2021-07-07 11:08   ` BW
  2021-07-07 22:25     ` NeilBrown
  0 siblings, 1 reply; 7+ messages in thread
From: BW @ 2021-07-07 11:08 UTC (permalink / raw)
  To: Fine Fan; +Cc: linux-raid

I'm using ver. mdadm-4.1-24.3.1.x86_64 / openSUSE kernel 15.3

It's only when the array is active you get a raid-level, if the array
is inactive, as in my example, you will not get the raid-level (and
State, Persistence).


On Tue, Jul 6, 2021 at 11:48 AM Fine Fan <ffan@redhat.com> wrote:
>
> Hi Brain,
>
> I am wondering which version did you use?
> As you requested three items here:
> 1."Raid Level",<<<<<<====== I have the "MD_LEVEL" line in --export output.
> 2."State"
> 3."Persistence"
>
> On my side , I am using  :
>  [root@Fedroa34Server ~]# cat /etc/redhat-release
> Fedora release 34 (Thirty Four)
> [root@Fedroa34Server ~]# uname -a
> Linux Fedroa34Server.localdomain 5.11.12-300.fc34.x86_64 #1 SMP Wed Apr 7 16:31:13 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> [root@Fedroa34Server ~]# rpm -q mdadm
> mdadm-4.1-7.fc34.x86_64
> [root@Fedroa34Server ~]#
>
>  It has "MD_LEVEL" in the --export output  , but the "State" and "Persistence" are not there.
>
> [root@Fedroa34Server ~]# mdadm --detail --export /dev/md126
> MD_LEVEL=raid1    <<<<<<<<<============ I got the MD_LEVEL here.
> MD_DEVICES=2
> MD_CONTAINER=/dev/md/imsm
> MD_MEMBER=0
> MD_UUID=8e3f51e6:d136a0b1:247281c2:ae7f0456
> MD_DEVNAME=Volume0
> MD_DEVICE_ev_sda_ROLE=0
> MD_DEVICE_ev_sda_DEV=/dev/sda
> MD_DEVICE_ev_sdb_ROLE=1
> MD_DEVICE_ev_sdb_DEV=/dev/sdb
>
> [root@Fedroa34Server ~]# mdadm --detail /dev/md126
> /dev/md126:
>          Container : /dev/md/imsm, member 0
>         Raid Level : raid1
>         Array Size : 234428416 (223.57 GiB 240.05 GB)
>      Used Dev Size : 234428416 (223.57 GiB 240.05 GB)
>       Raid Devices : 2
>      Total Devices : 2
>
>              State : clean
>     Active Devices : 2
>    Working Devices : 2
>     Failed Devices : 0
>      Spare Devices : 0
>
> Consistency Policy : resync
>
>
>               UUID : 8e3f51e6:d136a0b1:247281c2:ae7f0456
>     Number   Major   Minor   RaidDevice State
>        1       8        0        0      active sync   /dev/sda
>        0       8       16        1      active sync   /dev/sdb
> [root@Fedroa34Server ~]#
>
>
>
>
>
>
> On Mon, Jul 5, 2021 at 8:21 PM BW <m40636067@gmail.com> wrote:
>>
>> This is an example of the --export output:
>>
>> # mdadm --detail --export /dev/md127
>> MD_DEVICES=3
>> MD_METADATA=1.2
>> MD_UUID=70bc1acd:f879f9cd:dca76d79:d9ce624a
>> MD_DEVNAME=debian:R5
>> MD_NAME=debian:R5
>> MD_DEVICE_dev_sdc_ROLE=spare
>> MD_DEVICE_dev_sdc_DEV=/dev/sdc
>> MD_DEVICE_dev_sdd_ROLE=spare
>> MD_DEVICE_dev_sdd_DEV=/dev/sdd
>> MD_DEVICE_dev_sdb_ROLE=spare
>> MD_DEVICE_dev_sdb_DEV=/dev/sdb
>>
>> This is the same command in "normal" format-output:
>>
>> # mdadm --detail /dev/md127
>> /dev/md127:
>>            Version : 1.2
>>         Raid Level : raid5
>>      Total Devices : 3
>>        Persistence : Superblock is persistent
>>              State : inactive
>>    Working Devices : 3
>>               Name : debian:R5
>>               UUID : 70bc1acd:f879f9cd:dca76d79:d9ce624a
>>             Events : 358
>>     Number   Major   Minor   RaidDevice
>>        -       8       32        -        /dev/sdc
>>        -       8       48        -        /dev/sdd
>>        -       8       16        -        /dev/sdb
>>
>>
>> It would be nice if the --export included the properties "Raid Level",
>> "State", "Persistence" (the first two most important).
>>
>> Another thing, is it correct that "MD_DEVNAME" and "MD_NAME" should be the same?
>> Or perhaps "MD_NAME" should show the kernel/Device-Mapper name e.g.
>> "md127", that would be helpful (by the way, what do you call this mdxx
>> name?)
>>
>> Thanks
>> Brian, Denmark
>>
>
>
> --
>
>
>
>
> Fine Fan
>
> Kernel Storage QE
>
> ffan@redhat.com
>
> T: 8388117
> M: (+86)-15901470329

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

* Re: --detail --export doesn't show all properties
  2021-07-07 11:08   ` BW
@ 2021-07-07 22:25     ` NeilBrown
  2021-07-08  5:18       ` BW
  0 siblings, 1 reply; 7+ messages in thread
From: NeilBrown @ 2021-07-07 22:25 UTC (permalink / raw)
  To: BW; +Cc: Fine Fan, linux-raid

On Wed, 07 Jul 2021, BW wrote:
> I'm using ver. mdadm-4.1-24.3.1.x86_64 / openSUSE kernel 15.3
> 
> It's only when the array is active you get a raid-level, if the array
> is inactive, as in my example, you will not get the raid-level (and
> State, Persistence).
> 

Yes, that is correct.
When the array is inactive, it is not an active array.  It has no level
or state.  It is just a bunch of drives.

If you want to see what might happen when you activate the array, you
need to --examine the indiividual drives.

NeilBrown

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

* Re: --detail --export doesn't show all properties
  2021-07-07 22:25     ` NeilBrown
@ 2021-07-08  5:18       ` BW
  2021-07-08 23:52         ` NeilBrown
  0 siblings, 1 reply; 7+ messages in thread
From: BW @ 2021-07-08  5:18 UTC (permalink / raw)
  To: NeilBrown; +Cc: Fine Fan, linux-raid

1: Just because the array is inactive doesn't mean the information is
not valuable, actually it's even more,  as your most likely needs your
attention
2: The information is available and is printed when not doing --export
3: I'm aware of --examine, but why use it when the kernel already read
the superblocks when the disks were initialize, the information is
already there

In my view I don't see any argument for not including the raid level
etc. when the raid is inactive.

I'm building a administration-system where the use of --export is very
handy. I can do work-around calling additional commands to get the
info, but it would be nice if --export just provided the information
in the first place.

On Thu, Jul 8, 2021 at 12:25 AM NeilBrown <neilb@suse.de> wrote:
>
> On Wed, 07 Jul 2021, BW wrote:
> > I'm using ver. mdadm-4.1-24.3.1.x86_64 / openSUSE kernel 15.3
> >
> > It's only when the array is active you get a raid-level, if the array
> > is inactive, as in my example, you will not get the raid-level (and
> > State, Persistence).
> >
>
> Yes, that is correct.
> When the array is inactive, it is not an active array.  It has no level
> or state.  It is just a bunch of drives.
>
> If you want to see what might happen when you activate the array, you
> need to --examine the indiividual drives.
>
> NeilBrown

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

* Re: --detail --export doesn't show all properties
  2021-07-08  5:18       ` BW
@ 2021-07-08 23:52         ` NeilBrown
  2021-07-09  6:00           ` BW
  0 siblings, 1 reply; 7+ messages in thread
From: NeilBrown @ 2021-07-08 23:52 UTC (permalink / raw)
  To: BW; +Cc: Fine Fan, linux-raid

On Thu, 08 Jul 2021, BW wrote:
> 1: Just because the array is inactive doesn't mean the information is
> not valuable, actually it's even more,  as your most likely needs your
> attention
> 2: The information is available and is printed when not doing --export

Ahh... I missed that.  My memory is that when the array is inactive, the
md driver really don't know anything about the array.  It doesn't find
out until it reads the metadata, and it does that as it activates the
array.
But looking at your sample output I see does, as you say, give a raid
level for an inactive array.

But looking at the code, it should do exactly the same thing for
--export, and --brief, and normal.
It determines the raid level:

        if (inactive && info)
                str = map_num(pers, info->array.level);
        else
                str = map_num(pers, array.level);

and then report 'str' in all 3 cases (possibly substituting "-unknown-"
or "container" for NULL) providing that array.raid_disks is non-zero -
which it is in your example.
So I cannot see how you would get the results that you report.

Do you know how you got the array in this inactive state? I could then
experiment and see if I can reproduce your result.

NeilBrown

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

* Re: --detail --export doesn't show all properties
  2021-07-08 23:52         ` NeilBrown
@ 2021-07-09  6:00           ` BW
  2021-07-09  6:13             ` NeilBrown
  0 siblings, 1 reply; 7+ messages in thread
From: BW @ 2021-07-09  6:00 UTC (permalink / raw)
  To: NeilBrown; +Cc: Fine Fan, linux-raid

It was a 4-drive RAID5 array missing one drive completely.

But I expected is was an easy thing to fix as "mdadm --detail
/dev/md1xxx" will show the details fine (out of the same information
in memory). But if it's not, maybe just make a note about it and move
on with more important things. I wouldn't be surprised if I'm the only
one ever needing this feature. And I already implemented a work-around
in my storage-management-system be getting the RAID level etc. from
/proc/mdstat first. A pain to serialize of course but it works now.

On Fri, Jul 9, 2021 at 1:52 AM NeilBrown <neilb@suse.de> wrote:
>
> On Thu, 08 Jul 2021, BW wrote:
> > 1: Just because the array is inactive doesn't mean the information is
> > not valuable, actually it's even more,  as your most likely needs your
> > attention
> > 2: The information is available and is printed when not doing --export
>
> Ahh... I missed that.  My memory is that when the array is inactive, the
> md driver really don't know anything about the array.  It doesn't find
> out until it reads the metadata, and it does that as it activates the
> array.
> But looking at your sample output I see does, as you say, give a raid
> level for an inactive array.
>
> But looking at the code, it should do exactly the same thing for
> --export, and --brief, and normal.
> It determines the raid level:
>
>         if (inactive && info)
>                 str = map_num(pers, info->array.level);
>         else
>                 str = map_num(pers, array.level);
>
> and then report 'str' in all 3 cases (possibly substituting "-unknown-"
> or "container" for NULL) providing that array.raid_disks is non-zero -
> which it is in your example.
> So I cannot see how you would get the results that you report.
>
> Do you know how you got the array in this inactive state? I could then
> experiment and see if I can reproduce your result.
>
> NeilBrown

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

* Re: --detail --export doesn't show all properties
  2021-07-09  6:00           ` BW
@ 2021-07-09  6:13             ` NeilBrown
  0 siblings, 0 replies; 7+ messages in thread
From: NeilBrown @ 2021-07-09  6:13 UTC (permalink / raw)
  To: BW; +Cc: Fine Fan, linux-raid

On Fri, 09 Jul 2021, BW wrote:
> It was a 4-drive RAID5 array missing one drive completely.

That shouldn't result in the array not assembling....  though I guess
that depends on how it was assembled.
Do you know how it was assembled?

> 
> But I expected is was an easy thing to fix as "mdadm --detail
> /dev/md1xxx" will show the details fine (out of the same information
> in memory). But if it's not, maybe just make a note about it and move
> on with more important things. I wouldn't be surprised if I'm the only
> one ever needing this feature. And I already implemented a work-around
> in my storage-management-system be getting the RAID level etc. from
> /proc/mdstat first. A pain to serialize of course but it works now.

It probably is easy to fix, once it is understood.  I want to understand
it.  I need to be able to reproduce it.

NeilBrown



> 
> On Fri, Jul 9, 2021 at 1:52 AM NeilBrown <neilb@suse.de> wrote:
> >
> > On Thu, 08 Jul 2021, BW wrote:
> > > 1: Just because the array is inactive doesn't mean the information is
> > > not valuable, actually it's even more,  as your most likely needs your
> > > attention
> > > 2: The information is available and is printed when not doing --export
> >
> > Ahh... I missed that.  My memory is that when the array is inactive, the
> > md driver really don't know anything about the array.  It doesn't find
> > out until it reads the metadata, and it does that as it activates the
> > array.
> > But looking at your sample output I see does, as you say, give a raid
> > level for an inactive array.
> >
> > But looking at the code, it should do exactly the same thing for
> > --export, and --brief, and normal.
> > It determines the raid level:
> >
> >         if (inactive && info)
> >                 str = map_num(pers, info->array.level);
> >         else
> >                 str = map_num(pers, array.level);
> >
> > and then report 'str' in all 3 cases (possibly substituting "-unknown-"
> > or "container" for NULL) providing that array.raid_disks is non-zero -
> > which it is in your example.
> > So I cannot see how you would get the results that you report.
> >
> > Do you know how you got the array in this inactive state? I could then
> > experiment and see if I can reproduce your result.
> >
> > NeilBrown
> 
> 

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

end of thread, other threads:[~2021-07-09  6:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 12:20 --detail --export doesn't show all properties BW
     [not found] ` <CAOaDVC6yNDOVAvMu4gBuc+sTH50UrXD3z4sODa1NtFsV9SEZ9Q@mail.gmail.com>
2021-07-07 11:08   ` BW
2021-07-07 22:25     ` NeilBrown
2021-07-08  5:18       ` BW
2021-07-08 23:52         ` NeilBrown
2021-07-09  6:00           ` BW
2021-07-09  6:13             ` NeilBrown

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.