I have (had) a RAID 1 array (2 disk mirror) and one of the disks, sda, failed. So I've replaced the bad disk with a new one, but seem to be stuck on how to get the second drive back up and running as part of the array.
The system is running Ubuntu Server 9.04 and was configured as follows:
MD0 => sda1,sdb1
MD1 => sda3,sdb3
MD2 => sda2,sdb2
mdadm --detail /dev/md0
shows two drives:
0 /dev/sdb1 "Active Sync"
1 [nothing] "Removed"
MD1 and MD2 look the same.
The tutorial I found says to mark each partition as failed using the command:
mdadm --manage /dev/md0 --fail /dev/sda1
But, since the drive is not there, I get:
mdadm: cannot find /dev/sda1: No such file or directory
Can I skip the failing step? Or is there some other way to fail a partition that's no longer present? Or if I copy the partition table from the good old drive to the new one, will it automatically pick up that it's the replacement?
I'm new at this and don't want to screw it up. 🙂
Best Answer
You shouldn't need to fail them. Since they should have already been failed when you first noticed the issue and the RAID members are now removed. There are just a few steps to get it back up and running.
Setup partitions on the replacement disk. These partitions should be identical in size to that of the failed and currently active disk, and should be marked as partition type "Linux RAID Autodetect" (0xFD). You can simplify this by copying the partition table with
sfdisk
.If the disk has been used before then you may want to ensure that any existing softRAID information is removed before you begin again.
Install an MBR onto the new disk so that it is bootable. Do this from the
grub
shell. Assumes that/dev/sda
is the first disk.Add new partitions back to the arrays.
Monitor the status of their reconstruction by viewing
/proc/mdstat
. You can automate this with.