Monday, March 16, 2009

Change the slot number of Raid 1 device by mdadm

The command gives the following results after one drive is removed from Raid 1:
mdadm --detail /dev/md1
Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 17 1 active sync /dev/sdb1

What I wanted to do is to move the device /dev/sdb1 to slot 0 from slot 1. And I found I could do that by running mdadm in grow mode with the degraded Raid 1 array:
mdadm --grow --force -n 1 /dev/md1
mdadm --detail /dev/md1
Number Major Minor RaidDevice State
0 8 22 0 active sync /dev/sdb1
mdadm --grow --force -n 2 /dev/md1
mdadm --detail /dev/md1
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 0 0 1 removed


Then add a new device into md1
mdadm /dev/md1 -a /dev/sda1
mdadm: hot added /dev/sda1

Now I can install Lilo to the drive with -H option

No comments: