this post was submitted on 14 Dec 2023
0 points (NaN% liked)

Selfhosted

39937 readers
395 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 1 year ago
MODERATORS
 

I recently got a few (5) hard drives to turn my home server into a NAS with trueNAS scale and my idea is to have 4 usable and 1 for redundancy, my question is... How does RAID work, like what is RAID 0, RAID 5, software RAID etc, and does any of that even matter for my use case?

top 5 comments
sorted by: hot top controversial new old
[–] ahto@feddit.de 0 points 10 months ago

You won't be using a traditional RAID with TrueNAS Scale. You have a choice of Stripe, Mirror, RAIDZ1, RAIDZ2, RAIDZ3, dRAID1, dRAID2, dRAID3. The docs are very detailed, so you should read up on RAIDZ and the other types elsewhere, too.

[–] Nibodhika@lemmy.world 0 points 10 months ago (1 children)

You have a 5GB file:

RAID 0: Each of your 5 disks stores 1GB of that data in alternating chunks (e.g. the first disk has bytes 1, 6, 11, second disk has 2, 7, 12, etc), occupying a total of 5GB. When you want to access it all disks read in parallel so you get 5x the speed of a single disk. However if one of the disks goes away you lose the entire file.

RAID 1: The file is stored entirely on two disks, occupying 10GB, giving a read speed of 2x, and if any single disk fails you still have your entire data.

RAID 5: Split the file in only 3 chunks similar to above, call them A, B and C, disk 1 has AB, disk 2 has BC, disk 3 has AC, the other two disks have nothing. This occupies a total of 10GB, it's read at most st 3x the speed of a single disk, but if any single one of the 5 disks fails you still have all of your file available. However if 2 disks fail you might incur in data loss.

That's a rough idea and not entirely accurate, but it's a good representation to understand how they work on a high level.

[–] Aiyub@feddit.de 0 points 10 months ago

Better explanation of raid 5:

You have 5GB of data and 5 disks. You split your data into 4 parts and split one on each disk. Then disk 5 remembers if there is an odd or even number of 1s on the other disks. So whichever disk fails you can count if it was odd or even. So you loose 1 disk but keep full capacity of the other disks. No doubling like suggested before

[–] lemmyvore@feddit.nl 0 points 10 months ago (1 children)

If you're using TrueNAS it already has some types of RAID it wants to do. Assuming your 5 drives are the same size what you want is called RAIDz1 (1 standing for one drive worth of redundancy).

It is a type of RAID5, which means instead of having 5x usable storage you reserve 1x for redundancy information spread out across the 5, and get only 4x usable space.

Since you're a beginner you get the usual lecture: RAID is not backup. RAID allows a certain number of your drives to fail without losing any data; it spreads the risk of hardware failure.

RAID won't help if you delete a file or accidentally explicitly format the wrong drive or even the whole array, and won't help if the PC is stolen or struck by lightning or burns in a fire.

The solution used by TrueNAS (ZFS) has something called snapshots that can help with modified or deleted files.

For anything else you have to consider which of your files are "my world has ended"-level of important and backup to a HDD in a drawer, or to Blu Ray discs, or online to the cloud.

[–] Hopfgeist@feddit.de 0 points 10 months ago

To add, unlike "traditional" RAID, ZFS is also a volume manager and can have an arbitrary number of dynamic "partitions" sharing the same storage pool (literally called a "pool" in zfs). It also uses checksumming to determine if data has been corrupted. On redundant setups it will then quietly repair the corrupted parts with the redundant information while reading.