Author Topic: How does parity work?  (Read 103 times)

Offline jaysee

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
How does parity work?
« on: November 27, 2018, 08:53:34 pm »
Hello,

I'm investigating flexRAID tRAID as a possible migration from unRAID. I'm currently playing around with it in a virtual machine, and am trying to understand something.

Under unRAID, parity works like this (all credit to /u/critters on reddit https://www.reddit.com/r/unRAID/comments/4vc0wo/how_can_a_4tb_drive_protect_10tb_worth_of_data/ )

Quote
ELI5: Files are stored as 1's or 0's, these are the things we're trying to protect.

Let's imagine you have 4 drives each with 2 bits of information

DriveBit1Bit2
A01
B00
C11
D11

Now if we wanted to make a copy of this information so we could replace it if a drive failed we would need a 5th drive that had space for 8 numbers. OR we could use a parity drive that adds up the 1's and 0's from each column and records a 1 if the number is even and 0 if it is odd.

So our array now looks like:

DriveBit1Bit2
A01
B00
C11
D11
Parity10


Now if drive A fails:

DriveBit1Bit2
A??
B00
C11
D11
Parity10

We can use the parity drive to rebuild drive A as it tells us that Bit1 should be 0 and Bit2 should be 1 as they added up to be even and odd

This lets us add any number of drives while only having a parity disk as large as the largest drive in the array. HOWEVER, if 2 drives fail we can not figure out what information was on both the failed disks, so we lose that data.

Does tRAID work similarly? If not, can someone explain how tRAID works?

I'm currently experimenting with tRAID in a virtual machine, I've got a couple of 10GB drives and a couple of 15GB drives. I've set up a RAID in the screenshot. Is all the data safe?

Offline Skirge01

  • Full Member
  • ***
  • Posts: 152
  • Karma: +2/-0
    • View Profile
Re: How does parity work?
« Reply #1 on: November 28, 2018, 12:42:09 am »
First off, the developer of the software is currently MIA.  He's done this before and eventually comes back, but I certainly would not recommend switching to any of flexRAID's software at this point in time.

Second, I believe the exact method used for parity under tRAID is proprietary and undisclosed (I could be wrong and just haven't seen it posted anywhere).  However, it works.  Many of us have recovered drives from parity without losing any data.

Third, keep in mind that your screenshot shows a 10GB PPU with several 15GB DRUs.  With that setup, those 15GB DRUs will only be capable of utilizing 10GB each.  Your PPU must be as big as your largest DRU in order to fully utilize the capacity of any DRU.  Expand the PPU to at least 15GB and you'll gain another 20GB of capacity in your RAID.

Offline jaysee

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: How does parity work?
« Reply #2 on: November 28, 2018, 07:39:22 am »
Fair enough to the exacts not being disclosed.

The reason I'm confused by parity is mainly because the array screenshotted does not give any errors. Also, when I run df on the server to see the disk usage/free of all the disks, I see this for the mounted array.

Code: [Select]
root@flexraid-test:~# df -h /media/traid1/ /mnt/traid/traid1/disks/*
Filesystem                Size  Used Avail Use% Mounted on
FlexRAIDFS                 78G   74G  1.3G  99% /media/traid1
/dev/traid-1000000002-v1  9.8G  8.8G  451M  96% /mnt/traid/traid1/disks/sdb
/dev/traid-1000000004-v1  9.8G  8.9G  361M  97% /mnt/traid/traid1/disks/sdc
/dev/traid-1000000005-v1   15G   14G  291M  98% /mnt/traid/traid1/disks/sdd
/dev/traid-1000000006-v1   15G   14G   83M 100% /mnt/traid/traid1/disks/sde
/dev/traid-1000000007-v1   15G   14G   87M 100% /mnt/traid/traid1/disks/sdf
/dev/traid-1000000003-v1   15G   15G     0 100% /mnt/traid/traid1/disks/sdg

Is that capacity a lie? Is all the data safe with a 10GB parity drive?
« Last Edit: November 28, 2018, 08:04:20 am by jaysee »

Offline Skirge01

  • Full Member
  • ***
  • Posts: 152
  • Karma: +2/-0
    • View Profile
Re: How does parity work?
« Reply #3 on: November 28, 2018, 10:23:03 am »
This may help:  http://wiki.flexraid.com/2013/06/17/using-a-dru-that-is-larger-than-the-ppu-in-transparent-raid/

That should make it crystal clear that your RAID is not set up properly (because you have DRUs large than your PPU), which means that the "extra" 5GB of data on each of those 15GB drives is not protected.  For complete protection, either shrink the 15GB DRUs to 10GB or less or increase the PPU to 15GB or more.

Offline jaysee

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: How does parity work?
« Reply #4 on: November 28, 2018, 01:39:00 pm »
OK that's what I thought. Thanks for the answer.

It's still strange that there's absolutely no warning while setting this up. Although I probably won't be going with flexRAID over an open source solution, it's nice to learn how these different things work.