Skip to contentSkip to conversation

modifying a running array

DISCUSSION Lieven Van Acker 3 participants 3 messages Nov 15, 2004 MD RAID

lore
Share & tools
lore
#0 lore raw

Hey folks,

I didn't find any direct pointers on this issue, so maybe you experts can advice me...

I was setting up a system, had only one disk at setup time but wanted to configure raid 1 in advance...

so I used

mdadm --create /dev/md0 --force --run --level=1 --raid-devices=1 /dev/sda1

to create my array.

Now as I have the second disk available, after duplicating the partition table I wanted to add add /dev/sdb1 to the array.

But

mdadm /dev/md0 -a /dev/sdb1

adds this device as a spare one, so the number of active devices stays
1. I could use the build command to reinitialise the array, but I wonder if there's a way to extend the raiddevice while it's running?

Is there any way to arrange this?

Regards,

Lieven

#1 lore raw
Quoted 5 lines · Lieven Van Acker

Hey folks,

I didn't find any direct pointers on this issue, so maybe you experts can advice me...

Quoted 9 lines

I was setting up a system, had only one disk at setup time but wanted to configure raid 1 in advance...

so I used

mdadm --create /dev/md0 --force --run --level=1 --raid-devices=1 /dev/sda1

On your new disk try this:
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdb1 missing

Then make a filesystem on it and copy over the data from /dev/md0 then stop /dev/md0

Once you've done all that try:

mdadm /dev/md1 -a /dev/sda1

I think that'll get you where you want to be.

you may want to hang back a while in case I made a typo ;)

David

PS from the manpage:
Setting a value of 1 is probably a mistake and so requires that --force be specified first. Guess what ;)

#2 lore raw
In reply to Lieven Van Acker
Quoted 18 lines · On Monday November 15, [email protected] wrote:

Hey folks,

I didn't find any direct pointers on this issue, so maybe you experts can advice me...

I was setting up a system, had only one disk at setup time but wanted to configure raid 1 in advance...

so I used

mdadm --create /dev/md0 --force --run --level=1 --raid-devices=1 /dev/sda1

to create my array.

Now as I have the second disk available, after duplicating the partition table I wanted to add add /dev/sdb1 to the array.

Quoted 7 lines

But

mdadm /dev/md0 -a /dev/sdb1

adds this device as a spare one, so the number of active devices stays
1. I could use the build command to reinitialise the array, but I wonder if there's a way to extend the raiddevice while it's running?

If you are running a recent 2.6 kernel and have a recent mdadm, then

  mdadm --grow /dev/md0 --raid-devices 2

will convert /dev/md0 to a 2 device raid1 array, and the spare will start being reconstructed.

NeilBrown