User Tools

Site Tools


linux:centos:software-raid1-setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
linux:centos:software-raid1-setup [2020/04/13 15:29] odeftalinux:centos:software-raid1-setup [2023/07/26 16:04] – [Re-add a good hard disk (after cable disconnection for example)] odefta
Line 3: Line 3:
 ====== Intro ====== ====== Intro ======
  
-RAID 1 = mirrored pair of two hard disks +RAID 1 = mirrored pair of two hard disks \\ 
-If one disk fail, the raid will continue to be operational. +If one disk fail, the raid will continue to be operational. \\ 
-Read performance will be increased for parallel read operations. +Read performance will be increased for parallel read operations. \\ 
-Write performance will be likely the same (almost the same).+Write performance will be likely the same (almost the same). \\
  
 ====== Prerequisites ====== ====== Prerequisites ======
Line 19: Line 19:
 ====== Setup ====== ====== Setup ======
  
-Format first hard disk (/dev/sda) with xfs (supports also hard disks higher than 2TB)+==== Format first hard disk (/dev/sda) with xfs (supports also hard disks higher than 2TB) ====
  
 <code> <code>
Line 28: Line 28:
 -L = hdd label -L = hdd label
  
-Format second hard disk (/dev/sdb) with xfs.+==== Format second hard disk (/dev/sdb) with xfs ====
  
 <code> <code>
Line 34: Line 34:
 </code> </code>
  
-Create the raid array.+==== Create the raid array ====
  
 <code> <code>
Line 40: Line 40:
 </code> </code>
  
-Format the raid array as xfs.+==== Format the raid array as xfs ====
  
 <code> <code>
Line 46: Line 46:
 </code> </code>
  
-Mount the raid array (in /data1 folder)+==== Mount the raid array (in /data1 folder) ====
  
 <code> <code>
Line 56: Line 56:
 </code> </code>
  
-Automatically mount the raid volume at startup. \\+==== Automatically mount the raid volume at startup ==== 
 Edit **/etc/fstab** and add: Edit **/etc/fstab** and add:
 <code> <code>
Line 62: Line 63:
 </code> </code>
  
-Load automatically the raid 1 configuration at startup+==== Load automatically the raid 1 configuration at startup  ==== 
 <code> <code>
 mdadm --detail --scan --verbose >> /etc/mdadm.conf mdadm --detail --scan --verbose >> /etc/mdadm.conf
 </code> </code>
  
-Check the raid configuration.+==== Check the raid configuration ==== 
 <code> <code>
 mdadm -D /dev/md0 mdadm -D /dev/md0
Line 105: Line 108:
  
 </code> </code>
 +==== Replace a failed hard disk in the raid configuration ====
 +
 +Suppose the /dev/sdb hard disk failed. \\
 +To replace it with a good hdd, set it as failed and remove it from the array:
 +<code>
 +mdadm /dev/md0 --fail /dev/sdb --remove /dev/sdb
 +</code>
 +
 +Add the new device to the array:
 +<code>
 +mdadm --add /dev/md0 /dev/sdb
 +</code>
 +
 +==== Re-add a good hard disk (after cable disconnection for example) ====
 +
 +After reinserting the hard disk, it may be mounted now on a different device letter.\\Ckeck it by running:
 +
 +<code>
 +fdisk -l
 +</code>
 +
 +Output:
 +<code>
 +...
 +Disk /dev/sdd: 4000.8 GB, 4000787029504 bytes, 7814037167 sectors
 +Units = sectors of 1 * 512 = 512 bytes
 +Sector size (logical/physical): 512 bytes / 4096 bytes
 +I/O size (minimum/optimal): 4096 bytes / 4096 bytes
 +</code>
 +
 +After identifying it, re-add it to the raid array with:
 +
 +<code>
 +mdadm --manage /dev/md0 --add /dev/sdd
 +</code>
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
linux/centos/software-raid1-setup.txt · Last modified: 2023/07/26 16:06 by odefta