Fixing a Linux RAID 1 software mirror

Christopher K. Johnson ckjohnson at gwi.net
Sat Jul 17 11:16:36 UTC 2004


Michael Mansour wrote:

>Hi,
>
>I've just noticed I have the following issue on my
>/home (/dev/md5) software RAID mirror:
>
>[root at gazelle root]# lsraid -a /dev/md5
>[dev   9,   5] /dev/md5        
>6A995494.6BAA9433.BC09B08A.778BCE84 online
>[dev   ?,   ?] (unknown)       
>00000000.00000000.00000000.00000000 missing
>[dev  34,   8] /dev/hdg8       
>6A995494.6BAA9433.BC09B08A.778BCE84 good
>
>With the raidtab showing:
>
>raiddev             /dev/md5
>raid-level                  1
>nr-raid-disks               2
>chunk-size                  64
>persistent-superblock       1
>nr-spare-disks              0
>    device          /dev/hde8
>    raid-disk     0
>    device          /dev/hdg8
>    raid-disk     1
>
>and the /proc/mdstat shows:
>
>md5 : active raid1 hdg8[1]
>      20972736 blocks [2/1] [_U]
>
>As /dev/md5 is my /home directory, I don't want to
>lose any data. How can I fix this to get /dev/hde8
>into the md5 raidset without losing my data?
>  
>
I would check whether /var/log/messages shows why you lost that mirror. 
And if the device is responsive at all you might want to run some 
diagnostics on that hard drive /dev/hde using smartctl.

Also you will want the mdadm package installed if it isn't already. 
Configure an email address in /etc/mdadm.conf on the MAILADDR line that 
will reach you. Then:
chkconfig mdmonitor on
service mdmonitor start
That way you will be notified whenever there is a raid failure event in 
the future.

The missing and (unknown) indication I have seen once, and it was when a 
hard drive failed completely. In my case the hard drive had to be 
replaced, but some of the scsi controller status was wedged due to the 
unresponsive drive. So I was not able to hot-swap the drive as the same 
drive name. I ended up having to shutdown, swap drives, and boot back 
up, then partition the new drive and bring mirrors in sync.

Is hde partitioned the same as hdg? If so you can do this to partition 
the new drive:
sfdisk -d /dev/hdg >parts.hdg
sfdisk /dev/hde <parts.sdg

Do you have a swap partition on the drive? If so you will need to do a 
mkswap for that partition and a swapon to bring it online.
mkswap /dev/hdgN
swapon -a

With mdadm package installed - to resync hde8 (If your disk is actually 
fine, then this is the only step you need):
mdadm /dev/md5 -–add /dev/hde8
[repeat for other raid partitions that need to be sync'd]
cat /proc/mdstat # to show progress of synchronization

Do you boot from that drive? If so you will need to fix the grub or lilo 
mbr after synchronization of partitions is completed.

-- 
-----------------------------------------------------------
   "Spend less!  Do more!  Go Open Source..." -- Dirigo.net
   Chris Johnson, RHCE #807000448202021





More information about the fedora-list mailing list