this post was submitted on 24 Aug 2023
10 points (91.7% liked)

Selfhosted

40382 readers
527 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

I have a DS220+ with 2 identical drives, configured as RAID, so just one volume. Everything was working great, but to access the new object-recognition in photos, I added RAM, which caused some corruption and now the volume is read-only and won't repair itself (even after removing the RAM). So now I'm preparing to do an external backup and rebuild the NAS. But now I'm wondering: If volume issues are more likely than drive issues, should I forget about RAID, create one volume on each drive, and use the second volume as a local backup? Or is RAID still the best first line of defence? (Or is there a way I can do both with two drives?

top 13 comments
sorted by: hot top controversial new old
[–] [email protected] 13 points 1 year ago

Given the choice between RAID but no backup, and backup but no RAID, it's backup but no RAID by a mile.

[–] [email protected] 6 points 1 year ago

RAID is not backup. RAID is used for increased capacity, throughput or uptime. (Depending on configuration)

Multiple volumes would likely get corrupted just as much with faulty RAM as RAID would. Besides RAM there's controller, CPU, power supply and possibly more single points of failure in that NAS, that would destroy both RAID and multiple volumes.

So assuming you have external backup, I'd go with RAID for better uptime as opposed to some custom multi volume pseudo-RAID for the same.

[–] [email protected] 6 points 1 year ago* (last edited 1 year ago)

Was it RAID 0 (striped), or RAID 1 (mirrored)?

In general, a mirrored RAID is best for minimizing data loss and downtime due to drive failure, while separate volumes and periodic backups is best for recovering from accidental file deletion or malware. (I.e., if a RAID gets told to write bad data, it’ll overwrite the good data on both drives at once.)

If you want the best of both worlds with just two drives, try zfs—you can mirror the drives to protect against drive failure, and make snapshots to protect against accidental data loss. (This still won’t protect against everything—for that you should have some kind of off-site backup as well.)

[–] [email protected] 4 points 1 year ago* (last edited 1 year ago)

You should get/use one external drive for backups that you store separately (can be your 2nd or a new one). Having two separate internal drives for backup is not safe, as the system can damage data on both at the same time (e.g. malware/encryption, data corruption etc.).

RAID is for availability/uptime. I like to compare it to a shop system at the checkout. You can't have shop payments halted if one drive fails, so you have a RAID. It allows you to repair/replace while the system keeps running and your business keeps operating. In a large business, every hour of downtime can cost you hundreds of thousand of currency, so RAID gets even more sophisticated. Downtime is not an option.

At home this is up to you. RAID can save you some hassle and grant performance, but likely costs you more money than it saves you. Backup is key, so have at least one separately stored copy and depending on the importance of your data, also have an off-site backup.

[–] [email protected] 2 points 1 year ago (2 children)

Get another hard drive and do RAID5. Then you get striping AND parity.

Or even better, get TWO more drives and do RAID10.

I’ve got 8 SAS drives in a RAID10 and it’s lovely.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (3 children)

RAID is something I haven’t learned yet but really should.

My server has 4 4TB hard drives. Sounds like I could do RAID10 and only have 4TB of storage. Or RAID5 and 8TB?

Right now I have no raid. 1/4 of my hard drives has about 700GB of data and is movie and shows. 2/4 hard drive has 91GB and is photos and cloud data. 3/4 is blank and 4/4 is borg backups from my desktop and server and second hard drive currently at 120GB. My media drive has no backups right now and is not really being used.

It sounds like I could put all of my data on hard drive 1 which will only be about 1TB and then have RAID so that data is secure.

I would like having 8TB storage with raid 5. But maybe raid 10 is smarter and if I want more storage I’ll have to get more drives.

[–] [email protected] 5 points 1 year ago (1 children)

With RAID10, you’d have 8TB of storage that is both striped and mirrored. You’d get a 4x increase in read speed and a 2x increase in write speed. You’d be fault tolerant against AT LEAST one drive failure, possibly two depending on which drives fail.

With RAID5, you’d have 12GB that is striped and parity checked. You’d get a 3x read speed increase and normal write speed. You’d be fault tolerant against a single drive failure.

With RAID6, you’d have 8TB that is striped and parity checked. You’ll have a 2x increase in read speed and normal write speed. You’ll be fault tolerant against two concurrent drive failures.

I recommend RAID10 if you want the all around speed boost and fault tolerance but don’t care so much about capacity;

RAID6 if you care more about redundancy;

RAID5 if you want a read speed boost and more capacity with a little fault tolerance mixed in.

There’s also raid 0, which is gonna be hella fast all around but god help you if somebody farts too aggressively next to it; and raid 1 if you just want 4 redundant backups of the same drive.

Personally, I’d go 10 unless you just really want the extra storage.

[–] [email protected] 2 points 1 year ago

Wow thank you for the detailed response. After reading through it i think I agree with raid 10 being my best option. Gonna start reading into it more and how to set it up! These hard drives aren’t new so being safe against at least one drive failure sounds safe. Can easily replace one if it goes out. Hopefully 2 don’t go out at the same time but it looks like I potentially will still be safe if so.

[–] [email protected] 4 points 1 year ago

Iirc your storage is halved with raid 10, not quatered.

[–] wth 2 points 1 year ago

Be wary of RAID 5 or 6.

They both have a « write hole » problem (or though much less so in RAID 6). Any power failure which causes an incomplete write can cause a complete RAID corruption - meaning all data is lost. Hardware RAID controllers usually have an onboard backup battery so they can store some information to complete operations should there be a sudden power failure. Software RAID does not have this, and you need to provide a UPS with automatic clean shutdown as the battery runs low using nut or some equivalent.

Some people go as far as to say that RAID 5 should never be used.

You also have very long recovery times when you replace a failed drive (days). Any other failure during this time means total data loss (of course RAID 6 gives you a second redundancy). Weekly Resyncs are very slow too (hours to days), and (unless you constrain your max throughput) will bring your system to its knees.

zfs does not suffer from these problems, BTW.

I run software RAID 5 via mdadm and have a UPS. I’ve replaced drives twice with no issues other than a slightly nervous long wait during recovery. I’m too cheap to buy the extra HDD for RAID 6, and may end up regretting it one day.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

~~RAID10 does not offer more 'protection' than RAID1 as it is just half of the disks of an even number of disks bun hed up as one and mirrored onto the other half. the capacuty of a 2 disk 4TB RAID1 is the same as a 4 disk 2TB RAID10. using 8 disk of 8TB in a RAID10 would give a usa le capacity of 32TB, using RAID5 it would be 56TB(!), even RAID6 would have more capacity (48TB) and you could lose up to two disks at a time. here is a calculator for this~~

i just saw you other response where you basically explained the same. sorry!

[–] [email protected] 2 points 1 year ago (1 children)

The only real advantage of RAID1 is that in some cases you get 2x the read performance. But doing snapshots where you get backups that include changes is more powerful than RAID or a volume copy.

[–] [email protected] 1 points 1 year ago

another advantage is not needing to restore from backup when one drive fails. RAID5 oder 6 would be better but does need more than two drives, so with only two RAID1, snapshots and backup of those snapshots is best (0.02€)