I was having trouble finding a guide/steps to setup a software RAID 1 while in the Ubuntu installer. I stumbled upon a blog post that had the steps written out very nicely however since it was written as a comment I thought people may overlook it when they are first scrolling through search results. I will list out his steps as well as include screenshots and a bit more information.

My Setup

I will be testing on my KVM setup however all the steps below apply the same as if the server was a physical server.

I have two drives that are both 200G. I plan to have them setup in a raid1 mirror that will have a partition table like this:

tfernandez@ubuntu-2:~$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0         7:0    0  69.9M  1 loop  /snap/lxd/19188
loop1         7:1    0  55.4M  1 loop  /snap/core18/1944
loop2         7:2    0  31.1M  1 loop  /snap/snapd/10707
sr0          11:0    1  1024M  0 rom   
vda         252:0    0   200G  0 disk  
├─vda1      252:1    0     1M  0 part  
├─vda2      252:2    0     1G  0 part  
│ └─md0       9:0    0  1022M  0 raid1 
│   └─md0p1 259:0    0  1018M  0 part  /boot
└─vda3      252:3    0   199G  0 part  
  └─md1       9:1    0 198.9G  0 raid1 
    └─md1p1 259:1    0 198.9G  0 part  /
vdb         252:16   0   200G  0 disk  
├─vdb1      252:17   0     1M  0 part  
├─vdb2      252:18   0     1G  0 part  
│ └─md0       9:0    0  1022M  0 raid1 
│   └─md0p1 259:0    0  1018M  0 part  /boot
└─vdb3      252:19   0   199G  0 part  
  └─md1       9:1    0 198.9G  0 raid1 
    └─md1p1 259:1    0 198.9G  0 part  /

Ubuntu Storage Configuration

After booting the DVD/ISO installer for Ubuntu 20.04.2, progress through the installer until you reach the Guided Storage Configuration section.

Select Custom Storage Layout and select Done

If you have any existing partitions, delete them now by highlighting the Available Device and selecteding Reformat.

Step 1: Set your boot drives

Select the first drive and choose the option Use As Boot Device. (see below).

Use As Boot Drive

Do the same for the second drive however the option will now say Add as another Boot Device

You will now have two bios_grub partitions created.

Notice how we have a bios_grub partition on each disk

Steps 2: Creating our boot partitions

This step involves creating physical partitions on our drives however leaving them unformatted is the key.

Let’s go ahead and select your first disk and choose the option Add GPT Partition

This will be our boot partition so we can set the partition to only be 1G. Ensure that it is left unformatted. Click Create

Repeat the above actions from Step 2 to create another 1G partition on your second disk.

Your disks/partitions should look like this now.

Step 3: Creating our Swap and Root partitions

The swap partition is optional really. I prefer to use a swap file since it has a bit more flexibility. Either way, you decide if it’s right for you to create just a root or both a root and a swap. The steps will be exactly the same.

Repeat the actions in Step 2 to create a swap and/or root partition. If you are creating a swap then do that first. As a general rule of thumb, the swap partition should be the same size as your amount of RAM.

Don’t forget to leave the partitions unformatted.

When you get to the root partition you can leave the size empty to use all the remaining storage.

Below is what you should see once you’ve created your partitions. Keep in mind if you created a swap then you will have 4 partitions instead of 3 like me.

Step 4: Creating our mutli-disk arrays

We have finally made it to the last step. Go ahead and select Create software RAID (md)

This will bring up a menu asking you to create your first multi-disk (md0). Let’s go ahead and select partition 2 on each disk. They should both be 1G. Select Create

Do the same to create additional multi-disks for your swap and root partitions.

Your partitions should now look like the image below.

Step 5: Mapping /boot, /swap and / to our raid arrays

The last step in the storage configuration is to select our md devices from the list of Available Devices, format them and map them to a destination.

Let’s select md0 and Add GPT Partition

We can leave the size blank to use all available space. I will be formatting my drives with ext4 and I will be mounting my md0 onto /boot

Perform the same actions to format your swap and root partitions.

Your final partition table will look something like this:

You can now select Done at the bottom of the page which will take you through the rest of the installation.

Extras

Below are some extra notes I thought I’d jot down that may or may not be useful.