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

Re: Mdadm -- Restoring an array



On Tue, 17 Oct 2006 03:07:01 -0400, Hal Vaughan wrote
> I have a server with one drive that has the boot and system on it 
> and a RAID5 device managed by mdadm.  The RAID is made up of 3 hard 
> drives with a 4th spare also hooked up.
> 
> The system drive crashed and I restored it.  The problem is in the 
> past, when I've tried to restore a RAID, I've had trouble with it. 
>  The man page for mdadm makes it look like a RAID can be reassembled 
> with just a --assemble option given on the command line, but it 
> keeps asking for more information.  I thought there was a scan mode, 
> to tell mdadm to scan local drives and re-assemble an existing RAID. 
>  I've tried different options previously to restore a mdadm RAID,
>  but had trouble.
> 
> There is no data on this drive that can't be reconstructed, but to 
> do so would be a bit of a pain and take time (and the backup system 
> for this RAID was still experimental).
> 
> Does anyone have experience rebuilding a mdadm RAID when the config 
> info has been wiped out?  (I wouldn't think that would matter, since 
> the mdadm config files that should have held the RAID info always 
> seemed to be empty on my systems.)

It can be a little tricky sometimes with SW raid when a drive dies.
Especially with Sata Disks, but the mdadm program is quite smart.
I've always used a .conf file even if one wasn't created.
# mdadm --detail --scan |grep ARRAY > /etc/mdadm/mdadm.conf
Then edited the file and added 
DEVICE partitions
DEVICE /dev/md*

This way, mdadm can tell which drives to use to build the array after a
drive failure, and a reboot. Sata drives might switch positions if one
isn't replaced right away, but the mdadm.conf file uses the ID of each drive 
for building. (not its position on the controller)
You should be able to remove the faulty disk from your array and re-add your 
new one in its place. Then it should rebuild itself.
Of course, if a drive is replaced, you'll need to create a new conf file.

Fortunetly, I haven't had to rebuild an array yet without a conf file, but 
as you mentioned, it should be possible as the raid info is stored in the 
disks mbr. (or somewhere like that)

I also like to run / from a raid array. /boot is a mirror,
and so any faulty drive will keep the system bootable.

Cheers,
Mike








Reply to: