Replacing disk in Linux Software RAID 1

Michael E. Webster mwebster at intercosmos.com
Fri Aug 13 21:58:16 UTC 2004


Michael, 

Whaddaya know..  I just happen to have a recipe for doing this.
I went through a similar problem about two months ago.
Just substitute /dev/hde and /def/hdg where applicable.


Copy the MBR to /dev/hdc (done before procedure)

prompt# grub

Grub> device (hd0) /dev/hdc

Grub> root (hd0,0)

Grub> setup (hd0)


Make sure that we have the partition table for all drives backed up
(done before)

prompt# sfdisk -d /dev/hda > /raidinfo/partitions.hda

prompt# sfdisk -d /dev/hdc > /raidinfo/partitions.hdc

prompt# more /proc/mdstat > /raidinfo/mdstat.md


Estimated time: zero minutes


Shutdown the box

Remove /dev/hda and label as ‘hda bad’

Boot box to make sure it boots

Shutdown server and place new blank drive in ide0 (new hda)

Estimated time: ten minutes 


Ghost ide1 (hdc) to ide0 (hda)

Do “Boot Image” copy

Estimated time: a little more than an hour


Remove ide1 (original hdc) and label as ‘hdc good’

Power on to make sure ide0 (new hda) boots

Shutdown and place new blank drive in ide1 (new hdc)

Power on to make sure it boots

Shutdown

Estimated time: fifteen minutes


Power on and boot

Copy the MBR to hdc

prompt# grub

Grub> device (hd0) /dev/hda

Grub> root (hd0,0)



Hope this helps,
Mike.




On Fri, 2004-08-13 at 17:51, Michael Mansour wrote:
> Hi,
> 
> I have a server with a 2 disk Linux Software RAID 1
> setup (two 80Gb disks). The first device is /dev/hde
> and the second is /dev/hdg.
> 
> The /dev/hde device is ready to fail, as it produces
> various SMART errors using smartctl and fails on a
> self-test with:
> 
> [root at gazelle root]# smartctl -l selftest /dev/hde
> smartctl version 5.30 Copyright (C) 2002-4 Bruce Allen
> Home page is http://smartmontools.sourceforge.net/
> 
> === START OF READ SMART DATA SECTION ===
> SMART Self-test log structure revision number 1
> Num  Test_Description    Status                 
> Remaining  LifeTime(hours)  LBA_of_first_error
> # 1  Short offline       Completed: read failure      
> 90%        34         0x0463c0ee
> # 2  Short offline       Completed: read failure      
> 90%      1087         0x0425290c
> # 3  Extended offline    Completed: read failure      
> 90%      1072         0x0425290c
> # 4  Short offline       Completed: read failure      
> 90%      1072         0x0425290c
> # 5  Short offline       Completed: read failure      
> 90%      1071         0x0425290c
> 
> The server is running Fedora Core 1.
> 
> I have the new 80Gb disk and wish to replace /dev/hde
> device with the new disk, how do I do this?
> 
> The following is how I have the mirror setup:
> 
> # fdisk -l /dev/hde
> 
> Disk /dev/hde: 80.0 GB, 80026361856 bytes
> 255 heads, 63 sectors/track, 9729 cylinders
> Units = cylinders of 16065 * 512 = 8225280 bytes
> 
>    Device Boot    Start       End    Blocks   Id 
> System
> /dev/hde1   *         1       395   3172806    b 
> Win95 FAT32
> /dev/hde2           396       408    104422+  fd 
> Linux raid autodetect
> /dev/hde3           409      1070   5317515   fd 
> Linux raid autodetect
> /dev/hde4          1071      9729  69553417+   f 
> Win95 Ext'd (LBA)
> /dev/hde5          1071      1331   2096451   fd 
> Linux raid autodetect
> /dev/hde6          1332      1585   2040223+  fd 
> Linux raid autodetect
> /dev/hde7          1586      1716   1052226   fd 
> Linux raid autodetect
> /dev/hde8          1717      4327  20972826   fd 
> Linux raid autodetect
> /dev/hde9          4328      9729  43391533+  fd 
> Linux raid autodetect
> 
> with /dev/hdg being exactly like above.
> 
> As soon as I pull out the /dev/hde device, the server
> won't boot (as grub only resides on /dev/hde), so I
> also installed grub on /dev/hdg to overcome that
> problem. But now I'm wondering what I must do to pull
> out /dev/hde and replace it with the new drive (which
> doesn't have any partitioning setup) and then force
> Linux to resync the data on /dev/hdg to the new
> /dev/hde?
> 
> Is there some way I have to fail the /dev/hde drive,
> replace it then put it back on-line? First time I've
> done this with Software RAID so I'm not sure.
> 
> Any advice is appreciated.
> 
> Michael.
> 
> 
> Find local movie times and trailers on Yahoo! Movies.
> http://au.movies.yahoo.com
> 





More information about the fedora-list mailing list