LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-11-2011, 06:42 PM   #1
mjtice
LQ Newbie
 
Registered: Feb 2005
Posts: 12

Rep: Reputation: 0
mdadm: Removed two drives (still valid) from raid-5 and need to add them back in.


I have a 4 disk raid 5 array on my Ubuntu 10.10 box. They are /dev/sd[c,d,e,f]. Smartctl started notifying me that /dev/sde had some bad sectors and the number of errors was increasing each day. To mitigate this I decided to buy a new drive and replace it.

I have an external 4-bay disk enclosure. I failed /dev/sde via mdadm:
Code:
mdadm --manage /dev/md0 --fail /dev/sde
mdadm --manage /dev/md0 --remove /dev/sde
I pulled the drive from the enclosure . . . and found it was the wrong drive. I then tried to add that drive back in (this time with a different dev name):
Code:
mdadm --manage /dev/md0 --re-add /dev/sdh
The problem is now I have two drives in my raid 5 which of course won't start:
(
Code:
# mdadm -As /dev/md0
mdadm: /dev/md0 assembled from 2 drives and 2 spares - not enough to start the array.
)

I can get the raid started with:
Code:
mdadm --incremental --run --scan
How can I add these two still-valid spares back into my array? Here is --detail:
Code:
/dev/md0:
        Version : 00.90
  Creation Time : Thu May 27 15:35:56 2010
     Raid Level : raid5
  Used Dev Size : 732574464 (698.64 GiB 750.16 GB)
   Raid Devices : 4
  Total Devices : 4
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Fri Mar 11 15:53:35 2011
          State : active, degraded, Not Started
 Active Devices : 2
Working Devices : 4
 Failed Devices : 0
  Spare Devices : 2

         Layout : left-symmetric
     Chunk Size : 64K

           UUID : 11c1cdd8:60ec9a90:2e29483d:f114274d (local to host storage)
         Events : 0.43200

    Number   Major   Minor   RaidDevice State
       0       8       80        0      active sync   /dev/sdf
       1       0        0        1      removed
       2       0        0        2      removed
       3       8       32        3      active sync   /dev/sdc

       4       8       64        -      spare   /dev/sde
       5       8       48        -      spare   /dev/sdd

Anyway, any help is appreciated.

Last edited by mjtice; 03-11-2011 at 06:45 PM. Reason: removed line where I thought I couldn't start array.
 
Old 03-11-2011, 08:43 PM   #2
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
You should have re-added with the same device name. If re-adding doesn't work you should be able to simply add as well.

jlinkels
 
Old 03-11-2011, 09:31 PM   #3
mjtice
LQ Newbie
 
Registered: Feb 2005
Posts: 12

Original Poster
Rep: Reputation: 0
No dice, it comes back with an error
Code:
# mdadm --add /dev/md0 /dev/sde
mdadm: Cannot open /dev/sde: Device or resource busy
 
Old 03-12-2011, 08:46 AM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
I hate this. I have had this before as well, but can't remember how I solved it. The array is certainly not lost, but I can't recall the steps taken to reassemble it. I hope someone else has a better memory than me. Sorry.

jlinkels
 
Old 03-13-2011, 04:44 PM   #5
mjtice
LQ Newbie
 
Registered: Feb 2005
Posts: 12

Original Poster
Rep: Reputation: 0
Posting on the linux-raid mailing list a solutions was offered. This is what I did:

Code:
mdadm --create /dev/md0 --level=5 --raid-devices=4 --assume-clean --metadata=0.90 --chunk=64 /dev/sdf /dev/sde /dev/sdd /dev/sdc
Noting that the metadata version and chunk size were the same as when I originally setup the raid (which were the defaults, so that worked out well). The drive order is the order that is listed in the --detail view. If that above order didn't work I would have needed to swap /dev/sde and /dev/sdf around.

I ran an fsck -n on the /dev/md0 device after running the above command to make sure it came back okay, which it did. Then ran a full fsck and mounted up my array.
 
Old 03-13-2011, 05:00 PM   #6
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
Glad for you.

It looks scary to create a new array of existing data, but apparently it works. Thanks for posting back.

jlinkels
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Raid 10 not assembling mdadm assembled from 2 drives - not enough to start the array Nemus Linux - Server 1 02-21-2011 12:27 AM
RAID mdadm cant add disks to array vockleya Linux - Software 4 09-13-2010 06:37 PM
Broken raid 5 (11 drives in mdadm) -- data recovery/raid reconstruction needed -- ple jml48197 Linux - Server 4 07-27-2010 01:57 PM
Using mdadm with different capacity drives in RAID 5? lolhan Linux - Server 2 10-27-2009 08:18 AM
[SOLVED] Software RAID (mdadm) - RAID 0 returns incorrect status for disk failure/disk removed Marjonel Montejo Linux - General 4 10-04-2009 07:15 PM


All times are GMT -5. The time now is 10:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration