Re: mdctl & adding a new drive to a RAID-1 array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday February 21, jr-list-linuxraid@quo.to wrote:
> I've got a problem. I created a RAID-1 array with only one drive by using:
> 
> mdctl --create /dev/md0 --level=1 --raid-disks=1 /dev/hda2
> 
> Now, I've installed a second drive and want to add it to the array. So I
> tried:
> 
> mdctl -a /dev/md0 /dev/hdc2
> 
> But this does not work as expected. It adds /dev/hdc2 to the list of devices
> in /proc/mdstat:
> 
> md0 : active raid1 hdc2[1] hda2[0]
>       6144768 blocks [1/1] [U]
> 
> but it does not resync the array. I guess this has something to do with the
> fact I originally specified --raid-disks=1. Can it be fixed without
> rebuilding the array from scratch (i.e. without data loss)?

Yes..... you said that you only ever wanted 1 disk in the raid-1
array.  A pretty pointless configuration.

What you should have done is

   mdctl --create /dev/md0 --level=1 --raid-disks=2 /dev/hda2 missing

to say  that you want 2 disks, but the second one is currently
missing.

You can fix this without loosing data.  Just stop the array and
re-create it with the correct information.  The data on the drive will
not be lost.

So:
   make sure that /dev/md0 is not mounted and not in use.
   mdctl --stop /dev/md0
   mdctl --create /dev/md0 --level=1 --raid-disks=2 /dev/hda2 missing
   mdctl --add /dev/md0 /dev/hdc2

and all should be fine.

NeilBrown

> 
> Thanks.
> Jordan Russell
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux