View Single Post
  #1 (permalink)  
Old 20-06-2006, 05:40 PM
sweta's Avatar
sweta sweta is offline
Contributors
User
 
Join Date: Feb 2005
Location: New Delhi
OS: Suse, RHEL, Vista
Posts: 199
Thanks: 12
Thanked 9 Times in 9 Posts
Rep Power: 7
sweta has a spectacular aura about sweta has a spectacular aura about
Default Setting up RAID 1 mirroring on a running remote Linux system

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 i.e. 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’t done during installation; so I was asked to do so…

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 – 40 GB)
/dev/hdc (/dev/hdc1 – 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…

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
Reference:
==> Remote Conversion to Linux Software RAID-1 for Crazy Sysadmins HOWTO
http://togami.com/~warren/guides/remoteraidcrazies/
==> man mdadm

Enjoy!!!
__________________
Reply With Quote