ComTech: IT Support Stirling

How to set up software RAID on Ubuntu 12.04

ComTech: IT Support Stirling

Today I will show you how to set up software RAID on Ubuntu 12.04.  It is always better to use hardware RAID over software RAID as this minimizes system resources but if you are installing Ubuntu 12.04 on a system where there is no hardware RAID available (ie older hardware) then this is the method you need.  This tutorial uses Ubuntu 12.04 but should work on all the major distributions.

For the purpose of this tutorial I will be using 2*500 Gb hard drives and setting up a RAID 1 array.

Boot the system from the Live CD.  Once booted up open up the terminal as we need to check what our two disks are called so type:

sudo fdisk -l

Write down the designations of the two disks (e.g /dev/sda) as we are going to need these later.

Now we need to install a couple of packages.  The first we need to install is gparted so type:

sudo apt-get install gparted

The next is mdadm so type:

sudo apt-get install mdadm

Ok now we need to create partition tables and filesystems on our disks and we do this by using gparted.  In the terminal type:

sudo gparted

which will open up gparted as root allowing you to modify the partitions on the disks.  On both disks create a whole disk partition with ext4 as the filesystem.  This tutorial will show you how.

Once that is done you can close down gparted and we can go about setting up the array.

In your terminal type the following:

sudo mdadm –create –verbose /dev/md0 –level=1 –raid-devices=2 /dev/sda /dev/sdb

NOTE: There are two dashes infront of create, verbose, level and raid

In the above command:

level=1 is the raid level (in this case Mirror)

raid-devices=2 is the number of hard disks in the array

/dev/sda and /dev/sdb are the disks to be used (obtained earlier using fdisk)

If successful then you should get mdadm: array /dev/md0 started

Now we just to check the array so in your terminal type:

mdadm –detail –scan (again using two dashes)

This command should return details of the array we have just set up.

Now on to the install.  You need to install Ubuntu 12.04 the usual way from the CD until you get to the disk partitioning section where instead of using the default “Use entire disk” choose Manual.

When you choose Manual you should see /dev/md0 as one of the available disks.  You will need to specify a mount point (/) and a swap file onto it and then choose it to install Ubuntu 12.04 onto.  Follow the wizard for the rest of the install.

Once Ubuntu 12.04 has been installed reboot the system and you should now have a RAID 1 array set up.

About the Author


Hi I am Chris Wakefield the owner of ComTech IT Support. I provide Windows and Linux based IT Support, laptop repairs and computer repairs to both business and personal clients throughout Stirling, Falkirk and Clackmannanshire.

For a list of what I can offer you why not visit my website where you will find a list of my services, testimonials, blog and much more!!



3 thoughts on “How to set up software RAID on Ubuntu 12.04

  1. To do this on an already running system just run the code that you see here and it should work. That is what I am doing currently.

  2. Glad you like the tutorial George. I have never set up RAID on an existing system just new ones so unfortunately I can’t help you there. Sorry.

  3. Your tutorial is excellent. But I cannot find a similarly good tutorial for setting up RAID-1 on an already installed system.
    I have just bought an exact copy of the same SSD drive.
    I have a fully setup running Ubuntu 12.04 x64 system which I cannot format! Installing again everything from scratch will be very time consuming.
    Could you provide the steps, or a link to a tutorial, for setting up RAID-1 on an already running system?
    Thank you!

Leave a comment

Your email address will not be published.


Get every new post delivered to your Inbox

Join other followers

WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera
WP Like Button Plugin by Free WordPress Templates