Print
Parent Category: Tutorials
Hits: 8296

In this tutorial i'll show you how to change the RAID1 disks array order from sdaX[1] sdbX[0] to sdaX[0],sdbX[1]

Let's take this example


Blackbird:~# cat /proc/mdstat
Personalities : [raid1]
md5 : active raid1 hdb1[0] hda1[1]
312568576 blocks [2/2] [UU]

unused devices: <none>

We want to change from hdb1[0] hda1[1] to hda1[0] hdb1[1]

First we declare the hdb1 faulty and set the array from 2 to 1 disk using mdadm grow feature


Blackbird:~# mdadm --manage --set-faulty /dev/md5 /dev/hdb1
mdadm: set /dev/hdb1 faulty in /dev/md5
Blackbird:~# mdadm /dev/md5 -r /dev/hdb1
mdadm: hot removed /dev/hdb1
Blackbird:~# cat /proc/mdstat
Personalities : [raid1]
md5 : active raid1 hda1[1]
312568576 blocks [2/1] [_U]

unused devices: <none>
Blackbird:~# mdadm --detail /dev/md5
/dev/md5:
Version : 00.90
Creation Time : Sun Oct 21 11:29:15 2007
Raid Level : raid1
Array Size : 312568576 (298.09 GiB 320.07 GB)
Used Dev Size : 312568576 (298.09 GiB 320.07 GB)
Raid Devices : 2
Total Devices : 1
Preferred Minor : 5
Persistence : Superblock is persistent

Update Time : Tue Nov  2 16:50:24 2010
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0

UUID : 1c2849b4:897dbb3a:b5f0e5d4:d7538707
Events : 0.15314

Number   Major   Minor   RaidDevice State
0       0        0        0      removed
1       3        1        1      active sync   /dev/hda1
Blackbird:~# mdadm --grow --force -n 1 /dev/md5
Blackbird:~# mdadm --detail /dev/md5          
/dev/md5:
Version : 00.90
Creation Time : Sun Oct 21 11:29:15 2007
Raid Level : raid1
Array Size : 312568576 (298.09 GiB 320.07 GB)
Used Dev Size : 312568576 (298.09 GiB 320.07 GB)
Raid Devices : 1
Total Devices : 1
Preferred Minor : 5
Persistence : Superblock is persistent

Update Time : Tue Nov  2 16:51:44 2010
State : clean
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0

UUID : 1c2849b4:897dbb3a:b5f0e5d4:d7538707
Events : 0.15320

Number   Major   Minor   RaidDevice State
0       3        1        0      active sync   /dev/hda1

Then we grow this array to 2 disks insert the second disk and syncronize the array:


Blackbird:~# mdadm --grow -n 2 /dev/md5       
Blackbird:~# mdadm /dev/md5 -a /dev/hdb1
mdadm: added /dev/hdb1
Blackbird:~# cat /proc/mdstat
Personalities : [raid1]
md5 : active raid1 hdb1[2] hda1[0]
312568576 blocks [2/1] [U_]
[>....................]  recovery =  0.0% (170752/312568576) finish=91.4min speed=56917K/sec

unused devices: <none>
Blackbird:~#

Note:

We use Hosting and VPS Hosting, from: www.star-host.org

We like and trust them.

Good prices, high security.