[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-raid
Subject:    RE: list of devices that belong to an array
From:       Neil Brown <neilb () suse ! de>
Date:       2006-12-23 0:03:13
Message-ID: 17804.29249.402037.648763 () cse ! unsw ! edu ! au
[Download RAW message or body]

On Friday December 22, Don_Hiatt@pmc-sierra.com wrote:
> 
> > 
> > Secondly, given a device that is part of an array, is there a way to 
> > figure out all the other components if you are using the 1.2 superblock?
> > uuid=`mdadm -Eb $DEV | sed -ne 's/.* \(UUID=[^ ]*\).*/\1/p'` mdadm -Esv | grep \
> > -B1 $uuid | grep devices=
> 
> Yes, but wouldn't this only tell me about the devices that are currently in the \
> system and but not *all* the devices that make up the array? For example:
> 
> * say a RAID is composed of /dev/sata[1-4]
> 
> * If I use the "-ESv" option with all devices installed (they are hotplugged) then
> it will list "devices=/dev/sata3,/dev/sata4,/dev/sata1,/dev/sata2"
> 
> * However, say I pull /dev/sata2 and repeat the command, all I will see is:
> "devices=/dev/sata3,/dev/sata4,/dev/sata1"

What else could it say?  /dev/sata2 does not exist, there is no such
thing at this point in time, so telling you that it is part of an
array is meaningless....

> 
> What I am trying to do is determine if all the devices are present in the system 
> before I attempt to startup the RAID. I know I can use "--no-degraded" to get the
> similiar behaviour but I'd like to be able to determine component list outside of
> this mechanism.

Well... If you do
   mdadm -E $DEV | grep 'Array Slot'
you get something like:

    Array Slot : 2 (0, 1, 2, 3, failed, 4)

So this device has Array Slot of '2', and you should expect to see
devices with Array Slots of 0, 1, 2, 3, 5 (The positions of the
non-failed entries in the list).
Once you have found all those devices, you know you have them all.

What exactly are you trying to do?   Have you looked at the new "-I"
mode.  It automagically starts an array once all expect devices are
present. 

NeilBrown
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic