Parity building question


cirkator

Recommended Posts

Hi I just upgraded my parity drive to a 4TB drive. It is the only 4TB drive in my array, the second biggest ones are 3TB.

While it was creating parity i noticed that after passing the 3TB mark it calculated parity up to 4TB.

 

Why is unRAID doing that? Cant it just know that if the disk is precleared and the only 4TB in the array that every bit from 3TB to 4TB will be a zero?!

From 3TB to the 4TB mark there cant be any parity to calculate...

Link to comment

That is what it does, it reads no drives, runs it through the parity calculation and schedules to write the result(s).

 

This is because that piece of code is compartmentalized. It doesn't know if the system is using even or odd parity. Nor does it know if there is dual parity or diagonal parity. This is a good thing.

Link to comment

After the 3tb mark, unRaid "emulates" the  other drives in the system as if they were all 4tb.  What winds up in practice is that it writes all "0"s to the parity drive.

 

If you also had a 1tb drive in your array, then after it hit the 1tb mark then it would emulate the 1tb drive as if it was a 4tb and calculate parity. 

 

What preclearing does is zero out a drive completely and then write a signature to the drive to let unRaid know that it doesn't have to zero it out itself (if its a data drive)

 

Building parity does not take into account whether or not the drive is precleared or not.

 

Whenever upgrading parity, it will always recalculate the parity for the entire 4tb so that it is in a "known" condition (ie, all zero after the 3tb mark).    The reason is that whenever a write to the array takes place, the system does NOT calculate parity for the entire array.  What it does instead is read the parity drive, and add the new data to it, and then finally write the new parity information.  This is one of the great features of unRaid, as when writing only the parity drive and the data drive being written to are spun up.

 

Link to comment

It prepares the parity for the addition of a 4T data drive. If you now add a 4T data drive then unRAID will be able to clear the drive and add it without calculating parity.  If unRAID did not write the proper data to the last 1T of the parity drive then there might be left over data on the drive which makes the parity incorrect.

 

If unRAID ignored the parity for any size above the data drive size then that would just make the logic much more complex when replacing or upgrading a data drive by requiring the data and parity to both be written to. Putting the parity data to a known state allows data drive upgrades by only writing to the new data drive.

 

The only time the preclear is recognized is when you install a new data drive.

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.