Hi there, On Wed, 16 Aug 2006, 09:28:50 +0200, Tob_Sch@gmx.de wrote:
Hi,
i want to create a raid1 device via mdadm with only one hard disk device at the beginnig. Later, I want to add a second hard disk to this raid1 device.
On the one side following command fails, when the second hard disk doesn't exist, even if I use the "--force" option:
mdadm -C /dev/md0 -l raid1 -n 2 /dev/hda1 /dev/hdb1
On the other side, after using following command with one hard disk
mdadm -C /dev/md0 -l raid1 --force -n 1 /dev/hda1
and following command after attaching the second hard disk
mdadm -a /dev/md0 /dev/hdb1
then the second hard disk becomes only a spare disk.
So my questions are: 1. How can I setup a raid1 device with only one valid disk with the intention to extend the raid1 device later with a second valid disk? 2. How can change a spare device to a active (raid1) device without recreating the raid1 md device?
This case is actually mentioned in the manual page of mdadm: To create a "degraded" array in which some devices are missing, simply give the word "missing" in place of a device name. This will cause mdadm to leave the corresponding slot in the array empty. For a RAID4 or RAID5 array at most one slot can be "missing"; for a RAID6 array at most two slots. For a RAID1 array, only one real device needs to be given. All of the others can be "missing". In your case this means that running the following command will do what you want: mdadm --create /dev/md0 -l 1 -n 2 /dev/hda1 missing
Thanks in advance.
HTH, cheers. l8er manfred