I would like to install Ubuntu 20.04 Focal Fossa on a machine with two hard disks using RAID 1.
Unfortunately it seems this doesn't work. If I use the "Create Software RAID (md)" option and select both my disks the installer tells me:
If you put all disks into RAIDS or LVM VGs, there will be nowhere to put the boot partition.
I found this detailed answer about 18.04 but the problem with this and similar findings on the subject is that Focal dropped the alternative installer so the required partitioning options are gone.
What options do I have to accomplish this?
As I stumbled on the same issue and found out that the actual docs haven't yet been updated for the new storage configurator (still true as of March 2021 and now possibly with a bug on the bios_grub configurator of the installer), here's what I did to get a working softRAID 1 setup with 2 disks on the Ubuntu Server edition (for version 20.04 or newer):
Enjoy :)
(Also referenced on: https://gist.io/@fevangelou/2f7aa0d9b5cb42d783302727665bf80a)
I fixed it in this way.
Solution 1: Install RAID 1 without encrypt your disks
First, I have prepared both the hard drives (SSD in my case) using "GParted Live" (I created a bootable USB with the GParted ISO):
I decided to omit a "/swap" partition because I have 16 GB of RAM installed, and I use SSD drives, and this server will be just a little home NAS, so I don't need high performance.
Then, using the "Custom storage layout" during the Ubuntu Server 20.04 installation:
I checked both disks to be "added as a boot disk";
Using the "Create software RAID (md)" option, I selected the "/" - root - disk one partition, and the "/" partition of disk two, to create a new "md0" volume (always active);
I created another "RAID md" volume, but this time with "/home" partition (always active), selecting both "/home" partitions to create a new "md1" partition;
I selected the "md0" partition (the root partition created before) and choose "Add GPT Partition", and than I selected format as "Ext4" and mount on "/";
Similarly with "md1" partition (the /home partition), I choose "Add GPT Partition", and than I selected format as "Ext4" and mount on "/home";
After that I choose "done" and I completed the installation.
Solution 2: Install RAID 1 with disks encryption
Here I wrote a quick guide about how I solved. The main problem is related to the "/boot" partition, that can't be inside the encrypted partition, because the grub's encryption it isn't supported yet.
I hope that this guide will be useful for other Ubuntu users.
The solution from fevangelou is generally excellent but there is a detail missing about the swap partition if you have more than one RAID (or leftover disks which are formatted as Linux RAID). The tl;dr is if you have any other RAID disks, leave them unplugged until after the install is over.
In my case, I have 4 disks (2 in RAID1 for the OS as md0/md1/md2), 2 in RAID1 for storage (md3). If I create md3 during install (or do nothing and leave these disks formatted as Linux RAID from a previous install), after the first boot I run swapon -s and I see that only the swap.img file is used, not my swap partition. I run cat /proc/mdstat and I can see that my storage drives (should have been md3 or not assigned) have been assigned to md1 (which was swap in fevangelou's example). The swap partition is nowhere to be found.
If I unplugged the extra disks before install, things worked perfectly. I waited until after the first full boot to poweroff and plug the extra disks in. I have a couple of other drives (ntfs and ext4) which I left plugged in and never had a hassles, just the RAID drives.
RAID needs both disks have the same partition layout, and Ubuntu needs at least 1 active boot partition for bios (grub). What I am doing:
Select 1st disk, "Use as boot device"
Select 2nd disk, "Add as another boot device"
Select 1st disk, Add GPT partition, left the size blank, and leave unformatted
Select 2nd disk, Add GPT partition, left the size blank, and leave unformatted
Select "Create software RAID (md)", select partition 2 from both disks
Now, you have NEW AVAILABLE DEVICES /md/xxx. Just do the partitioning as usual to add / (root), /boot, etc. You can also create it as LVM partition.
For reference, please watch this Youtube videos Manually Create RAID1 Mirrored 2 Disks during Ubuntu 21.04 Server Installation