How to set up RAID 1 on an existing Linux system

Recently I did a tutorial on how to set up RAID 1 on a new Linux system.  Today I will show you how to set up RAID 1 on an existing system.  Why I hear you ask on an existing system? It is true that, if possible, you should set up RAID on a server during installation however there are times that you can’t (only one hard disk present or the person installing didn’t know the correct procedure so chose not too instead).


The method I am going to show you involves using a piece of software called Clonezilla, which is opensource cloning software, so you will need to get your hands on it. You can download it from the Clonezilla website.

For the purpose of this tutorial I will be using Ubuntu 12.04 installed on a 500 Gb hard drive.  I will clone the installation using Clonezilla and then set up a RAID 1 array on two new 1 Tb hard drives.  Once the RAID 1 array has been set up I will then copy the Ubuntu image onto it.

Lets get started.  First thing to do is to BACKUP ALL YOUR DATA.  Even though you are effectively backing up your data when you image it I always recommend you backup your data using a different method just incase something happens.

Now onto imaging your system.  I have already written a tutorial which covers the required steps so rather than repeat myself please refer to the Clonezilla Tutorial for the method.

Once you have imaged your system connect your two new 1 Tb hard drives and disconnect the old 500 Gb one and again reboot the system using the Clonezilla Live CD.  Go through the menus the same as before until you get to the screenshot below.

Clonezilla1

 

This time instead of choosing Start_Clonezilla choose Enter_Shell.  Once at the shell we need to check our two new disks 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 create partitions and filesystems on the two disks and we do this by using fdisk.  The steps required to accomplish this are covered in How to format a hard drive on Ubuntu 12.04 using fdisk.

Now we need to install a package called mdadm which we shall use to set up the RAID 1 array so type:

sudo apt-get install mdadm

Once installed 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.

All that is left to do is to exit the shell and resume Clonezilla so in your terminal type:

exit

which should return you to the screenshot we had earlier.  This time choose Start_Clonezilla.

Follow the wizard to install your saved image onto the new RAID 1 array.

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 in and around Stirling.

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

 

 

 

 

This entry was posted in Blog and tagged 1, clonezilla, existing system, fdisk, how to, linux, mdadm, RAID. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

50,720 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>