Degraded raid handling

Phillip Susi psusi at cfl.rr.com
Tue May 15 21:24:52 UTC 2007


I have been trying to figure out how dmraid handles degraded raid sets. 
  For example, if only one drive in a mirror is found, or one drive in a 
raid5 is missing.  I have found several states for the raid set listed 
in the source in metadata.h:

s_broken
s_inconsistent
s_nosync
s_ok
s_setup

What I can't figure out is the meaning of these states, or if they are 
even implemented.  The meaning of s_ok is obvious, but if one of the 
mirrors is missing, does the state become inconsistent or nosync?  If 
these flags are used on the raid set, I can not find it in the code.  It 
seems that some of these states are referenced in the ataraid metadata 
specific handlers in the context of each device rather than the set as a 
whole.  How does it make sense to have each device in one of these 
states vs. the set as a whole?

One of the only places I can find these states referenced on the raid 
set is in activate.c, and I can not make sense out of it:

    return (p_fmt(lc, table, "0 %U %s core 2 %u %s %u", 

               sectors, get_dm_type(lc, t_raid1), 

               calc_region_size(lc, sectors), 

               (S_INCONSISTENT(rs->status) || S_NOSYNC(rs->status)) ? 

               "sync" : "nosync", mirrors));

This looks to me that it is adding a "sync" parameter to the dmsetup 
command if the raid set is either out of sync or inconsistent, and 
otherwise adds "nosync".  Not only does this seem to be backwards, but 
as far as I can tell ( from looking at the kernel sources since I can 
find no documentation on the mirror target ) there are no such 
parameters.  Further, I can not see anywhere the s_inconsistent or 
s_nosync flags ever can be set on the raid set.  What gives?

I'd like to be able to set up the udev scripts to run dmraid on newly 
attached disks to check if they are a part of a raid volume, and if they 
are, try to activate that volume, but only if all disks are available. 
If one is missing, then the set should not be activated in a degraded 
set, at least not until some timeout has passed to give the other disk a 
chance to be detected.  This is a bit of a moot point though, if dmraid 
doesn't support degraded sets.




More information about the Ataraid-list mailing list