RAID1 Configuration On CentOS 7

RAID1 Configuration On CentOS 7

raid1 configuration, RAID1 Configuration On CentOS 7 ubuntu, mdadm, raid 1, raid configuration, raid configuration in linux, mdadm commands in linux, mdadm command, mdadm linux,  disk mirroring, lokesh, linuxtopic, raid0, raid6, raid5, raid1
RAID1 is also known as Disk Mirroring , It is the technique of writing the same data to more than one disk drive.


Requirement : minimum 2 HDD

Step : 1

Install Required Package

CentOS/Rhel   

yum install mdadm

Ubuntu        

apt-get install mdadm

raid1 configuration, RAID1 Configuration On CentOS 7 ubuntu, mdadm, raid 1, raid configuration, raid configuration in linux, mdadm commands in linux, mdadm command, mdadm linux,  disk mirroring, lokesh, linuxtopic, raid0, raid6, raid5, raid1

Step 2:


Examine Disk Drive

fdisk -l


mdadm /dev/sd[b-c]





Step 3:

Drive Partition

fdisk /dev/sdb


Follow the below instructions

Press ‘n‘ for creating new partition.


Then choose ‘P‘ for Primary partition.


Next select the partition number as 1.


Give the default full size by just pressing two times Enter key.


Next press ‘p‘ to print the defined partition.


Press ‘L‘ to list all available types.

Type ‘t‘ to choose the partitions.

Choose ‘fd‘ for Linux raid auto and press Enter to apply.

Then again use ‘p‘ to print the changes what we have made.

Use ‘w‘ to write the changes.


After ‘/dev/sdb‘ partition has been created Successfully , Follow the same instructions to create new partition on /dev/sdc drive.

fdisk /dev/sdc



Step 4:

Verify the changes on both sdb & sdc drive

mdadm /dev/sd[b-c]


mdadm /dev/sd[b-c]1


Step 5:

Create Raid1

mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sd[b-c]1

raid1 configuration, RAID1 Configuration On CentOS 7 ubuntu, mdadm, raid 1, raid configuration, raid configuration in linux, mdadm commands in linux, mdadm command, mdadm linux,  disk mirroring, lokesh, linuxtopic, raid0, raid6, raid5, raid1

Check Process and %

cat /proc/mdstat

raid1 configuration, RAID1 Configuration On CentOS 7 ubuntu, mdadm, raid 1, raid configuration, raid configuration in linux, mdadm commands in linux, mdadm command, mdadm linux,  disk mirroring, lokesh, linuxtopic, raid0, raid6, raid5, raid1


Step 6:

Check the raid devices type

mdadm -E /dev/sd[b-c]1

Raid Level : raid1
Raid Devices : 2

raid1 configuration, RAID1 Configuration On CentOS 7 ubuntu, mdadm, raid 1, raid configuration, raid configuration in linux, mdadm commands in linux, mdadm command, mdadm linux,  disk mirroring, lokesh, linuxtopic, raid0, raid6, raid5, raid1

Check Device Array

mdadm --detail /dev/md0


Step 7:

Creating File System on RAID Device

mkfs.ext4 /dev/md0

raid1 configuration, RAID1 Configuration On CentOS 7 ubuntu, mdadm, raid 1, raid configuration, raid configuration in linux, mdadm commands in linux, mdadm command, mdadm linux,  disk mirroring, lokesh, linuxtopic, raid0, raid6, raid5, raid1


Step 9:

Save Raid Configuration :

Ubuntu:

mdadm --detail --scan >> /etc/mdadm/mdadm.conf

CentOS

mdadm --detail --scan >> /etc/mdadm.conf

Step 9:

Mount Raid Partition : Temp
mkdir /raid1

mount /dev/md0 /raid1

df -h #verify

Mount Raid Partition : Permanent

vi /etc/fstab

/dev/md0    /raid1         ext4         defaults 0 0

raid1 configuration, RAID1 Configuration On CentOS 7 ubuntu, mdadm, raid 1, raid configuration, raid configuration in linux, mdadm commands in linux, mdadm command, mdadm linux,  disk mirroring, lokesh, linuxtopic, raid0, raid6, raid5, raid1

mount -a


Raid devices don't really exist on their own; they have to be assembled each time you want to use them

Assemble Raid :
mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1

Auto Mount Raid1 using systemd service in CentOS 7 / Ubuntu 16... Click Here


Stopping a running RAID device

mdadm --stop /dev/md0

Starting RAID device

mdadm --run /dev/md0


Previous
Next Post »