All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vasco Névoa" <vasco.nevoa@sapo.pt>
To: linux-raid <linux-raid@vger.kernel.org>
Subject: Re: how to recover filesystem after clobbering array?
Date: Sat, 23 Jul 2011 09:19:44 +0100	[thread overview]
Message-ID: <4E2A8420.5000603@sapo.pt> (raw)
In-Reply-To: <20110719120153.1529669k4o1t6v4x@mail.sapo.pt>

I've successfully recovered my array data. :)
All it took was, as I expected, to rebuild the right pointers. The data 
was always untouched.
Here it goes, for the sake of completeness.

I initially used "mdadm --create --assume-clean ..." on a level1 array 
of 2 disks that came from another machine. I didn't know any other way 
of starting an array in this situation. While this is an acceptable 
practice in some cases, it is better to use "--assemble" and pass the 
necessary info (like uuid).

Unfortunately I apparently lost all the data because the newly created 
metadata superblock was the default 0.9 version, and the original array 
metadata version was 1.2, and this resulted in a missing partition table 
once the array was run.

Then I retrieved the mdadm.conf file from the original machine, and 
there I found the correct metadata version, uuid, array name, array 
device name. I also double-checked the volume partition and filesystem 
type from that machine's /etc/fstab.

So, I zeroed-out the metadata superblocks with "mdadm --zero-superblock 
...", and then proceeded to restore the original metadata superblock 
with "mdadm --create --assume-clean --metadata=1.2 --uuid=... 
--name=...  --level=1 --raid-devices=2 /dev/sde1 missing", and it worked 
just fine. The array was started and I could see the original data 
partition with fdisk and actually mount it. After this successful test, 
I just added the other disk to the array.

The one information I expected from this list was: "No problem, your 
data is still there. If you can recreate the superblock with the same 
metadata version as it used to be, everything reverts to normal." 
Unfortunately I had no such support.

Cheers,
Vasco.

On 19-07-2011 12:01, Vasco Névoa wrote:
> Thank you very much, Tyler and David.
> Good advice.
>
> The array is level 1, built upon primary partitions of the devices.
> The file system is EXT4.
> The mdadm command that I stupidly used to create instead of starting 
> the array included "--assume-clean" but no "--build".
> I checked via /proc/mdadm that the array came up without syncing 
> anything (or at least it was ultra-fast, less than 5 seconds).
> So I firmly believe the data is all there, on both disks.
> I just need to rebuild the metadata to point to the data again somehow.
> Right?...
>
> Citando "Tyler J. Wagner" <tyler@tolaris.com>:
>
>> On 2011-07-19 11:17, David Brown wrote:
>>> Once you have got image files for each of your disks, make copies of
>>> these image files to another spare disk. Keep careful notes of exactly
>>> what you have done here, and which files are which. And put your
>>> original disks, carefully labelled, on a shelf somewhere.
>>>
>>> Now you are in a position to attempt data recovery on your copied
>>> files. If you do something wrong, you can simply re-copy the image
>>> files and try again. You still have absolutely no guarantees that
>>> you'll get anything back - but at least you can be sure you are not
>>> going to make anything worse.
>>
>> Follow David's advice.
>>
>> What was the filesystem on the array?
>>
>> Now, use testdisk, photorec, and foremost to seek through the raw images
>> and extract files. The good news is, most video formats are detectable
>> by these tools. All can be installed with your package manager.
>>
>> Regards,
>> Tyler
>>
>> -- 
>> "Offending fundamentalists isn't my goal - but if it is an inevitable
>> side-effect of defending human rights, so be it."
>>    -- Johann Hari
>>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-07-23  8:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-19  9:43 how to recover filesystem after clobbering array? Vasco Névoa
2011-07-19  9:46 ` Vasco Névoa
2011-07-19 10:17 ` David Brown
2011-07-19 10:43   ` Tyler J. Wagner
2011-07-19 11:01     ` Vasco Névoa
2011-07-19 12:44       ` Tyler J. Wagner
2011-07-23  8:19       ` Vasco Névoa [this message]
2011-07-23  8:43         ` Mikael Abrahamsson
2011-07-23 19:04           ` CoolCold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E2A8420.5000603@sapo.pt \
    --to=vasco.nevoa@sapo.pt \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.