User Tools

Site Tools


linux:centos:software-raid1-setup

This is an old revision of the document!


Create a software RAID 1 setup with two hard disks

Intro

RAID 1 = mirrored pair of two hard disks If one disk fail, the raid will continue to be operational. Read performance will be increased for parallel read operations. Write performance will be likely the same (almost the same).

Prerequisites

  • Two hard disks of same size.
  • mdadm should be installed.
yum install mdadm

Setup

Format first hard disk (/dev/sda) with xfs (supports also hard disks higher than 2TB)

mkfs.xfs -f -L DISK1 /dev/sda

-f = force
-L = hdd label

Format second hard disk (/dev/sdb) with xfs.

mkfs.xfs -f -L DISK2 /dev/sdb

Create the raid array.

mdadm --verbose --create /dev/md0 --level=raid1 --raid-devices=2 /dev/sda /dev/sdb

Format the raid array as xfs.

mkfs.xfs /dev/md0

Mount the raid array (in /data1 folder)

mkdir /data1
mount /dev/md0 /data1

Automatically mount the raid volume at startup.
Edit /etc/fstab and add:

/dev/md0 /data1 xfs defaults 0 0

Load automatically the raid 1 configuration at startup.

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

Check the raid configuration.

mdadm -D /dev/md0
linux/centos/software-raid1-setup.1586780616.txt.gz · Last modified: 2023/07/04 19:36 (external edit)