Configuration of RAID 1 in linux

# Configuration of RAID 1.
-------------------------
# Create the Four partitions which must be raid partitions.
fdisk /dev/hda
n--->l--->Enter the First Cylinder--->+100M--->t--->partition no--->fd--->w.

# Reboot the System or use the following command.
partprobe /dev/hda

# Create the RAID device for above partitions.
mdadm -C /dev/md0 -a yes -l 1 -n 2 /dev/hda{11,12}
mdadm -C /dev/md1 -a yes -l 1 -n 2 /dev/hda{13,14}


# Then format this RAID device.
mkefs.ext3 /dev/md0

# Goto another console and mount the RAID block
mkdir /RAID - /RAID is a mount point.
mount /dev/md0 /RAID

# Copy the /lib to /RAID
cp -a /lib /RAID/

# To view raid device in detail
mdadm --detail /dev/md0

# To view status of RAID device use the command,
watch cat /proc/mdstat OR
cat /proc/mdstat status

# Fail the one partition in RAID block.
mdadm --fail /dev/md0 /dev/hda12

# Immediately after failing hda12 recovery starts on hda14 which is for spare.

# Then remove the failed partition and add it again in RAID block to reuse.
mdadm --remove /dev/md0 /dev/hda12
mdadm -a /dev/md0 /dev/hda12

Comments

Popular Posts

Install and configure rsyslog Centralized logging server in CentOS

How to fix postfix/smtp Network is unreachable error

Could not join realm: Necessary packages are not installed: sssd-tools sssd libnss-sss libpam-sss adcli