CentOS / Redhat: Create Software RAID 1 Array

www.l‮.iruttua‬com
CentOS / Redhat: Create Software RAID 1 Array

To create a Software RAID 1 (mirror) array on CentOS or Red Hat Enterprise Linux (RHEL), you can use the mdadm utility.

  1. Install the mdadm package using the yum package manager:
sudo yum install mdadm
  1. Connect the disks that you want to use for the RAID 1 array to your system.

  2. Identify the device names of the disks that you want to use for the RAID 1 array. You can do this by running the lsblk command or by looking in the /dev/ directory.

  3. Create the RAID 1 array using the mdadm command. For example, to create a RAID 1 array using the /dev/sdb and /dev/sdc disks:

sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc

This will create the RAID 1 array using the specified disks. The --level=1 option specifies that the array should be a RAID 1 (mirror) array, and the --raid-devices=2 option specifies that the array should be created using two disks.

  1. Check the status of the RAID 1 array by running the following command:
sudo mdadm --detail /dev/md0

This will display information about the RAID 1 array, including the status of the array and the devices that it is using.

  1. Create a file system on the RAID 1 array. For example, to create an ext4 file system on the array:
sudo mkfs.ext4 /dev/md0
  1. Mount the RAID 1 array. For example, to mount the array at the /mnt/raid1 mount point:
sudo mount /dev/md0 /mnt/raid1
  1. Edit the /etc/fstab file and add an entry for the RAID 1 array to mount it automatically at boot. For example:
/dev/md0  /mnt/raid1  ext4  defaults  0  0

The RAID 1 array is now set up and will be mounted automatically at boot.

Note: These steps assume that the disks that you are using for the RAID 1 array are not currently in use. If the disks are already in use, you will need to partition and format them before creating the RAID 1 array. You should also be careful when creating a RAID 1 array, as it involves modifying the disks and data on them. It is a good idea to make a backup of any important data on the disks before proceeding.

Created Time:2017-10-16 14:38:41  Author:lautturi