Linux and RAID1:

Linux is an operating system which is based on UNIX and it is an open source OS. RAID 1 is disk mirroring is reconstruction of data to two or more disks. Applications which need high availability and high performance use RAID 1. The data can be read from both the disk at the same time, when the data is operational and the operations are made fast. If the disk is operational, the RAID array can be operated. Always write operations will be slow as it is done only once. RAID 1 is a method of grouping the drives that are located individually for forming a big drive known as RAID set. To hold a file system, RAID devices combine many disk drives and make a single device. RAID mirror is extracting mirror of the same data written in two drives. Through mirror data loss is prevented. Every disk in the mirror has another data copy and when one disk fails, data can be retrieved from the other disk. RAID 1 has mirror with high performance and the reading is better than writing. It should have minimum two disks, more disks can also be added. System must have RAID adapter for the purpose of adding more disk

Linux Create Software RAID 1 (Mirror) Array:

Install mdadm:

Mdadm will create, edit and monitor Linux RAID devices. Mdadm can be installed using yum or apt-get package.

Code:
# yum install mdadm
This code is used to install mdadm in RHEL / CentOS / Fedora Linux:

Code:
# apt-get update && apt-get install mdadm
The above code is used to install mdadam in Debian / Ubuntu Linux

Running fdisk:

First fdisk has to be run on /dev/sdc and /dev/sdd.

Code:
# fdisk /dev/sdc
# fdisk /dev/sdd
New Partition:

New partition has to be created of type fd and the partition should not be formatted. The device has valid MD SUPERBLOCK, then the device can be overwritten with ZERO.

Code:
# mdadm --zero-superblock /dev/sdc /dev/sdd
RAID1 is created using two partitions /dev/sdc1 and /dev/sdd1

Code:
# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdc1 /dev/sdd1
/DEV/MD0 is formatted as EXT3

Code:
# mkfs.ext3 /dev/md0
Mounting /DEV/MD0

Code:
# mkdir /raid1
# mount /dev/md0 /raid1
# df –H
Editing /ETC/FSTAB

Code:
/dev/md0 /raid1 ext3 noatime,rw 0 0
RAID1 has to be mounted automatically and /ETC/FSTAB need to be edited and appended in the above line. The file is saved and closed. The status of the building RAID array can be viewed by the following code

Code:
# watch -n 2 cat /proc/mdstat

# tail -f /proc/mdstat
Updating /etc/mdadm/mdadm.conf File

/etc/mdadm/mdadm.conf or /etc/mdadm.conf can be edited or updated using the following code

Code:
ARRAY /dev/md0 devices=/dev/sdc1,/dev/sdd1 level=1 num-devices=2 auto=yes
Existing Array information

The lists of config file will be scanned to check whether they have MD super block, and give information about the identification of MD arrays that are known. Information on the existing arrays can be received by using following command

Code:
# mdadm --query /dev/md0
Author
bhawanisingh
Views
2,557
First release
Last update
Rating
0.00 star(s) 0 ratings
Top