0

When installing Ubuntu 18.04 LTS in a new machine, I'd like to create a RAID5 array.

I have 4 1TB disks available.

However, since Ubuntu can't boot into the RAID5 array, I'm having to use one of the devices as boot partition, resulting in a RAID5 array with only 3 disks and 2TB capacity.

Is there a way of increasing the capacity in this RAID5 array without having only 2TB capacity?

5
  • Please don't use R5, it's dangerous, just today we had a user come here asking for help recovering their data from a R5 array, it's strongly recommended you don't use it.
    – Chopper3
    Feb 12, 2021 at 15:30
  • Chopper3 are you sure about this? Isn't RAID 5 proven, old, boring technology?
    – sandre89
    Feb 12, 2021 at 17:22
  • RAID5 can handle only one disk failure. When the failed drive is replaced, the array will be resilvered using the new disk. This process is very heavy for existing old disks, and resilvering 1TB takes a long time, it is very likely to cause further failures, leading to loss of all data. RAID5 was not that dangerous when HDD sizes were measured in tens of gigabytes. Feb 12, 2021 at 20:57
  • Is there any reference about the risks of losing data when working with 1TB disks, which is exactly my case?
    – sandre89
    Feb 13, 2021 at 22:02
  • We get this literally at least once a month - just google 'raid 5 bad' or similar, this is the first one that comes up for me, over 11 years old - it's dangerous - zdnet.com/article/why-raid-5-stops-working-in-2009
    – Chopper3
    Feb 15, 2021 at 12:48

2 Answers 2

0

You can activate BIOS RAID in your machine if it support it, go on the controller's utility for create your array, then you will install your Ubuntu and you 'll see only 1 disk that is your raid 5 previously configured, in your case with RAID 5 on 4x1TB you'll see only 1 disk of 3TB.

Alternativelly you can referr to this official guide: https://wiki.ubuntu-it.org/Installazione/SoftwareRaid

Hope this is helpful or gave you some new ideas.

0

You can partition the drives individually, put a copy of the ESP on every one (so you can boot from either), and then build a RAID5 from the second partition on each disk.

Synchronizing the ESP is a bit tricky, I'd probably set up this partition as a RAID1 with superblock at the end (the 1.0 format).

So, give every disk two partitions, similar to

/dev/sda1    2048     194559     192512    94M EFI System
/dev/sda2  194560 1953523711 1953329152 931.4G Linux RAID

You might want to use more space for the ESP though than I have -- 500 MB is usually good if you plan to load kernels from there.

Then, initialize the raid with

mdadm --create /dev/md0 -e 1.0 -n4 -l1 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
mdadm --create /dev/md1 -e 1.2 -n4 -l5 /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdd2

and create a DOS file system on /dev/md0 for the ESP:

mkdosfs /dev/md0

This will then be mounted under /boot/efi during/after installation. For the main area, use whatever partitioning scheme you feel comfortable with -- I'd use LVM.

Booting will ignore the RAID for the ESP, but since the superblock is at the end, it is still a valid DOS file system from the point of view of the firmware, so loading the OS from there works.

Note that the usual rant about RAID levels applies: if a drive in a RAID5 fails, you are left with no redundancy until the rebuild is complete, which can take a while and puts a extra stress on the remaining disks. If it's important data, go with RAID6, even if it means losing the capacity of two drives, and regularly run checks, most Linux distributions come with a handy script

/usr/share/mdadm/checkarray /dev/md0

In your case, you should check both, obviously. Every two weeks to a month would be a good interval, this catches errors where a disk has developed a few bad sectors and restores the data from the other disks, allowing the broken drive to remap the sector.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .