LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-11-2011, 01:46 PM   #1
Murz
LQ Newbie
 
Registered: Jun 2009
Posts: 14

Rep: Reputation: 0
Recover mdadm raid1 data after recreate new array over old


I had the raid1 (mirror) mdadm working array /dev/md1 with one failed disk, so /dev/sda5 is active and /dev/sdb5 is missing (partition is deleted), and I try to mark second drive as failed.
But I do the mistake: create new array over old data instead of run:
Code:
# mdadm --stop /dev/md1
# mdadm --create /dev/md1 /dev/sda5 ...
instead of
# mdadm --assemble /dev/md1
or 
# mdadm --run /dev/md1
So, this create command overwrite the superblock and other info about old md1 array.
How can I recover data from old md1 array now?
 
Old 12-13-2011, 10:12 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,147

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
Quote:
Originally Posted by Murz View Post
I had the raid1 (mirror) mdadm working array /dev/md1 with one failed disk, so /dev/sda5 is active and /dev/sdb5 is missing (partition is deleted), and I try to mark second drive as failed.
But I do the mistake: create new array over old data instead of run:
Code:
# mdadm --stop /dev/md1
# mdadm --create /dev/md1 /dev/sda5 ...
instead of
# mdadm --assemble /dev/md1
or 
# mdadm --run /dev/md1
So, this create command overwrite the superblock and other info about old md1 array.
How can I recover data from old md1 array now?
This post:
http://kevin.deldycke.com/2007/03/ho...d-superblocks/

claims that if you recreate your original RAID correctly, that the content will not be destroyed.
Before doing anything it would be a good idea to make a binary copy of the whole partitions and only work on the copies. Something like:

Code:
dd if=/dev/sda5 of=/dev/sdz1 bs=1m
 
Old 12-15-2011, 05:04 AM   #3
Murz
LQ Newbie
 
Registered: Jun 2009
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by smallpond View Post
This post:
http://kevin.deldycke.com/2007/03/ho...d-superblocks/

claims that if you recreate your original RAID correctly, that the content will not be destroyed.
Thanks, I recreate my raid, but after that it don't want to mount correctly. But I run fsck /dev/md1, it found and recover many errors, but after that I correctly mount it and see my files.
I found info that mdadm metadata version 0.90 save superblock at end of drive, but 1.2 version - at first of drive, so after I create over old mdadm 0.90 mdraid new 1.2 mdraid, it rewrite the start of ext3 filesystem. But fsck found copies and recover it.
 
  


Reply

Tags
mdadm, recovering



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] recreate raid-5 array w/o loosing data BinWondrin Linux - Server 6 09-10-2012 08:09 PM
Add disk to raid1 array in imsm container with mdadm (not losing data). 82801ER ICH5R moon300 Linux - General 7 01-06-2010 03:39 PM
raid1 mdadm repair degraded array with used good hard drive catbird Linux - Hardware 7 07-09-2009 12:31 AM
Unable to recover files in corrupted raid1 array trostr Linux - Server 0 05-03-2009 05:42 PM
Degraded raid1 array problem on slack 12.0.0 / mdadm slack-12.0.0 Slackware 5 10-12-2007 06:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:00 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
Open Source Consulting | Domain Registration