Subject: Re: Raidframe and raidset initialization
To: Tobias Nygren <tnn+nbsd@nygren.pp.se>
From: Greg Oster <oster@cs.usask.ca>
List: netbsd-users
Date: 03/10/2007 09:58:19
Tobias Nygren writes:
>
> Using a raid set without initializing parity isn't that different from 
> creating a
> filesystem on a harddisk without zeroing all sectors first.
> 
> Sure, parity will be wrong for sectors which haven't previously been 
> alloc'ed
> in the filesystem. But because parity is updated on writes, sectors that are
> relevant to the filesystem will have the correct parity.

This is fine for RAID 1, but not RAID 5. 

Let's say you have "random contents" on each of 5 components that you 
turn into a RAID 5.  Unless you can guarantee that all I/O is going 
to do "full stripe writes", at some point you will be doing a "small 
stripe write" for some stripe that has never been properly initialized.  
That means, of course, that when you do the "small stripe write" to an 
uninitialized stripe that it'll be reading a bogus parity block and using 
it to compute a new bogus parity block.  If a component dies before all 
the bogus parity blocks are corrected and you go to read from one of 
these "uninitialized stripes", at some point you're going to get back 
bogus data (e.g. when the data you want is on the component that has 
died) because the bogus parity will get used to compute the missing 
data.

> This of course doesn't apply if the raid employs fancy checksum control 
> of parity.
>
> Performing the parity initialization is good for another reason: it 
> makes sure
> that all blocks in the components are accessible. You don't want to 
> begin using
> a raid set that might have a failing disk.

That is correct. It does offer some assurance that the disks are at 
least readable...

Later...

Greg Oster