[aklug] Re: Raid 1 Disk failure - Rebuild question

From: Ryan <carbonfreeze@gmail.com>
Date: Mon Apr 14 2008 - 22:25:19 AKDT

On Mon April 14 2008, William D. McKinney wrote:
> I have a software raid 1 system with a failed disk. I will be ordering a
> new disk and wondered if rebuilding the mirror is simple in nature. The
> raidtab looks like this:
>
>

Assuming that sdb is the failed disk. If the disk is not already marked as
faulty/failed by mdadm --detail /dev/md*, then you will need to mark them as
such:

mdadm --fail /dev/md0 /dev/sdb1
...

Remove the failed partitions from the md device(s):

mdadm --remove /dev/md0 /dev/sdb1
...

Install your replacement hard disk and create partitions with fdisk:

1). Get the cylinder information for your current raid hard disk via fdisk.
This is the 3rd and 4th columns of fdisk -l /dev/sda output. An example
below:

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 12 96358+ fd Linux raid autodetect
/dev/sda2 13 3051 24410767+ fd Linux raid autodetect
/dev/sda3 3052 3537 3903795 fd Linux raid autodetect
/dev/sda4 3538 48641 362297880 5 Extended
/dev/sda5 3538 48641 362297848+ fd Linux raid autodetect

2). Partition the new hard disk, make sure that each new partition has an
equal number of cylinders (or slightly greater) to the partitions which
contain the md0-2 devices. If the size of the new partitions is smaller than
the md partitions, mdadm will refuse to add them to the array. fdisk can be
used to partition the new drive. In this case, I will use the above partition
layout as an example for creating a new partition table on the new hard disk:

fdisk /dev/sdb
n (new partition)
p (create primary partition)
1 (select partition number)
enter (use default start cylinder value)
12 (select end cylinder for the partition. This should be the same as the end
for /dev/sda1).
n (new partition)
p (create primary partition)
2 (select partition number)
enter (use default start cylinder value)
13 (select end cylinder for the partition. This should be the same as the end
for /dev/sda2).

*** and so on for each additional partition ***

Before exiting fdisk, verify that the partitions are set as type fd (linux
raid). If they are not, it is recommended that you do so at this time. In
fdisk:
t (set partition type)
1 (select partition)
fd (partition type)

Additionally, if the md device is mounted as /boot, it should have the
bootable flag set. If there is no /boot partition, then /root should be set
as active/bootable (This ofcourse, depends on your bootloader configuration).
In fdisk:
a (set bootable flag)
1 (select partition)

After you have finished mucking about in fdisk, write changes to disk:
w (write & sync changes to disk)

3). Add the newly created partitions to the md device:

mdadm --add /dev/md0 /dev/sdb1
mdadm --add /dev/md1 /dev/sdb2
...

Depending on the size of the array, rebuild could take some time. You can
check the progress of the rebuild, and of the rest of the arrays:

cat /proc/mdstat

The above directions assume that the replacement disk is of equal or greater
size to the failed disk. If you don't want to muck about on the command line,
you can use the YAST partition/disk management module to do this with a GUI.
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Mon Apr 14 22:25:56 2008

This archive was generated by hypermail 2.1.8 : Mon Apr 14 2008 - 22:25:56 AKDT