Skip to contentSkip to conversation

How to move a singleton raid1 drive from raid1 /dev/md2 to /dev/md1

DISCUSSION Mitchell Laks 2 participants 3 messages Apr 7, 2005 – Apr 8, 2005 MD RAID

lore
Share & tools
lore
#0 lore raw

Hi Software Raid Gurus!:

I have

A1:~# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 hdb1[0] hdg1[1]
      244195904 blocks [2/2] [UU]

md1 : active raid1 hdc1[0]

      244195904 blocks [1/1] [U]

md2 : active raid1 hde1[0]

      244195904 blocks [1/1] [U]

Now I want to take /dev/hde1 and get rid of /dev/md2 and add /dev/hde1 to /dev/md1.

First i made sure that /dev/md2 was unmounted. I then took it out of /etc/fstab.

Then I did:

A1:~# mdadm /dev/md2 -f /dev/hde1
mdadm: set /dev/hde1 faulty in /dev/md2

Then I tried:

A1:~# mdadm /dev/md2 -r /dev/hde1
mdadm: hot remove failed for /dev/hde1: Device or resource busy

So I didnt know what to do next. So I did

A1:~# mdadm -S /dev/md2

then I did

A1:~# mdadm /dev/md2 -r /dev/hde1
mdadm: cannot get array info for /dev/md2

obviously the wrong thing to do...

A1:~# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 hdb1[0] hdg1[1]
      244195904 blocks [2/2] [UU]

md1 : active raid1 hdc1[0]

      244195904 blocks [1/1] [U]

unused devices: <none>

A1:~#                                              

So I decided not to risk anything else, and I turn to you for help. I would like to take the device /dev/hde1 at this point and add it to /dev/md1 safely and then sync /dev/md1 to full raid1 status ... Then I would like to adjust the /etc/mdadm.conf file ...

I guess I dont know the algorithm for ending a raid on a single drive/partition and then making it subservient to another drive in a raid1 status.

Thank you all for your help!!!!

Mitchell Laks

#1 lore raw
Quoted 9 lines · On Thursday April 7, [email protected] wrote:

Hi Software Raid Gurus!:

I have

A1:~# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 hdb1[0] hdg1[1]
      244195904 blocks [2/2] [UU]
Quoted 8 lines

md1 : active raid1 hdc1[0]

      244195904 blocks [1/1] [U]

md2 : active raid1 hde1[0]

      244195904 blocks [1/1] [U]

Now I want to take /dev/hde1 and get rid of /dev/md2 and add /dev/hde1 to /dev/md1.

md1 is a 1-drive array. You to make it a 2-drive array you need a recent 2.6 kernel and a recent release of mdadm. If you have these, then

mdadm -S /dev/md2 # shutdown md2 and release hde1 mdadm /dev/md1 -a /dev/hde1 # add hde1 as a spare in md1 mdadm -G -n2 /dev/md1 # grow md1 to have two devices.

If you don't have 2.6, then you will have to recreate md1 with the desired number of components, which will require unmounting it.

mdadm -S /dev/md2
mdadm -S /dev/md1
mdadm -C /dev/md1 -l1 -n2 /dev/hdc1 missing

mdadm /dev/md1 -a /dev/hde1

NeilBrown

#2 lore raw

Thanks you Neil!!

i am running debian sarge with 1.9 and kernel 2.6.8 I followed your instructions

mdadm -S /dev/md2 # shutdown md2 and release hde1 mdadm /dev/md1 -a /dev/hde1 # add hde1 as a spare in md1 mdadm -G -n2 /dev/md1 # grow md1 to have two devices.

and now

wustl@A1:~$ cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 hdb1[0] hdg1[1]
      244195904 blocks [2/2] [UU]

md1 : active raid1 hde1[1] hdc1[0]

      244195904 blocks [2/2] [UU]

Yay!!!

Thank you very much.

Mitchell