To identify the spare devices through /proc/mdstat...
1) Look for the [#/#] value on a line. The first number is the
number of a complete raid device as defined. Lets say it is 'n'.
2) The raid role numbers [#] following each device indicate its
role, or function, within the raid set. Any device with 'n' or
higher are spare disks. 0,1,..,n-1 are for the working array.
Also, if you have a failure, the failed device will be marked with (F)
after the [#]. The spare that replaces this device will be the device
with the lowest role number n or higher that is not marked (F). Once the
resync operation is complete, the device's role numbers are swapped.
Don't count on the order in which the devices appear in the /proc/mdstat
output.
<>< Lance.
Osma Ahvenlampi wrote:
>
> This is the /proc/mdstat output on a particular kernel 2.0.36 +
> raid0145-19990421 system equipped with six SCSI disks, configured as
> (multiple) 5-disk RAID-5 plus one hot spare disk. However, it's not
> immediately obvious to me from the output WHICH of the disks is the
> spare (I know that it's /dev/sdf, since that's the one I added as
> spare after creating the array with no spare disk, but what if I
> didn't know that?).
>
> My motivation to ask this is actually so that I might be able to
> decide whether I could tell the spare disk to spin down, since it's
> not it use. No point having it spinning wearing itself down when the
> point of it is to work in case one of the others fail.
>
> # cat /proc/mdstat
> Personalities : [raid1] [raid5] [translucent]
> read_ahead 1024 sectors
> md0 : active raid1 sdb2[1] sda2[0] 64192 blocks [2/2] [UU]
> md1 : active raid5 sdf5[5] sde5[4] sdd5[3] sdc5[2] sdb5[1] sda5[0] 706304 blocks
>level 5, 32k chunk, algorithm 2 [5/5] [UUUUU]
> md2 : active raid5 sdf6[5] sde6[4] sdd6[3] sdc6[2] sdb6[1] sda6[0] 1959424 blocks
>level 5, 32k chunk, algorithm 2 [5/5] [UUUUU]
> md3 : active raid5 sdf7[5] sde7[4] sdd7[3] sdc7[2] sdb7[1] sda7[0] 1959424 blocks
>level 5, 32k chunk, algorithm 2 [5/5] [UUUUU]
> md4 : active raid5 sdf8[5] sde8[4] sdd8[3] sdc8[2] sdb8[1] sda8[0] 30587136 blocks
>level 5, 32k chunk, algorithm 2 [5/5] [UUUUU]
> unused devices: <none>
>
> --
> Osma Ahvenlampi