Skip to content
Tags

I predict a RAID, I predict a RAID !

May 4, 2012

How to create a simple Raid 1 Mirror Array

Make sure you have mdadm installed, if you have not then :-

prompt> yum install mdadm

Make sure you have 2 hard drive/2 partitions in total, each from a different hard drive that you can use for this Raid 1 setup

Do a quick : –

prompt> mdadm – – detail – scan

This will help to show if there are any RAID setups already on your system

Create the Raid 1

prompt> mdadm –C /dev/md0 –n2 /dev/hd a /dev/hdb –l1

This will create the raid array and start it.

Now to make sure the Raid array assembles each and every time you restart your computer make sure to: –

prompt> mdadm – – examine – – scan >> /etc/mdadm.conf

If you do not do the top bit mentioned then you will need to assemble the Raid array manually every time you restart your computer (mdadm –assemble –scan)

Now you need to put a file system on the /dev/md0 so that you can utilise the Raid Array.

To do this: –

prompt> Mke2fs -j /dev/md0

Now make sure to mount the Raid array so that you can use it.

prompt> mkdir /mnt/raid1

prompt> mount /dev/mdo /mnt/raid1

Now you can use the Raid Array that you have built on /dev/md0 by going to /mnt/raid1 and using it as a normal file system

Further Notes on managing a Raid Array

Sometimes a hard drive might fail. When it does fail you would like to know as soon as possible so that you can deal with the failure by replacing it with a new hard drive. Do a prompt> mdadm –D /dev/md0 to get a summary of how your raid array is working.

Now to remove the failed hard drive: –

prompt> mdadm /dev/md0 – – remove /dev/hdb

Then once you have removed the above hard drive and have replaced it with a new hard drive just add that hard drive into your Raid array by doing the following: –

prompt> mdadm /dev/md0 – – add /dev/hdc

If you type a prompt> mdadm –D /dev/md0 then you will be able to see first hand the raid array rebuilding itself from a clean, degraded state to a clean,degraded,recovering stage and finally to a clean state.

Advertisements

From → Linux

Leave a Comment

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: