r/HomeServer • • Jan 26 '24

How does RAID 5 work exactly?

Please explain RAID 5 for me. How can 1 disk store 3 disks worth of data? and lets say an entire drive doesn't fail, but some files go corrupt as time passes. Will RAID 5 protect against this? Will it tell me if one of my files corrupts? And is there a way to rebuild individual files without rebuilding the entire array? I am planning on integrating 6 large hard drives into my windows 10 PC. It has an Asus Maximus X Formula motherboard that supports RAID 5, though I don't know exactly how that works. Thank you

2 Upvotes

36 comments sorted by

88

u/skreak Jan 26 '24

I'll keep it brief - say you have 5x disks in a raid 5, you get 4x disks of usable space and can lose any one disk. It uses XOR logic for the parity disk, think it like - a sum of numbers - instead of disks you had 4 numbers you wanted to write - 8, 3, 6, 1 on 4 pieces of paper and on a fifth paper you wrote the number 18 which is the sum of the 4 numbers. You could blindly throw away one of those 5 pieces of paper and be able to figure out what number was stored on it later - e.g. 8 + 3 + x + 1 = 18. Finding X is easy. Raid5 allows for a _single_ disk in your group to fail but no more than 1 because, like my analogy, if you lost 2 piece of paper - x + 3 + y + 1 = 18 is not solvable.

17

u/unicorn-boner Jan 27 '24

This guy Raids

1

u/Donnie_Sharko Aug 08 '25

You are a hero and did an amazing job explaining this. Thank you.

1

u/anxiousvater Nov 03 '25

Excellent explanation 😀.

1

u/JournalistWeary2169 Aug 12 '26

Understand easily, thx

1

u/Eintopffuge0627 Sep 30 '26

Wow. Thank you so much. ♡

0

u/greyduk Jan 27 '24

That's almost exactly like unraid then... but I thought unraid wasn't raid at all. Is the difference unraid's support for dissimilar disks? 

0

u/skreak Jan 27 '24 edited Jan 28 '24

Edit, I stand corrected. Fwiw I read one paragraph on it from a random Google search. /shrug If i understand the documentation correctly; Unraid is a modified Raid1 (mirror). But the mirrored pairs of data blocks don't have to line among each disk.

1

u/MrB2891 unRAID all the things / Core Ultra 7 265k / 25 disks / 300TB Jan 27 '24

No.

Unraid is a hybrid of many RAID. It's closest to RAID4, where parity is stored separately on dedicated disk(s). The difference is that data is not striped across the data disks in the array. Unraid uses individual, 'self contained' data disks, complete with their own file system. That is what makes Unraid so unique and allows running of differing sized data disks while still retain full use of the capacity of each disk.

If running a single data disk, parity is done XOR like RAID5. Two disk parity is Reed-Solomon.

0

u/[deleted] Mar 13 '25

[deleted]

2

u/skreak Mar 13 '25

Yes. That's precisely how it was setup; raid5 over 3 disks with 1 hot spare. A hot spare is an unused disk with no data on it, and should the raid encounter a failed disk it can eject it immediately and replace it with the hot spare and start rebuilding without an Admin needing to do anything. Later on the failed disk can be swapped with a new disk, and that new disk becomes the hot spare.. Edit. Personally had i been the admin hereni would have used a raid10 (mirrored and striped) across all 4 disks. I would end up with the same usable space and probably had better write and read speeds.

4

u/LittlebitsDK Jan 26 '24

www.google.com

"how does RAID 5 work"

click search or press ENTER

plenty lovely videos about it explain how raids work

3

u/PuerAeternis Oct 25 '24

I came here from a Google search.

Thank you for letting me know I could just google it. Boy, do I feel stupid right about now!

0

u/[deleted] Mar 13 '25

[deleted]

1

u/fake-ons Jan 07 '26

I haven’t had that issue yet, but I imagine it feels like the reaction meme of coralline’s dad, exhausted in front of his desktop

1

u/picturelife Nov 03 '25

You know what? I googled "how does RAID 5 work" and it brought me here. Thanks for adding this into the archive OP!

1

u/sirlemonhead Jun 29 '26

Me too lol.

1

u/--Spaci-- Jan 26 '26

The first guys explanation was the google result and a good one at that, boy I bet you feel stupid 2 years later

-21

u/Narutobi_Sensei Jan 26 '24

wow didn't think of that. Thanks for your insight redditor

4

u/TheMartok Jan 26 '24

Yet here you are lol

1

u/chicknfly P200A 5600G RAIDZ2 6x8TB NAS + Proxmox on Optiplex Jan 27 '24

Perhaps I'm reading into this too hard, but I'm willing to bet OP did that and the videos don't click in a way they understand.

1

u/LittlebitsDK Jan 27 '24

there are MANY of them... if not one of em "clicks" why would you think a short text msg on here would click? when videos are full of lovely visuals and long explanations?

1

u/chicknfly P200A 5600G RAIDZ2 6x8TB NAS + Proxmox on Optiplex Jan 27 '24

All I know is I have read about Voronoi diagrams. I have watched all sorts of videos showing it. I have seen pseudocode of creating the diagram. Yet, to this day, I still have no idea how to write code to make a Voronoi diagram. I’m not saying OP is struggling in that way, but it’s always possible.

1

u/[deleted] Jan 19 '26

thanks OP, found the answer because of this post

0

u/guaranteednotabot Jun 23 '25

None of the explanations I found explained it as well as the top comment here. You are no different to those StackOverflow snobs

8

u/MrB2891 unRAID all the things / Core Ultra 7 265k / 25 disks / 300TB Jan 27 '24 edited Jan 27 '24

Don't bother with RAID5 these days.

If you have dozens or hundreds of users and need the high IOPS and bandwidth of a striped parity array, RAIDz1 or RAIDz2.

If you're a home user that is looking for large storage capacity on home user budgets that still had one or two disk redundancy, Unraid.

As far as 'how', read up on 'XOR parity'. That is how RAID5 (and Unraid with single disk parity) works. RAID6 (and Unraid two disk parity) uses Reed-Solomon if you want to read up on that as well.

3

u/duoschmeg Jan 26 '24

Search G for multi TB drives in raid 5 rebuild time. In short, rebuild will fail and you will loose data.

3

u/No_Wear295 Jan 26 '24

Lmgtfy?

1

u/PuerAeternis Oct 25 '24

ichfgsgfy

(I came here from google, so)

2

u/[deleted] Jan 27 '24

Redundancy is achieved through striped parity. The data of any given disk is striped amongst the rest.

Protecting against data degradation (bitrot) isn’t something that RAID does. But it is a feature of ZFS, and you can run RAIDz vdevs In ZFS.

1

u/Pvt-Snafu Feb 02 '24

RAID won't protect against file corruption. That's the job of a file system. Same goes for write hole. For this, you need a file system with checksumming like ZFS or ReFS. Also, I would never use RAID on a motherboard which is essentially a fake RAID: https://skrypuch.com/raid/ Either go for a hardware RAID or software RAID (Linux MDRAID/Storage Spaces/ZFS).

0

u/IHaveTeaForDinner Jan 26 '24

RAID does not prevent corruption. The controller writes whatever its told to the disks, garbage or no garbage. It doesn't understand what it's writing either, could be files, could be raw sectors.

It doesn't write 3 disks worth of data it stripes checksums of the data across the array. In very simple terms, if you have the sum 1+2 =3. Store the 1 on drive 1, 2 on drive 2 and the three on drive 3. If drive 2 fails you have to compute 1 + x = 3, which is easy it's 2.

0

u/Logicalist Jan 27 '24

You need to understand Drive Parity and/or the XOR boolean function.

-3

u/[deleted] Jan 26 '24

How can 1 disk store 3 disks worth of data?

Poorly with most hardware implementations and with the Windows Server implementation. I recommend using btrfs or ZFS (port coming to windows) to avoid nightmare resilvering scenarios.