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?

  • Nibodhika@lemmy.world
    link
    fedilink
    English
    arrow-up
    18
    ·
    1 year ago

    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.

  • tburkhol@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    Traditionally, RAID-0 “stripes” data across exactly 2 disks, writing half the data to each, trying to get twice the I/O speed out of disks that are much slower than the data bus. This also has the effect of looking like one disk twice the size of either physical disk, but if either disk fails, you lose the whole array. RAID-1 “mirrors” data across multiple identical disks, writing exactly the same data to all of them, again higher I/O performance, but providing redundancy instead of size. RAID-5 is like an extension of RAID-0 or a combination of -0 and -1, writing data across multiple disks, with an extra ‘parity’ disk for error correction. It requires (n) identical-sized disks but gives you storage capacity of (n-1), and allows you to rebuild the array in case any one disk fails. Any of these look to the filesystem like a single disk.

    As @[email protected] says, none of those matter for TrueNAS. Technically, trueNAS creates “JBOD” - just a bunch of disks - and uses the file system to combine all those separate disks into one logical structure. From the user perspective, these all look exactly the same, but ZFS allows for much more complicated distributions of data and more diverse sizes of physical disks.

  • R0cket_M00se@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    If you have four drives you can do RAID 6 assuming your controller supports it.

    RAID 0 just puts your data on multiple drives, giving you higher read/write speeds but with no built in redundancy.

    RAID 1 is just a copy, you have your data duplicated so that if anything fails there’s an immediate copy. No increase in RW speeds.

    RAID 5/6 use “parity data” which operates somewhat like RNA/DNA when going through mitosis. The four building blocks TCGA only connect with one of the other four in pairs of two, so even if you have half the data (RNA) you know what the other half is by logical extension. The difference is that 5 uses 3 drives at a time whereas 6 uses 4, you can only withstand the failure of one drive in RAID 5 but 6 can handle the loss of two.

    RAID 10 (one-zero, not “ten”) does exactly what the name suggests, it combines the direct copy of RAID 1 with the striping of RAID 0 to give you double RW speeds with redundancy.

    Each one will reduce your overall storage by a certain amount, either because of copying the data completely or taking up space for “parity data.” The only one that doesn’t do this is RAID 0 but you have absolutely no redundancy there and if You’re considering RAID for home use I’m going to assume that’s important to you.

    • pory@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      11 months ago

      I thought RAID1 enabled faster reads too, because both drives have the complete file. Writes don’t get a speed bump ofc, since those are still bottlenecked by the slowest single drive in the array

      • R0cket_M00se@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        11 months ago

        That could be, I was trained in systems admin but work as a network engineer by profession. I’ve only set up one server in an enterprise environment and it was using RAID 6.

        I’d assume you could read from both disks at the same time though.

    • rtxn@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      1 year ago

      Seconded. ZFS needs to see the physical devices, so hardware RAID is out. It implements a RAID-5-like parity-based software solution called RAID-Z, and is capable of disk mirroring.

      It can work with hardware RAID or with a single physical disk, but don’t expect it to last for a long time, and definitely don’t use it beyond testing.

  • _danny@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    This is a good tool for visualizing your raid needs from your capacity and total number of drives.

    https://www.seagate.com/products/nas-drives/raid-calculator/

    I’ll preface that I’m no raid expert, just a nerd that uses it occasionally.

    The main benefit of most raid configurations is the redundancy they provide. If you lose one drive, you do not lose any data. It’s kinda obvious how you can have 1:1 redundancy, you just have an exact copy of the drive. But there are ways to split data into three chunks so that you can rebuild the data from any two chunks, and 5 chunks so that you can loose and two chunks. Truly understand how raid does this could easily be an entire college course.

    Raid 0 is the exception. All it does is “join together” a bunch of drives into one disk. And if you lose an individual disk you likely will lose most of your data.

    Another big difference is read/write speed. From my understanding, every raid configuration is slower to read and write than if you were using a single drive. Each raid configuration is varying levels of slower than the “base speed”

    I typically use raid 5 or 6, since that gives some redundancy, but I can keep most of my total storage space.

    The main thing in all of this is to keep an eye on drive health. If you lose more drives than your array can handle, all of your data is gone. From my understanding, there is no easy way to get the data off a broken raid array.

    • Presi300@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 year ago

      I’ve mentioned it in another reply, but read/write speed isn’t terribly important to me, as the whole thing is gonna be bottlenecked by a 1GBPs connection anyways. From what I read from the other replies and online, RAIDz1 sounds like the thing I’m gonna go with, as it seems robust enough and my NAS is powerful enough for the performance hit to not really matter…

  • redline23@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Other people gave a good explanation of raid and some alternatives like zfs in truenas.

    You want to avoid RAID5 with drives above 4TB. Every hard drive has can have an unrecoverable read error (URE) during the read. It’s a very low percentage change that your hard drive publishes. During a raid 5 rebuild after replacing a drive, the other drives are stressed for a long time during the rebuild. With high capacity drives you have a pretty large chance of encountering a URE and losing the entire array. The high stress on the drives can also cause drive failure if another drive was on its way out.

    I run truenas core at home in volumes that looks like raid 10. Two mirror volumes striped together for performance.

    I never played around with raidz1 (like raid 5) but you still have the chance of an URE during the resilver. I can’t comment if it’s possible or what happens during an error. I did see people recommending raidz2 to allow for two disc failures from losing data during a resilver.