Don't Miss

Software Raid Failed Hard Drive Tips

By on March 8, 2011

Suffer any software raid problem before? Suddenly a hard drive failed to work as normal? This post is about how to remove a failed hard drive from a Linux Software RAID1 array, and how to add a new hard disk to the RAID1 array.

Example Scenario
I have two hard drives, /dev/sda and /dev/sdb, with the partitions /dev/sda1 and /dev/sda2 as well as /dev/sdb1 and /dev/sdb2.

/dev/sda1 and /dev/sdb1 make up the RAID1 array /dev/md0.

/dev/sda2 and /dev/sdb2 make up the RAID1 array /dev/md1.

/dev/sda1 + /dev/sdb1 = /dev/md0

/dev/sda2 + /dev/sdb2 = /dev/md1

/dev/sda has failed, and we want to replace it.

Removing Command
run below to view all:
$ cat /proc/mdstat

To remove /dev/sda, we must make /dev/sda1 and /dev/sda2 as failed and remove them from their respective RAID arrays (/dev/md0 and /dev/md1).

Making /dev/sda1 as failed:
$ mdadm –manage /dev/md0 –fail /dev/sda1

View again:
$ cat /proc/mdstat
You will see as below:
md0 : active raid1 sdb1[1] sda1[0](F)
24418688 blocks [2/1] [U_]

Then we remove /dev/sdb1 from /dev/md0:
$ mdadm –manage /dev/md0 –remove /dev/sda1

View again:
$ cat /proc/mdstat
You will see as below:
md0 : active raid1 sdb1[1]
24418688 blocks [2/1] [U_]

Now you can do the same steps again for /dev/sda2 (which is part of /dev/md1)

Adding Command
To add hard drive:
$ mdadm –add /dev/md0 /dev/sda1
$ mdadm –add /dev/md1 /dev/sda2

View again:
$ cat /proc/mdstat
You will see as below:
md0 : active raid1 sda1[0] sdb1[1]
24418688 blocks [2/1] [U_]
[=>……………….] recovery = 9.9% (2423168/24418688) finish=2.8min speed=127535K/sec

md1 : active raid1 sda2[0] sdb2[1]
24418688 blocks [2/1] [U_]
[=>……………….] recovery = 6.4% (1572096/24418688) finish=1.9min speed=196512K/sec

Congratulation, successfully replaced~

About jonboy60

Contact Me for computer repair services, mobile repair services, website repair services, website maintenance, creating website, domain name, hosting services, career opportunities, business offers, Linux solutions for business or home, web and email server solutions, Linux consulting, wordpress web consulting & development and expertise requests. Currently reside in Rawang, Selangor. Email to me on jonboy60{@}gmail.com

2 Comments

  1. @Hard Disk Recovery

    April 12, 2011 at 11:26 am

    SalvageData is the hard drive data recovery company you can trust knowing your hard drive data recovery is performed by experienced professionals. We also developed the best hard drive data recovery software family of products and tools to help recover your deleted files and lost data.

  2. Bruno

    September 14, 2014 at 8:09 am

    I’m not that much of a online reader to be honest but
    your sites really nice, keep it up! I’ll go ahead and bookmark your site to come back later on. All the best

    my blog software recovery file best the raid
    linux – Bruno

Leave a Reply

Your email address will not be published. Required fields are marked *