this post was submitted on 14 Dec 2023
32 points (84.8% liked)

Selfhosted

40226 readers
835 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?

you are viewing a single comment's thread
view the rest of the comments
[–] lemmyvore@feddit.nl 3 points 11 months ago (1 children)

I’m confused about the difference between RAID 5 and RAIDz1

RAID5 is the theoretical concept where you spread one drive worth of redundancy across multiple drives.

Traditionally this concept used to be implemented with special hardware cards that you plugged into your server and connected HDDs to it and it had its own BIOS where you managed the drives.

Later Linux implemented this concept (and other RAID concepts like RAID1, RAID6, RAID10 etc.) without the need of a special card. The Linux drives is called MD (Multiple Device). Actually Linux took it much further and can take any storage devices and do RAID with them: it can work with a whole disk but also with partitions, or with regular files formatted to look like a partition etc.

The cool thing about Linux MD is that it allows you to do any RAID combination that's logically possible, even if it's dumb and you'd never use it in real life, like RAID5 with 2 drives (normally you'd use RAID1 for that) or RAID1 with only one drive (no redundancy). Why? Because sometimes you need those dumb things. For example I have two RAID1 arrays and I noticed that both drives in one array show SMART signs that they might fail in the future (10% chance). Linux MD allowed me to remove one drive from each array and reconnect them to the other; now each array has one 100% healthy drive and one 90% healthy drive.

The uncool thing about Linux MD is that this is where it stops. It doesn't care what filesystem you use on the arrays and it has no other features. This makes its parity RAID implementations (RAID5, RAID6, RAID50, RAID60 etc.) vulnerable to sudden shutdowns (power failure or button off) because the drives may be left in disagreement about parity. To work around it you need a power UPS or a PCIe adapter card with a builtin battery, so that the parity is correctly written to the drives in case of power failure.

You can get some extra cool features (like snapshots) by using a filesystem like BTRFS on top of a Linux MD array.

RAIDz1 is a completely different implementation of RAID5 which uses ZFS and originated in the BSD world, not Linux. Linux gets to use it courtesy of the OpenZFS project as an external kernel module; it can never be included directly into the Linux kernel because of fundamental licensing differences. TrueNAS Scale is a Linux OS so it uses the module approach; there's also TrueNAS Core which is a BSD OS so it has native ZFS support. If you're only going to use your NAS as a NAS (for storage, not virtualization) I would recommend Core.

ZFS is both a RAID implementation and a filesystem; sort of like MD + BTRFS, but much more tightly integrated. ZFS has lots of extra features built-in: it has no write hole vulnerability; it has snapshots; it has compression; it can mark folders for special use cases and for example only activate compression on your documents folder but not on your movie folder.

The issue with ZFS is that it's much more complex and opinionated than Linux MD, so if you were to manage it directly yourself it would be a lot to learn. Even more experienced people have to think very carefully before using it. But since TrueNAS (both Scale and Core) have a user-friendly GUI that won't matter to you.

[–] Presi300@lemmy.world 1 points 11 months ago* (last edited 11 months ago)

I don't wanna use TrueNAS Core, as I'm not planning to use it as "just a NAS", I also plan to run a few other things on it, like pihole, searxng, wireguard, (maybe) nextcloud and a few other things. Other than that, I'm just not as familiar with BSD as I am with linux, nor do I particularly care to familiarize myself with it. As for ZFS, I'm still not sure about it, but looking at all the other options, it does look like the most straight forward and secure way to go, to me anyways...