What is parity check doing when parity drive much larger?


sonofdbn

Recommended Posts

I recently had to shutdown my array and when I rebooted found there had been an unclean shutdown, so the server (6.11.5) started a parity check. I have dual parity drives, 16TB (very recently installed) and 8TB. Most of my eight data drives are 8TB, and none is bigger than that.

 

Now I'm more than 50% of the way through the parity check (8.44 TB read), and looking at the Main tab on the GUI only the 16TB drive is being read from. There's no other read/write activity that I can see, and in fact currently only two of the other drives are still spun up.

 

So I'm wondering what the parity check is doing. Simplistically, if the first 8TB of data/parity on the drives has been read and checked, I would have thought that there's no more parity to be checked. Isn't the extra 8TB of the larger parity drive immaterial to the parity integrity of the array?

 

Asking this partly out of curiosity and partly hoping that I can just cancel the parity check now.

 

 

Link to comment

I'm obviously confused about parity. I had read that a parity drive doesn't have to be pre-cleared because parity is calculated, and then written to the parity drive. In which case, it doesn't matter what was on the parity drive in the first place. And it also means that if I had added a non-pre-cleared drive as parity, there would almost certainly not be zeroes in the rest of the drive. Or does adding the larger (than necessary) parity drive involve writing zeroes to the "unused" part of the drive?

 

If I add a larger data drive later (assuming that I increase the size of my second parity drive as well), won't parity be calculated for the new drive and then written to the parity drive, overwriting whatever was in the corresponding position?

 

 

Link to comment
5 minutes ago, sonofdbn said:

If I add a larger data drive later (assuming that I increase the size of my second parity drive as well), won't parity be calculated for the new drive and then written to the parity drive, overwriting whatever was in the corresponding position?

No.   The drive that is added is cleared (written as all zeroes) if not pre-cleared before adding it.   A drive that is all zeroes can then be added without affecting parity so no parity update is required.

Link to comment
1 hour ago, sonofdbn said:

Or does adding the larger (than necessary) parity drive involve writing zeroes to the "unused" part of the drive?

Yes it does.  And to your original question, I have wondered the same.  It seems reasonable to think a parity check only needs to go as far as the largest data drive.  There must be a sound reason.  Can a rogue parity bit mysteriously flip from 0 to 1?  🤷‍♂️ 

Link to comment

In my experience (less than yours), any shutdown of UnRaid not specifically done from the UI (don't know about CLI <-- see previous six words) will start a parity check.

 

I'm very lucky to have a UPS (does nothing if software sucks). I'm lucky to have good hardware that I trust.

 

2 hours ago, sonofdbn said:

I recently had to shutdown my array and when I rebooted found there had been an unclean shutdown

Renovations (common)... I stop the parity check and wait (every month -- pain in the ass) for the next one.

 

I don't suppose I'm helping unless you trust your hardware. I don't trust UnRaid (that's why I backup), BUT!... It's never failed me.

 

Double back and look at those last four words.

 

MrGrey.

 

 

Link to comment
7 hours ago, dboonthego said:

Can a rogue parity bit mysteriously flip from 0 to 1?

If it does, it will cause a read failure on that drive.  The drive will attempt to fix the problem through its error-correcting software.  If it can not be corrected, then the disk will be flagged with one of the 190-series SMART attribute codes.  (Depends on the drive manufacturer which one.)   Remember that a new data drive is added to the array by zeroing every byte (offline), added to the array and formatted (updating parity).  It is assumed at this point that parity is correct (and that the parity disk has no errors)!  Checking parity is not a part of adding a new data disk.

 

IF the parity disk has a bad sector, the array will not have parity protection and you will not be aware of it until the next parity check after adding the new data disk. 

Link to comment
1 hour ago, Frank1940 said:

IF the parity disk has a bad sector, the array will not have parity protection and you will not be aware of it until the next parity check after adding the new data disk. 

This is true, but if that bad sector happens to land on the "surplus" portion of the parity disk, does that truly invalidate parity?

 

Of course adding a new disk that absorbs that bad area is a problem and performing full parity check on regular cycles reduces your chance of a surprise error.

 

In theory, is it reasonable to think checking the remainder of the parity drive should be optional?

Link to comment
54 minutes ago, dboonthego said:

This is true, but if that bad sector happens to land on the "surplus" portion of the parity disk, does that truly invalidate parity?

 

Of course adding a new disk that absorbs that bad area is a problem and performing full parity check on regular cycles reduces your chance of a surprise error.

 

You are basically right on both counts.  Without checking the unused area of the parity disk, you would not have advance warning that there was a problem until you actually encountered it.  (Finding out that one can't restore a data disk because of a previously undetected problem is something most of us do not want to deal with!)  While the normal periodical parity check would catch it, it is always unsettling to the user when it happens.  And usually there is no way to determine where the problem is on the disk and, in many cases, there is no indications as to what disk has the problem if it is not a bad sector issue.  (Unclean shutdowns often results in parity errors being found on the force parity check on the restart.  More than 90% of these are fixed by rebuilding parity.  Apparently, the parity update is the last thing written to the array and more often than not, a correcting check brings parity into sync without data loss.)

 

58 minutes ago, dboonthego said:

In theory, is it reasonable to think checking the remainder of the parity drive should be optional?

 

You can make an argument both ways.  Doing so would add to the complexity of the parity-checking function because the code required to implement it.  It would require a setting up a default (check or not check the unused area) setting.  A decision to be made by perhaps a neophyte.  (The discussion on this topic alone might fill several pages of heated opinions in the forum...) 

Link to comment
On 9/22/2023 at 11:09 AM, itimpi said:
On 9/22/2023 at 11:01 AM, sonofdbn said:

If I add a larger data drive later (assuming that I increase the size of my second parity drive as well), won't parity be calculated for the new drive and then written to the parity drive, overwriting whatever was in the corresponding position?

No.   The drive that is added is cleared (written as all zeroes) if not pre-cleared before adding it.   A drive that is all zeroes can then be added without affecting parity so no parity update is required.

 

Sorry, didn't think that one through properly!

 

On 9/22/2023 at 12:26 PM, dboonthego said:
On 9/22/2023 at 11:01 AM, sonofdbn said:

Or does adding the larger (than necessary) parity drive involve writing zeroes to the "unused" part of the drive?

Yes it does.  And to your original question, I have wondered the same.  It seems reasonable to think a parity check only needs to go as far as the largest data drive.  There must be a sound reason.  Can a rogue parity bit mysteriously flip from 0 to 1?  🤷‍♂️ 

 

So what happens when I add a new parity drive that has surplus capacity? Does unRAID clear the entire drive? Because if it does, there's a case to be made that pre-clearing a drive that is to be used for parity could be helpful beyond just being a stress test, since it will be writing zeroes to the whole disk. Admittedly there is the other issue of whether unRAID recognises the pre-clear signature and acts accordingly when a parity drive is added. (Whereas I believe that with a new data drive, unRAID will indeed check if there's a signature and if there is, will assume the disk is clear.)

 

There seems to be a common view that a drive that is going to be used for parity doesn't have to be cleared (stress-testing it by pre-clearing is a separate consideration). But if that view is correct, then it implies that unRAID doesn't care what is on the drive because the required parity bits are going to overwrite whatever is already there. Following on from that, wouldn't this mean that doing a parity check on the "surplus" part is unnecessary? Whether there are zeroes or something else is immaterial if it's going to be overwritten anyway when larger data disks get added.

 

Should our understanding be:

If we are replacing a parity drive that is as large as the largest data drive with a drive of the same size, then we don't have to care what is on the new drive; but if we replace that parity drive with a larger one, then pre-clearing might (will?) reduce the time that unRAID takes to add the new drive to the array. The pre-clearing will also address the bad sectors concerns.

Link to comment
1 hour ago, sonofdbn said:

So what happens when I add a new parity drive that has surplus capacity? Does unRAID clear the entire drive? Because if it does, there's a case to be made that pre-clearing a drive that is to be used for parity could be helpful beyond just being a stress test, since it will be writing zeroes to the whole disk. Admittedly there is the other issue of whether unRAID recognises the pre-clear signature and acts accordingly when a parity drive is added. (Whereas I believe that with a new data drive, unRAID will indeed check if there's a signature and if there is, will assume the disk is clear.)

 

Unraid does not check for the preclear signature on a parity drive as it is going to overwrite every sector with parity information anyway (even if the last part is just zeroes).

 

1 hour ago, sonofdbn said:

Following on from that, wouldn't this mean that doing a parity check on the "surplus" part is unnecessary? Whether there are zeroes or something else is immaterial if it's going to be overwritten anyway when larger data disks get added.

 

That would only be true if the remainder of the parity drive was going to be written when a new data drive is added.   As was mentioned earlier it is the data drive that is cleared so that no new parity information needs to be written.   Even when adding a drive the preclear is optional as if necessary Unraid will clear it anyway as part of the add process so that no new parity information is required to be written.

 

If you are replacing a parity drive (or a failed drive) then whatever is already on the drive is going to be completely overwritten so need for preclear unless you want to do it as a stress test.   

Link to comment
1 hour ago, sonofdbn said:

 

So what happens when I add a new parity drive that has surplus capacity? Does unRAID clear the entire drive?

Yes, it does.

 

1 hour ago, sonofdbn said:

Following on from that, wouldn't this mean that doing a parity check on the "surplus" part is unnecessary?

That's the great debate.  In the hypothetical version of Unraid, checking the "surplus" would be optional for recurring syncs, but an initial sync would be required.

 

1 hour ago, sonofdbn said:

Whether there are zeroes or something else is immaterial if it's going to be overwritten anyway when larger data disks get added.

Parity isn't calculated when adding a data disk.  Replacing a parity disk will kick off a parity sync and calculate parity against all data disks.  Once it reaches the end of the data disks, it will continue to zero the remaining sectors of the parity disk.  Data disks must be cleared by native Unraid clear or UD pre-clear plugin (optional).  This guarantees parity remains even and is the reason a parity sync isn't needed upon adding a data disk.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.