This guide will show how one can use mdadm to install Ubuntu server on a RAID 1 setup. There are a few minor differences between doing this on 14.04 LTS and older versions that many guides are written for but the process is generally similar. The main reason to use RAID 1 is to provide a level of reliability in a system. With SSDs being both smaller and faster than the large 3.5″ capacities, RAID 1 with fast replacement or a hot spare can significantly decrease the chance of data loss. On the other hand, there are environmental factors (e.g. the now familiar backplane “zap of death”) that can take both drives out simultaneously. This guide will get you setup with md RAID 1 in less than 5 minutes. You do not need to use any special hardware RAID adapters with this guide, onboard SATA will work fine.
Installing Ubuntu server with software RAID 1
For this guide we are using two Samsung 830 256GB SSDs. We keep sets of SSDs available in the lab so these drives can be considered “well used” at this point. The first step is to insert installation media into the machine and boot the machine. One then needs to proceed through the customary installation steps such as selecting a keyboard layout. For this guide we are interested in the partitioning step.
Step 1 in the process is ensuring that your disks are listed. If not, troubleshoot why the disks are not available (e.g. loose cable.) The first step is generally to select the disk you want to partition. One can see that sda (the first disk) has a full 256GB of FREE SPACE. The second disk, sdb had a Windows installation previously. The HP 200GB SLC SAS SSD (sdd) will be a ZIL drive in the future and the four 4TB WD SAS drives are going to be storage disks. We are starting with sda in this example.
Select the disk you want to begin with and start partitioning.
You will now be left with FREE SPACE which we will format into something more usable. Select FREE SPACE and hit <Enter>.
If you know what you are doing, you can likely do manual partitions without issue. On the other hand, if you just want to get this done quickly, then you can select “Automatically partition the free space” and Ubuntu will automate that process.
Here we have a standard ext4 primary partition and a swap partition. At this phase you will want to select the primary partition.
Here, one will want to change the “Bootable flag” to on.
The next step is simply repeating steps 1-6 with the second drive. One can see here that the second disk has ntfs partitions from a previous Windows Server installation.
Now that both drive are ready, it is time to select Configure Software RAID.
You will be asked to partition disks at this point.
The next step is generally optional but may happen if you are using a drive that previously was tested with data. One may get a warning that there are GPT signatures on the disks. Make sure that you are OK losing the data on the drive, then tell Ubuntu that it is not a GPT partition table. That will allow Ubuntu’s partitioning to continue as close to a stock installation as possible.
Now click Create MD device. MD as the tool tip says stands for “multiple device” so this does say you are going to create “multiple device” device. MD is so commonly used many folks forget what the D stands for.
No click on RAID 1. Frankly for a boot drive this is going to be the most common option.
Next you will need to select the number of devices. Here we have two.
Since we only had two drives in our array and need two for RAID 1 we do not have any spare devices. Spares are nice to haves. In the event a disk fails, the spare would be used to immediately rebuild. That is a huge benefit with SSDs that can handle the higher IOPS and faster transfers as it means healing times are very fast.
Next you will need to select the partitions you want to be root and swap. You choose them in pairs. On most drives, these are going to be different sizes so it should be fairly easy t figure out /sda1 goes with /sdb1 and they are the same size.
Write changes here.
Once this is completed for both the / and swap device you can see the pairs listed as RAID device #0 and #1 below. In this example, SCSI1 and SCSI2 are the physical Samsung 830 256GB drives.
With the RAID 1 swap partition setup, we are ready to go.
Write changes to disk.
Time to write again. Here click “Finish partitioning and write changes to disk.”
Now that partitioning is done, one can proceed through the rest of the installer as normal.
When you reboot, you can check your disks free space and see the md partition.
Hopefully this was an easy enough guide to follow. The total time should take under 5 minutes. For further administration, there are plenty of guides out there on mdadm and use with Ubuntu. Feel free to let us know if there are any questions in the forums.