Jump to content

How does RAID actually work?

Go to solution Solved by AbydosOne,
19 minutes ago, Arokan said:

Does it matter, which drive you lose

No.

 

19 minutes ago, Arokan said:

how is the storage arranged for that to be possible?

Simplified example:

 

Three disks (D1, D2, D3); D1 and D2 are data disks; D3 contains parity information generated from D1 and D2.

When you write data to the array, half will be put on D1 and the other half will be put on D2 (like RAID 0).

The parity written to D3 will be the bitwise XOR of the data written to D1 and D2.

(XOR = eXclusive OR, 0 XOR 0 = 0, 0 XOR 1 = 1 XOR 0 = 1, 1 XOR 1 = 0)

 

If D3 fails and is replaced, the system generates XOR parity information from existing data from D1 and D2 (easy).

If D1 or D2 fails, you can infer the value on the failed disk from the remaining disk and the D3 (parity) information.

For example, if a bit on D1 is a 0, and the corresponding bit on D3 (parity) is 1, then you know that corresponding bit on D2 was a 1 (per the XOR operation); basically solving D1 XOR n = D3.
A little more computationally complex, but not terrible.

 

EDIT: IIRC, XOR is fully reversible, so D1 XOR D2 = D3 means that D1 XOR D3 = D2, etc.

 

More EDIT: this process is extensible to more drives (assuming you only lose one at a time); XOR can be chained together: D1 XOR D2 XOR D3 = D4, etc.

 

10 minutes ago, Trinopoty said:

In overly simple terms, imagine you have two numbers: 25 and 67. Now you can add them to get 92. Raid 5 stores these 3 numbers in 3 drives. So even if you lose, say, 25; you can get it back by doing 92 - 67. And, if you replace the drive, the controller goes to every number and restores the missing one.

See my explanation above. You've got somewhat the right idea, but you have to remember storage is bit-binary and not decimal (so the "math" is a little different).

Hey LTT-Community,

 

I've been reading all I found about RAID and I'm thinking about using it in the future.

However, there is something I cannot wrap my head around.

 

When using RAID-5, it's stated that you can lose one out of tree drives before you lose any data, with two drives as storage and one drive to rebuild the array.

 

Does it matter, which drive you lose and if so, wouldn't that be as risky? And if it doesn't matter which drive you lose, how is the storage arranged for that to be possible?

Looking forward to your answers,

Arokan

Link to comment
https://linustechtips.com/topic/1313306-how-does-raid-actually-work/
Share on other sites

Link to post
Share on other sites

In overly simple terms, imagine you have two numbers: 25 and 67. Now you can add them to get 92. Raid 5 stores these 3 numbers in 3 drives. So even if you lose, say, 25; you can get it back by doing 92 - 67. And, if you replace the drive, the controller goes to every number and restores the missing one.

 

Now, actual RAID5 implementation is quite a lot complicated and it allows you to use pretty much all the storage of the 3 drives.

Link to post
Share on other sites

 

Watch these, I would think this answers all your questions.

AMD Motherboard Tier List  GPU Cooling Tier List  PSU Tier List  A Dive Into Custom Keyboards & Mechanical Switches

NEWCOMERS Remember to ' Reply ' to comments in order for people to see them, this is done by clicking the arrow icon at the bottom of a comment (Quote).

My Builds:

MEGA Desk Build

 

Blueberry Pi  R9 3950X  Asus X470 ROG Crosshair VII Hero Wi-Fi ATX  Corsair Vengeance RGB Pro 4x16GB 3200MHz CL16  EVGA GTX 1080Ti SC Black Edition 11GB  EVGA P2 850W w/ Blue Sleeved Cables  Cryorig R1 Universal (Blue)  2x Corsair Force MP510 4TB w/ Asus Hyper m.2 V2  Corsair ML Pro Blue LED Fans  Fractal Design Meshify C TG ATX Mid Tower  

Asus ROG SWIFT PG348Q 100Hz IPS G-Sync UW  Dell UltraSharp U3419W 60Hz IPS UW  Custom TOFU96  Corsair Scimitar Pro RGB 

 

Work Rig  ThreadRipper 3970X  Asus Prime TRX40 Pro ATX  G.Skill RipjawsV 8x32GB 3200Mhz CL16  Nvidia Quadro RTX 6000 24GB  Corsair HXi 1000W  EVGA CLC 360 AIO  8x Sabrent Rocket 2TB w/ 2x Asus Hyper m.2 V2   Arctic P12 Fans  Phanteks P400A ATX Mid Tower 

 

Plotting Machine 1  ThreadRipper 2990WX  AsRock X399 Taichi ATX  Kingston HyperX Fury 8x16GB 2666Mhz CL18   Nvidia Quadro K600 1GB  Corsair RMx 850W  EVGA CLC 360 AIO ‖ 2x Sabrent Rocket 2TB & 2x Sabrent Rocket 4TB w/ Asus Hyper m.2 V2  Arctic P12 Fans  Rosewill RSV-L4500 4U  5x Dell DS60 60-bay JBOD w/ 1.2PB of HDD Storage  HP 22U Half Rack

 

Plotting Machine 2  R9 3950X  Asus TUF X570-Plus Wi-Fi ATX  G.Skill RipjawsV 4x16GB 3200Mhz CL16   Nvidia Quadro K600 1GB  Corsair RM 650W  Noctua NH-D15s Chormax ‖ 4x Corsair MP600 Force 1TB W/ Asus Hyper m.2 Gen4  Arctic P14 & P12 Fans  Silverstone FARA R1 ATX Mid Tower

 

J.A.R.V.I.S.  R9 3900XT  Asus B550-I ROG STRIX Wi-Fi ITX  G.Skill Ripjaws V 2x16GB 3600MHz CL16  EVGA GTX 1080 SC2 iCX 8GB  Corsair SF 750W Platinum  Corsair H100i Pro AIO  Noctua NF-A12x15 Chromax Fans  FormD T1 SFF ITX Case  

LG 75UM8070PUA 4K UHD 120Hz IPS HDR TV  Corsair K63 Cherry MX Red Special Edition Wireless  Corsair Ironclaw RGB Wireless

 

Archive Server  R3 2200G  Asus B450-I ROG STRIX Wi-Fi ITX  Corsair Vengeance RGB Pro 2x8GB 3200MHz CL16 White  Vega Integrated Graphics  EVGA P2 750W  Prism Wraith Cooler  ITX Open Bench  2x HP SAS Expander  LSI-SAS9211  220TB of HDD Storage

 

SFF ITX Home PC  i5-7500  MSI B250I Gaming Pro Wi-Fi AC ITX  G.Skill Ripjaws V 2x8GB 2800MHz  Intel Integrated Graphics  Seasonic SSP Flex ATX 300W PSU  Cryorig C7  Velka 3 rev 1.2 SFF ITX Case (Grey)  

 

Laptop  Dell XPS13 2-in-1 7390 (2020)  i7-1065G7  32GB 3733MHz LPDDR4x  Intel Integrated Graphics  1TB NVME M.2  UHD+ (3840 x 2400) InfinityEdge Touch Display 

 

Keyboard Collection  GMMK Full Size  TOFU96 90%  ‖ KBD8x MKII TKL ‖ Drop CTRL High Profile TKL ‖ KBD Bella 75% ‖ GMMK Pro 75% ‖ XD84 Pro 75%  KBD67 V2 MKII 65%  KBD67Lite 65%  TOFU65 65%  KBD Blade 60%  Drop Carina 60%  Southpaw75 60% w/ Left Numpad  OLKB Preonic V3 Ortholinear ‖ CosPad XD24  ‖ KBDPad MKII

 

Key Cap Collection  GMK Boba Fett  GMK Red Samurai  GMK Laser CyberDeck +Novalties  GMK Arch  MaxKey B&W  Drop MT3 Camillo ‖ Matt3o MT3 /dev/tty  KBDfans Biip Torii Ext-2048  ePBT Less But Better +Novalties  EnjoyPBT Dolch  WinMix Mustard  Drop Skylight Horizon & Slate ‖ Glorious Black Aura   

 

Mechanical Key Switch Collection  Zealios V2 65g  Zealios V2 78g ‖ Zilents V2 67g  Tealios V2 67g  C³ Kiwi ‖ C³ Tangerine  Invyr Holy Panda  Durock T1 67g  Kailh Box Thick Jades ‖ Kailh Box Royal ‖ Kailh Box Heavy Dark Yellow ‖ Kailh Box Heavy Burnt Orange  Kailh Box White  Kailh Box Red  Kailh Pro Purple  Kailh Pro Burgandy  Gateron Ink Black V2  Gateron Black  Gateron Yellow  Gateron Brown  Gateron Green  Gateron Blue ‖ Cherry MX Black ‖ Cherry MX Brown ‖ Cherry MX Red

Link to post
Share on other sites

@DailyProcrastinator Thanks, watched those already but it didn't answer all my questions.

 

@Trinopoty Okay, then I start to understand how you can lose one drive and it doesn't matter which one. But how can you set it up so you can use almost all the storage?
I'm happy to learn all about it, complicated as it may be, and I'd be thankful for a link or so to a full explanation as I didn't manage to find one myself. Most are pretty superficial.

Link to post
Share on other sites

19 minutes ago, Arokan said:

Does it matter, which drive you lose

No.

 

19 minutes ago, Arokan said:

how is the storage arranged for that to be possible?

Simplified example:

 

Three disks (D1, D2, D3); D1 and D2 are data disks; D3 contains parity information generated from D1 and D2.

When you write data to the array, half will be put on D1 and the other half will be put on D2 (like RAID 0).

The parity written to D3 will be the bitwise XOR of the data written to D1 and D2.

(XOR = eXclusive OR, 0 XOR 0 = 0, 0 XOR 1 = 1 XOR 0 = 1, 1 XOR 1 = 0)

 

If D3 fails and is replaced, the system generates XOR parity information from existing data from D1 and D2 (easy).

If D1 or D2 fails, you can infer the value on the failed disk from the remaining disk and the D3 (parity) information.

For example, if a bit on D1 is a 0, and the corresponding bit on D3 (parity) is 1, then you know that corresponding bit on D2 was a 1 (per the XOR operation); basically solving D1 XOR n = D3.
A little more computationally complex, but not terrible.

 

EDIT: IIRC, XOR is fully reversible, so D1 XOR D2 = D3 means that D1 XOR D3 = D2, etc.

 

More EDIT: this process is extensible to more drives (assuming you only lose one at a time); XOR can be chained together: D1 XOR D2 XOR D3 = D4, etc.

 

10 minutes ago, Trinopoty said:

In overly simple terms, imagine you have two numbers: 25 and 67. Now you can add them to get 92. Raid 5 stores these 3 numbers in 3 drives. So even if you lose, say, 25; you can get it back by doing 92 - 67. And, if you replace the drive, the controller goes to every number and restores the missing one.

See my explanation above. You've got somewhat the right idea, but you have to remember storage is bit-binary and not decimal (so the "math" is a little different).

Main System (Byarlant): Ryzen 9 5950X | Asus B550-Creator ProArt | EK 240mm Basic AIO | 32GB G.Skill DDR4 3600MT/s CL16 | XFX Speedster SWFT 210 RX 6600 | Samsung 990 PRO 2TB / Samsung 990 EVO Plus 4TB | Corsair RM750X | StarTech 4× USB 3.0 Card | Realtek RTL8127 10G NIC | Hyte Y60 Case | Dell U3415W Monitor | Keychron K12 Blue (RGB backlight)

 

Laptop (Narrative): Lenovo Flex 5 81X20005US | Ryzen 5 4500U | 16GB DDR4 3200MT/s (soldered) | Vega II 384SP Graphics | SKHynix P31 1TB NVMe SSD | Intel AX200 Wifi | Asus 2.5G USB NIC | Asus ProArt PA278QV | Keychron K4 Brown (white backlight)

 

Proxmox Server (Veda): Ryzen 7 3800XT | ASRock Rack X470D4U | Corsair H80i v2 | 128GB Micron DDR4 ECC 3200MT/s | 2× Samsung PM963a 960GB SSD / 4× WD 10TB / 4× Seagate 14TB Exos / 4× Micron MX500 2TB / 8× WD 12TB (custom external SAS enclosure) | Seasonic Prime Fanless 500W | Intel X550-T2 10G NIC | LSI 9300-8i HBA | Adaptec 82885T SAS Expander | Fractal Design Node 804 Case

 

Proxmox Server (La Vie en Rose)GMKtec Mini PC | Ryzen 7 5700U | 32GB Lexar DDR4 (SODIMM) | Vega II 512SP Graphics | Lexar 1TB 610 Pro SSD | 2× Realtek 8125 2.5G NICs


Media Center/Video Capture (Jesta Cannon): Ryzen 5 1600X | ASRock B450M Pro4 R2.0 | Noctua NH-L12S | 16GB Crucial DDR4 3200MT/s | EVGA GTX750Ti SC | UMIS NVMe SSD 256GB / TEAMGROUP MS30 1TB | Corsair CX450M | Viewcast Osprey 260e Video Capture | TrendNet (AQC107) 10G NIC | LG WH14NS40 BD-ROM | Silverstone Sugo SG-11 Case | Sony XR65A80K

 

Workbench (Doven Wolf): Lenovo m715q | Ryzen Pro 3 2200GE | 16GB Crucial DDR4 3200MT/s (SODIMM) | Vega 8 Graphics | SKHynix (OEM) 256GB NVMe SSD | uni 2.5G USB NIC | HDMI add-in module

 

Network:

Spoiler
                       ┌─────────────── Office/Rack ───────────────────────────────────────────────┐
Google Fiber Webpass ── Cloud Gateway Max ══╦═ Pro XG 8 ══╦═ Flex 2.5-8 ══╦═ Doven Wolf
                      La Vie en Rose (DNS) ═╬═ Narrative  ╠═ Veda-NAS     ╠═ La Vie en Rose (vmbr)
                                Veda (DNS) ─┘             ╠═ Veda (vmbr)  ├─ Ptolemy (vmbr)
╔═════════════════════════════════════════════════════════╩═ Ptolemy-NAS  ├─ Veda (Mgmt)
║   ┌ Closet ┐      ┌───────── Bedroom ─────────┐                         └─ Veda (IPMI)
╚═══ Flex XG ══╦╤═══ Flex XG ══╤╦═ Byarlant
       (PoE)   ║│              │╠═ Narrative 
Kitchen Jack ══╣└─ Dual PoE ┐  │╚═ Jesta Cannon*
   (Testing)   ║┌─ Injector ┘  └── Work Laptop
     Bedroom ══╝│        ┌─────── Media Center ────────────────────────────┐
     Jack #2    └──────── Switch 8 ────────────┬─ nanoHD Access Point (PoE)
Notes:                                         ├─ Sony PlayStation 4 
─── is Gigabit / ═══ is Multi-Gigabit          ├─ Pioneer VSX-S520
* = cable passed from Bedroom to Media Center  └─ Sony XR65A80K (Google TV)
Link to post
Share on other sites

3 hours ago, Arokan said:

I've been reading all I found about RAID and I'm thinking about using it in the future.

I am going to throw in typical "raid is not backup" warning.

 

If you are planning to use raid at home - stop and think about what you are trying to accomplish and what raid actually does.

 

In short raid is needed to increase availability, trying to eliminate potential downtime due to disk failures.

 

What it does not do -  it does not guarantee data safety. Arrays still can fail for various reasons and data still can be lost in multiple ways. In a sense it can be even more risky than single drive because of increased complexity.

 

So in most cases raid at home is not needed, backup is. And often it is just a matter of choice, same hardware (extra hdd-s) can be used to do either one or another, so choose wisely...

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×