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?
Thanks in advance.
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:
- 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?
- 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
Thanks.
I will tattoo the four letters R, T, F, M on my fingers, I swear ;-)
-------- Original-Nachricht -------- Datum: Wed, 16 Aug 2006 10:01:25 +0200 Von: Manfred Hollstein manfred@die-hollsteins.de An: suse-amd64@suse.com Betreff: Re: [suse-amd64] creating a raid1 device via mdadm (at the beginning with only one hd)
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:
- 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?
- 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
-- Check the List-Unsubscribe header to unsubscribe For additional commands, email: suse-amd64-help@suse.com
Tob_Sch@gmx.de kirjoitti 16.8.2006 kello 10.28:
So my questions are:
- 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?
Quote from the mdadm man page:
"To create a "degraded" array in which some devices are missing, simply give the word "missing" in place of device name. This will cause mdadm to leave the corresponding slot in the array empty."
So, your initial attempt was almost correct. Just change it to:
mdadm -C /dev/md0 -l raid1 -n 2 /dev/hda1 missing
and you should be good to go.
- How can change a spare device to a active (raid1) device without
recreating the raid1 md device?
I haven't tried this myself, but you should first add the new device with
mdadm -a /dev/md0 /dev/hdb1
This will make it a spare disk. Then change the number of active devices in raid1 with
mdadm --grow /dev/md0 -n 2
I hope these instructions will help you.
-- Martti Laaksonen