Explore information related to creating raid 1 mirror using 2 disks on linux

Configure software RAID on Linux using MDADM - Do it now

This article covers how to Configure software RAID on Linux using MDADM.

To Install a Software Raid Management Tool:

To install mdadm, run the installation command:

1. For CentOS/Red Hat (yum/dnf is used): $ yum install mdadm

2. For Ubuntu/Debian: $ apt-get install mdadm

3. SUSE: $ sudo zypper install mdadm

4. Arch Linux: $ sudo pacman -S mdadm

Terms related to Integrity of a RAID Array:

1. Version – the metadata version

2. Creation Time – the date and time of RAID creation

3. Raid Level – the level of a RAID array

4. Array Size – the size of the RAID disk space

5. Used Dev Size – the space size used by devices

6. Raid Device – the number of disks in the RAID

7. Total Devices – is the number of disks added to the RAID

8. State – is the current state (clean — it is OK)

9. Active Devices – number of active disks in the RAID

10. Working Devises – number of working disks in the RAID

11. Failed Devices – number of failed devices in the RAID

12. Spare Devices – number of spare disks in the RAID

13. Consistency Policy – is the parameter that sets the synchronization type after a failure, rsync is a full synchronization after RAID array recovery (bitmap, journal, ppl modes are available)

14. UUID – raid array identifier

To Recovering from a Disk Failure in RAID, Disk Replacement:

If one of the disks in a RAID failed or damaged, you may replace it with another one. First of all, find out if the disc is damaged and needs to be replaced.

# cat /proc/mdstat

To Add or Remove Disks to Software RAID on Linux:

1. If you need to remove the previously created mdadm RAID device, unmount it:

# umount /backup

2. Then run this command:

# mdadm -S /dev/md0

mdadm: stopped /dev/md0

3. After destroying the RAID array, it won’t detected as a separate disk device:

# mdadm -S /dev/md0

mdadm: error opening /dev/md0: No such file or directory

4. You can scan all connected drives and re-create a previously removed (failed) RAID device according to the metadata on physical drives. Run the following command:

# mdadm --assemble —scan

About Mdmonitor: RAID State Monitoring & Email Notifications:

The mdmonitor daemon can be used to monitor the status of the RAID. 

1. First, you must create the /etc/mdadm.conf file containing the current array configuration:

# mdadm –detail –scan > /etc/mdadm.conf

The mdadm.conf file is not created automatically. You must create and update it manually.

2. Add to the end of /etc/mdadm.conf the administrator email address to which you want to send notifications in case of any RAID problems:

MAILADDR raidadmin@woshub.com

3. Then restart mdmonitor service using systemctl:

# systemctl restart mdmonitor

Then the system will notify you by e-mail if there are any mdadm errors or faulty disks.

Read More