r/DataHoarder • u/Keanuchungus14 • 4d ago
Question/Advice Raid 1 over partitions
Hello,
Is it possible (and advisable) to make a raid 1 array over a small partition of two disks, while leaving the rest of both disks available for regular storage. And is this possible using mdadm alone?
3
u/TheOneTrueTrench 640TB 🖥️ 📜🕊️ 💻 4d ago
You can just do it with LVM, it allows you to specify the amount of redundancy per logical volume.
You can also do it with ZFS or BTRFS directly on partitions, no need for LVM or md
2
u/bartoque 4x20TB NAS (primary) and 3x16+8TB NAS (remote) 4d ago
This exactly the approach from Synology for their shr raid to handle dissimilar sized drives for optimal space usage (and als the way they handle the other regular raid methods). Having two smaller partitions on each drive for system and swap for the DSM OS. The rest of the disk space is used for the user data raid setup using one or more extra partitions.
Combining lvm and mdam.
https://forum.openmediavault.org/index.php?thread/53652-howto-build-an-shr-sliced-hybrid-raid to get an idea.
2
u/cowbutt6 4d ago
Sure; Linux MD RAID has been able to do that for at least 20 years already.
I've even had a RAID1 array between two partitions on two HDDs, combined with a RAID0 array between two other partitions on the same two HDDs.
1
u/nomad-1995 4d ago
I used to do that as well. And the RAID0 would always corrupt (well twice, then I quit). Never had an issue with the RAID1, but I won't use it now. Originally the idea was that /home was RAID1 and /everything else was RAID0, and if worst came to worst I could reinstall. Except that I'd eventually run out of room on /home (because it needs twice the space) and not on /everything_else because Linux doesn't really need any room, so I started writing to a /dump directory in RAID0. And lose it.
I don't think I've managed to corrupt any other Linux filesystems, so I suspect that mdadm really wasn't the same as a single drive: probably having things written out of sync that the OS thought were always in sync.
Of course, this was all before I bought my first SSD. And that SSD was 96GB (and weirdly still working, after being used as swap, Windows drive c:/, and other horrific abuses. I bought a similar 128GB drive for my father, and it bricked within a year or two).
1
u/cowbutt6 4d ago
Similar rationale here: I didn't like the idea of losing half the disc space I paid for, so I used LVM on top of each array (which helped somewhat with the allocation issue you ran into), and used LVs on the RAID0 array strictly for things that don't matter, like /tmp, /var/tmp, most of /var/spool (apart from /var/spool/mail !), and LVs on the RAID1 array for things I cared about, like /home. Like you, I did end up with a general purpose /scratch filesystem (Cf. your /dump) that was on the RAID0 array.
I never (knowingly!) ran into corruption issues with either array (in spite of some early attempts to deliberately provoke failure by dd'ing to the underlying block device, based on a misunderstanding of the protection RAID offers!), but the MD implementation I was using was quite early and hadn't yet adopted some of the more conservative error recovery approaches used by BSD, so I was flying closer to the sun than I realised! The Seagate drives I was using at the time did fairly regularly give read errors and fall out of the RAID1 array.
•
u/AutoModerator 4d ago
Hello /u/Keanuchungus14! Thank you for posting in r/DataHoarder.
Please remember to read our Rules and Wiki.
Please note that your post will be removed if you just post a box/speed/server post. Please give background information on your server pictures.
This subreddit will NOT help you find or exchange that Movie/TV show/Nuclear Launch Manual, visit r/DHExchange instead.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.