Skip to content

quick guide: replacing failed hdd in linux software raid

Today another type of data security.

One day ago a HDD failed in my software RAID 1 system. Today I replaced it and here is a quick guide for doing it:


1. locating defect HDD:

okean0s:/home/sqall# cat /proc/mdstat
md1 : active raid1 sda[0] sdb[2](F)
244198464 blocks [2/1] [U_]

---

2. getting serial number:

okean0s:/home/sqall# smartctl -i /dev/sdb
smartctl 5.40 2010-07-12 r3124 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda 7200.10 family
Device Model: ST3250620A
Serial Number: xxxxxxxx
Firmware Version: 3.AAE
User Capacity: 250,059,350,016 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 7
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Thu Oct 20 21:25:40 2011 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

---

3. fail the HDD in RAID Array:

okean0s:/home/sqall# mdadm --manage /dev/md1 --fail /dev/sdb

---

4. remove the HDD from RAID Array:

okean0s:/home/sqall# mdadm --manage /dev/md1 --remove /dev/sdb

---

5. now shutdown the server and physical remove the HDD and replace it with a new HDD

---

6. add HDD to the RAID Array:

okean0s:/mnt# mdadm --manage /dev/md1 --add /dev/sdb

---

7. verify state:

okean0s:/mnt# cat /proc/mdstat
Personalities : [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sdb[2] sda[0]
244198464 blocks [2/1] [U_]
[>....................] recovery = 0.2% (673344/244198464) finish=90.4min speed=44889K/sec


I found this guide on the web (it's exactly the same as my quick guide) and the author has partitions on the HDDs. So here I like to quote him:

Adding the new disk to the RAID Array:
Now that the new hard drive has been physically installed we can add it to the RAID Array.
In order to use the new drive we must create the exact same partition table structure that was on the old drive.
We can use the existing drive and mirror its partition table structure to the new drive. There is an easy command to do this:

sfdisk -d /dev/sda | sfdisk /dev/sdb

* Note that sometimes when removing drives and replacing them the drives device name may change. Make sure the drive you replaced is listed as /dev/sdb, by issueing command "fdisk -l /dev/sdb" and no partitions exist.

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

The author does not allow comments to this entry

Add Comment

Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
Form options

Submitted comments will be subject to moderation before being displayed.