Score:8

Can I build a RAID 5+1 system?

wf flag

I must say I already found a similar question on this platform, but the context was different, so I'm trying by myself.

My idea is as follows:
I have 4 disks, 3 of them are the same capacity, and the fourth one has twice the capacity of either of the others. I would use the 3 disks above in a RAID 5 configuration, and then use them together with the fourth in a RAID 1 configuration.\

Hypothetically, if the 3 disks are all 250GB, and the fourth is 500GB, I should get 500GB of usable storage with mirroring.

If it is a feasible idea, would it make sense to implement it or are there any cons? If there are any, what may be a possible way to use these disks in a RAID setup?

P.S.: As you might think, it is not my intention to use this setup as a backup system, I know RAID is NOT a backup solution! :)

Romeo Ninov avatar
in flag
To add one probably big disadvantage: the speed on write operations will be slower than single disk because you need to calculate checksum, write one chink on disk1, second on second disk, checksum on third. From other side on big disk you will write as one chink (precious splitted chink for disk 1 and 2).
Score:27
ca flag

With hardware RAIDs - no, you can't: nesting RAID levels is only supported in very specific cases (ie: RAID50 or 60).

If using Linux MD, which is extremely flexible, you can do it easily. Let see how I simulated it with loop device backed by (small) files:

# create loopbacks - for testing only, you are going to use real disks
root@localhost:~/raid# truncate --size=250M disk1.img
root@localhost:~/raid# truncate --size=250M disk2.img
root@localhost:~/raid# truncate --size=250M disk3.img
root@localhost:~/raid# truncate --size=500M disk4.img
root@localhost:~/raid# losetup -f /root/raid/disk1.img
root@localhost:~/raid# losetup -f /root/raid/disk2.img
root@localhost:~/raid# losetup -f /root/raid/disk3.img
root@localhost:~/raid# losetup -f /root/raid/disk4.img
root@localhost:~/raid# losetup -a | grep -v snaps
/dev/loop8: [64768]:132175 (/root/raid/disk4.img)
/dev/loop6: [64768]:132150 (/root/raid/disk2.img)
/dev/loop7: [64768]:132173 (/root/raid/disk3.img)
/dev/loop5: [64768]:132147 (/root/raid/disk1.img)

# create first RAID5 device
root@localhost:~/raid# mdadm --create md127 -l 5 -n 3 /dev/loop5 /dev/loop6 /dev/loop7
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md/md127 started.
root@localhost:~/raid# mdadm --create md126 -l 1 -n 2 /dev/md127 /dev/loop8
mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md/md126 started.

# show arrays
root@localhost:~/raid# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md126 : active raid1 loop8[1] md127[0]          <--- this is the 2x ~500MB RAID1 one
      506880 blocks super 1.2 [2/2] [UU]

md127 : active raid5 loop7[3] loop6[1] loop5[0] <--- this it the 3x ~250MB RAID5 one
      507904 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]

Please note that you end with "only" 500 GB usable space with this nested RAID5+1 arrays. I would strongly consider using RAID6 over 4x 250GB disks (the bigger disk can be used as smaller one without issues, apart the lost space), providing the same usable 500 GB with better reliability (and potentially another 250 GB of unprotected "scratch space" at the end of the bigger disk).

Score:8
ru flag

I would use the 3 disks above in a RAID 5 configuration, and then use them together with the fourth in a RAID 1 configuration.

There's an increased operating risk for 'exotic' nested RAID levels, and hardware RAID is highly unlikely to support the nesting you're considering. A simple RAID5 commonly provides better resilience. Also, putting all four disks in a RAID5 array provides you with 3*250=750 GB of usable storage. (I hope your 3x 250 GB + 1x 500 GB HDDs are for example only, I wouldn't use disks that old any more.)

I'd recommend considering RAID6 though, generally. Today's HDDs are so large that a rebuild takes considerable time to run, and any read problem during the rebuild takes the array offline.

Additionally, make sure you're configuring media patrol aka data scrubbing. Regular scrubbing prevents soft errors to harden and hard errors to go undetected for longer periods. You certainly don't want to discover an additional hard error during a rebuild.

Score:3
cn flag

@Ancool, welcome to the flock!

As an alternative to RAID, you can consider logical volumes - if you're on Debian, install it with apt install lvm2. I much prefer it over RAID because it is so very convenient, at least for the way I manage my systems. The principle is simple enough:

  • You mark your disks/partitions as physical volumes: # pvcreate /dev/sda - you do that to either a whole disk or to a partition
  • Collect your physical volumes into one or more volume groups: vgcreate vg00 /dev/sda /dev/sdb ...
  • Create logical volumes: lvcreate -L 100G -n var vg00

This last command creates a device, /dev/vg00/var, which can be formatted like any disk device.

lvcreate has a large number of options - some for RAID like functionality, although I never use them, and you can specify on which physical volumes your filesystem should be allocated. The main advantage, in my view, is that you can increase the size of the logical volume with lvextend (followed by the appropriate command to extend the filesystem) - and unlike fixed partitions, you are not constrained by whether there is a partition after the one you want to extend.

It may not be what you are looking for, but study it a bit - I think everyone who uses Linux should at least know about LVM; and in fact, they exist across all UNIXes, so they are worth knowing.

jcaron avatar
co flag
While this is useful information, I don't think this answers the question, RAID or any form of redundancy is barely addressed. A shorter version may be useful as a comment.
j4nd3r53n avatar
cn flag
@jcaron True (+1) - however, I do point out that this is an alternative worth looking at.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.