Setting Up RAID 1 Mirroring on a Running Remote Linux System Over Ssh Connection

0
3

Howto: Setting up RAID 1 mirroring on a running remote Linux system over ssh connection

Caution: Make sure you backup all-important data before using this tutorial. I will be not responsible for data loss

But what is a RAID 1?
A single hard drive is mirrored ie an exact copy is made of the original drive. Thus, it result into the increased fault tolerance and easy data recovery option for single server.

Why I am setting a RAID-1 on running system?
Old sys admin did not setup RAID -1 at the time of installation. It is true that the best and easy way to setup a RAID 1 is during installation. Simply create RAID software partition and install the system. Nevertheless, it wasnâEUR (TM) t done during installation; so I was asked to do soâEUR¦

Procedure
Setting up RAID 1 mirroring is easy on running system. Recently we ordered new dedicated hosting server. But they did not setup mirroring for 2 hard disk. My setup was as follows:
/ dev / hdb (/ dev / hdb1 âEUR "40 GB)
/ dev / hdc (/ dev / hdc1 âEUR "40 GB)

Each partition has been 40 GB size ext3 formatted (make sure partition id is set to Linux raid auto).

RAID tools and software was installed. It is called mdadm.

Remember first software device will be / dev / md0, second will be / dev / md1 and so onâEUR¦

You need to type following command to setup / dev / md0:

Code:
mdadm –create / dev / md0 –level = 1 –raid-devices = 2 / dev / hdb1 / dev / hdc1
You can see status, health of / dev / md0 at / proc / mdstat. Type the following command:

Code:
cat / proc / mdstat
Better uses watch command to refresh it automatically:

Code:
watch cat / proc / mdstat
Format / dev / md0 as ext3 fs:

Code:
mkfs.ext3 / dev / md0
Mount / dev / md0 at / data2 directory:

Code:
mkdir / data2
mount / dev / md0 / data2
Don't forget to add / dev / md0 to / etc / fstab:

Code:
vi / etc / fstab
Append following text:

Code:
/ dev / md0 / data2 ext3 defaults 0 0

Source

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.