Centos 7: Adding another member to an existing RAID1 array. 
Scenario: I have a RAID1 array with two disks, I want to add another drive to make it a 3-disk RAID1 array.
[acool@localhost ~]$ 
[acool@localhost ~]$
[acool@localhost ~]$ cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[acool@localhost ~]$
[acool@localhost ~]$ mdadm --version
mdadm - v3.4 - 28th January 2016
[acool@localhost ~]$
[acool@localhost ~]$
[acool@localhost ~]$# new HD was plugged in next available SATA socket
[acool@localhost ~]$
[acool@localhost ~]$#copy gpt table to new disk (sdc)
[acool@localhost ~]$sudo sgdisk /dev/sda -R /dev/sdc
[acool@localhost ~]$
[acool@localhost ~]$#randomize guids
[acool@localhost ~]$sudo sgdisk -G /dev/sdc
[acool@localhost ~]$
[acool@localhost ~]$#reboot

[acool@localhost ~]$
[acool@localhost ~]$#check partitons (sdc should match the others)
[acool@localhost ~]$
[acool@localhost ~]$#add partitions to corresponding md devices
[acool@localhost ~]$ sudo mdadm --manage /dev/md123 --add /dev/sdc5
mdadm: added /dev/sda5
[acool@localhost ~]$ sudo mdadm --manage /dev/md124 --add /dev/sdc4
mdadm: added /dev/sdc4
[acool@localhost ~]$ sudo mdadm --manage /dev/md127 --add /dev/sdc3
mdadm: added /dev/sdc3
[acool@localhost ~]$ sudo mdadm --manage /dev/md126 --add /dev/sdc2
mdadm: added /dev/sdc2
[acool@localhost ~]$ sudo mdadm --manage /dev/md125 --add /dev/sdc1
mdadm: added /dev/sdc1
[acool@localhost ~]$
[acool@localhost ~]$
[acool@localhost ~]$
[acool@localhost ~]$#grow array
[acool@localhost ~]$ sudo mdadm --grow --raid-devices=3 /dev/md123
raid_disks for /dev/md123 set to 3
[acool@localhost ~]$ sudo mdadm --grow --raid-devices=3 /dev/md124
raid_disks for /dev/md124 set to 3
[acool@localhost ~]$ sudo mdadm --grow --raid-devices=3 /dev/md125
raid_disks for /dev/md125 set to 3
[acool@localhost ~]$ sudo mdadm --grow --raid-devices=3 /dev/md126
raid_disks for /dev/md126 set to 3
[acool@localhost ~]$ sudo mdadm --grow --raid-devices=3 /dev/md127
raid_disks for /dev/md127 set to 3
[acool@localhost ~]$
[acool@localhost ~]$
[acool@localhost ~]$
[acool@localhost ~]$#monitor progress
[acool@localhost ~]$
[acool@localhost ~]$ cat /proc/mdstat
Personalities : [raid1]
md123 : active raid1 sda5[2] sdb5[0] sdc5[1]
12582912 blocks super 1.2 [3/3] [UUU]
bitmap: 1/1 pages [4KB], 65536KB chunk

md124 : active raid1 sda4[2] sdb4[0] sdc4[1]
205760 blocks super 1.0 [3/3] [UUU]
bitmap: 0/1 pages [0KB], 65536KB chunk

md125 : active raid1 sda1[2] sdb1[0] sdc1[1]
12582912 blocks super 1.2 [3/2] [UU_]
[======>..............] recovery = 30.1% (3792000/12582912) finish=4.4min speed=32926K/sec
bitmap: 1/1 pages [4KB], 65536KB chunk

md126 : active raid1 sda2[2] sdb2[0] sdc2[1]
7208960 blocks super 1.2 [3/3] [UUU]

md127 : active raid1 sda3[2] sdb3[0] sdc3[1]
1049536 blocks super 1.0 [3/2] [UU_]
resync=DELAYED
bitmap: 0/1 pages [0KB], 65536KB chunk

unused devices: <none>
[acool@localhost ~]$
[acool@localhost ~]$
[acool@localhost ~]$
[acool@localhost ~]$ # all md devices should have 3 Us when sync is finished.
[acool@localhost ~]$
[acool@localhost ~]$




Comments
Comments are not available for this entry.
2025 By Angel Cool