Ubuntu – How to Create Software RAID 1 in 12.04 Ubuntu Linux – Tutorial

There are several guides for creating software RAID’s on Ubuntu on the internet. Most of them we’ve found to be not very comprehensive or difficult to understand and follow. This is why we’ve created this tutorial as easy to use as we could. Pictures on every step and detailed instructions. In fact, it may be a little to comprehensive, but that’s ok. At least you’ll be confident you created the RAID correctly. If you do have any questions or run into a problem, feel free to leave a comment below and we’ll try to help.

Linux software RAIDs work differently than normal hardware RAID’s. They are partition based, instead of disk based. This means that you must create matching partitions on all disks before creating the RAID. Hardware RAIDs have you add the disks to the RAID and then create the partition.

This tutorial was created while installing Ubuntu 12.04 64 bit Server Edition. It’s intended to be the first in a series of Linux software RAID tutorials. Future tutorials will cover topics such as how to recover from a failed disk.

This server has two 16GB disks installed. We will be creating 2 partitions: a 2GB swap partition and a 14GB root partition. After we are done, the server will stay in operation if one of the two disks fails. Most of the pictures in this tutorial are self-explanatory. The option you need to choose will be highlighted. We will provide comments on the picture if there is any special considerations.

To begin, run the Ubuntu installer. When you get the ‘Partition disks’ menu, choose ‘Manual’:

Ubuntu Linux - How to Configure Software RAID Tutorial 1

In this case, the disks are new and there are no partition tables on it. Select each disk to create a partition table:

Ubuntu Linux - How to Configure Software RAID Tutorial 2

Ubuntu Linux - How to Configure Software RAID Tutorial 3

Select the free space on the first disk to create partitions on it:

Ubuntu Linux - How to Configure Software RAID Tutorial 4

Ubuntu Linux - How to Configure Software RAID Tutorial 5

The first partition will be 2GB at the beginning of the disk (this will be used for swap space):

Ubuntu Linux - How to Configure Software RAID Tutorial 6

Ubuntu Linux - How to Configure Software RAID Tutorial 7

Ubuntu Linux - How to Configure Software RAID Tutorial 8

You can leave partition settings the default. After the RAID is created, these partitions will be overwritten, so there is no need to configure them here:

Ubuntu Linux - How to Configure Software RAID Tutorial 9

Select the remaining free space on the first disk to create the 2nd partition. In this case, we will be using the remaining free space for this partition:

Ubuntu Linux - How to Configure Software RAID Tutorial 10

Ubuntu Linux - How to Configure Software RAID Tutorial 5

Ubuntu Linux - How to Configure Software RAID Tutorial 11

Ubuntu Linux - How to Configure Software RAID Tutorial 7

Again, do not worry about configuring the partition here. Leave it at the defaults:

Ubuntu Linux - How to Configure Software RAID Tutorial 12

After creating the 2 partitions on the first disk, repeat the process and create identical partitions on the second disk.

You should now see identical partition sizes on both disks. Choose ‘Configure software RAID’ to begin creating the software RAID:

Ubuntu Linux - How to Configure Software RAID Tutorial 13

Ubuntu Linux - How to Configure Software RAID Tutorial 14

Again, the Linux software RAID is partition based, so we will need to create 2 RAIDs, 1 for each of our set of 2 partitions. Choose ‘Create MD device’ to begin creating the first:

Ubuntu Linux - How to Configure Software RAID Tutorial 15

Ubuntu Linux - How to Configure Software RAID Tutorial 16

This step can be confusing for some people. Our first RAID will consist of 2 partitions (the 2GB partitions on each of the disks), so choose 2 active devices:

Ubuntu Linux - How to Configure Software RAID Tutorial 17

We aren’t using any spare devices in this example:

Ubuntu Linux - How to Configure Software RAID Tutorial 18

Only select the 2GB partitions. There should be one on each disk:

Ubuntu Linux - How to Configure Software RAID Tutorial 19

Ubuntu Linux - How to Configure Software RAID Tutorial 20

You’ll be taken back to the RAID configuration menu. Choose ‘Create MD device’ to begin creating the 2nd RAID:

Ubuntu Linux - How to Configure Software RAID Tutorial 15

Ubuntu Linux - How to Configure Software RAID Tutorial 16

Ubuntu Linux - How to Configure Software RAID Tutorial 17

Ubuntu Linux - How to Configure Software RAID Tutorial 18

Choose both of the 14GB partitions (again, there should be one on each disk):

Ubuntu Linux - How to Configure Software RAID Tutorial 21

Ubuntu Linux - How to Configure Software RAID Tutorial 20

Choose ‘Finish’ to complete the RAID configuration.

Now we partition the 2 RAIDs. You’ll see ‘RAID1 device #0’ and ‘RAID1 device #1’. These are the only to we need to partition.

To configure the swap RAID partition, select the 2GB RAID device listed under ‘RAID1 device #0’:

Ubuntu Linux - How to Configure Software RAID Tutorial 23

For ‘Use as’, select ‘swap area’ and then choose ‘Done setting up the partition’:

Ubuntu Linux - How to Configure Software RAID Tutorial 24

You will be taken back to the partitioning menu. Select the 2nd RAID device (in this case, it’s the 14GB one) from the menu. You can configure the RAID device with whatever file system you need, but we are going with the default, Ext4. For the ‘Mount point’, make it the root by selecting “/”. Now choose ‘Done setting up the partition’:

Ubuntu Linux - How to Configure Software RAID Tutorial 26

Your RAID devices should be partitioned similar to what is listed below. Choose ‘Finish partitioning and write changes to disk’:

Ubuntu Linux - How to Configure Software RAID Tutorial 27

Typically, the reason why RAID is implemented is so the operating system will continue to operate in the event of a single disk failure. Choose ‘Yes’ here so you will not see any interruptions when booting with a failed disk:

Ubuntu Linux - How to Configure Software RAID Tutorial 28

Ubuntu Linux - How to Configure Software RAID Tutorial 29

Almost done! The operating system will continue to install on the RAID you setup:

Ubuntu Linux - How to Configure Software RAID Tutorial 30

After the operating system installs, you will be prompted to install GRUB. Choose YES to install it to the Master Boot Record:

Ubuntu - How to Create Software RAID 1 in 12.04 Ubuntu Linux

As you can see, installing GRUB to the Master Boot Record will install it to both hard disks, (/dev/sda & /dev/sdb).

Ubuntu - How to Create Software RAID 1 in 12.04 Ubuntu Linux

That’s it! After the install is complete, you should be able to boot into the OS. If you loose a hard disk, the OS will continue to run without interuption.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: