[RAID] Adding devices to RAID array using 'mdadm' (Linux)
Step-by-step guide
Check devices installed using
'fdisk -l'
You can also use'df -h'
to view list of devices in MB/GB's#Example:
Device Boot Start End Blocks Id Systemroot@admin:~$ fdisk -l
/dev/sda1 * 1 20 153600 83 Linux
/dev/sda2 20 36990 296960000 83 Linux
/dev/sda3 36990 52287 122880000 83 Linux
/dev/sda4 52287 91202 312579072 5 Extended
/dev/sda5 52288 65036 102400000 83 Linux
/dev/sda6 65036 66311 10240000 82 Linux swap / Solaris
/dev/sda7 66311 91202 199936000 83 LinuxCheck to make sure the device you use is properly partitioned for the RAID array you plan on adding it to
Check your current RAID configuration using
'/proc/mdstat'
to ensure you know which RAID array you are targetingroot@admin:~$ cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sdb2[1] sda2[0]
136448 blocks [2/2] [UU]
md2 : active raid1 sdb3[1] ada3[0]
129596288 blocks [2/2] [UU]
md3 : active raid5 adl1[9] sdk1[8] sdj1[6] sdh1[5] sdg1[4] sdf1[3] sde1[2] sdd[1] sdc[0]
1318680576 blocks level 5, 1024k chunk, algorithm 2 [10/10] [UUUUUUUUUU]
md0 : active raid1 sdb[1] sda[0]
167877736 blocks [2/2] [UU]
unused devices: <none>
Add device to RAID array using 'sudo mdadm --manage /dev/md# --add /dev/sdx#'
#Example:
root@admin:~$ sudo mdadm --manage /dev/md1 --add /dev/sda3
Check status in '/proc/mdstat'
#Example:
Personalities : [raid1] [raid6] [raid5] [raid4]
md127 : active raid5 sdh1[6] sdg1[4] sdf1[3] sdeq[2] sdd1[1] sdc1[0]
1464725760 blocks level 5, 64k chunk, algorithm 2 [6/5] [UUUUU_]
[===>.................] recovery = 14.2% (41598211/292945152) finish=125.5min speed=33440K/sec