LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-19-2011, 03:17 PM   #1
hyjalsoul
Member
 
Registered: Jul 2007
Distribution: ArchLinux, Ubuntu, Slackware, Fedora
Posts: 46

Rep: Reputation: 15
Unhappy Having trouble recovering data from disk img


I have 2 RAID1 hard drives with possibly hardware errors, (when I tried to mount them in a degraded array, they won't start, throwing some Buffer I/O errors)
So I used ddrescue to make a disk image out of one drive, ran losetup to use the image file as loopback device:
Code:
losetup /dev/loop0 imagefile.img
but when I tried to assemble a raid array including the /dev/loop0 device like:
Code:
mdadm --assemble /dev/md0 --force /dev/loop0
it will complain that no superblock is found on /dev/loop0 device.

With desperation, I tried to create a legacy raid array with following command, of course, including one of the bad drives:
Code:
mdadm -B /dev/md0 --level=1 -n2 /dev/sdb1(bootable partition on the bad drive) /dev/loop0
I successfully created a new RAID1 array, but when I tried to mount it
Code:
mount /dev/md0 /mnt/tmp
it failed because of bad drive sdb
and after I stopped raid array, the disk image file got contaminated too, because I don't see something like anymore:
Code:
   Device Boot      Start         End      Blocks   Id  System
         /dev/loop0p1   *           1       29664   238267392   83  Linux raid autodetect
         /dev/loop0p2           29664       30402     5928961    5  Linux raid autodetect
it only left me one partition with ext4 system on it

Now the only thing I haven't tried is to clean the superblock by doing --zero-superblock, and not sure if that will solve the problem.

Should I get a second drive to hold my broken drive image so that I might be able to assemble a good RAID1 array or should I continue working on the only disk image file I recovered from one of the broken drives?
 
Old 01-19-2011, 03:30 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
I would have just tried to recover the data from the disk image, not tried to put it back into the array
 
Old 01-19-2011, 03:59 PM   #3
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 988
Blog Entries: 4

Rep: Reputation: 254Reputation: 254Reputation: 254
Greetingz!

I agree with kbp, pull the data out of the disk image. However, if you don't have enough disk space for that, and want to use the other (known-good) drive from your RAID1 array, then rebuild it with the --missing option.

Example:
mdadm --assemble /dev/md0 --level=1 -n2 missing /dev/sdb1

That should bring up the RAID1 as degraded and let you mount it.
 
Old 01-19-2011, 04:03 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,996

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
I'm thinking that I might have looked at replacing one drive and then re-image it. If fails then swap original drives. If fails then the controller or other part may be bad.

The image may be used in a VM but I doubt the data is any good.
 
Old 01-19-2011, 04:36 PM   #5
hyjalsoul
Member
 
Registered: Jul 2007
Distribution: ArchLinux, Ubuntu, Slackware, Fedora
Posts: 46

Original Poster
Rep: Reputation: 15
What would be the best way to pull the data out of the image, I suspect because I recovered the image out of a bad drive, the file system might also be corrupted on there. I tried mounting the image as loopback device, it wouldn't let me because it had raid partitions...
I ran something like
Code:
mount -o loop, offest=32256 imagefile.img /mnt/tmp
 
Old 01-19-2011, 04:48 PM   #6
hyjalsoul
Member
 
Registered: Jul 2007
Distribution: ArchLinux, Ubuntu, Slackware, Fedora
Posts: 46

Original Poster
Rep: Reputation: 15
And the fact is both of my RAID1 drives were in bad state... before I had a chance to back up the data out of it.
 
  


Reply



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
Recovering Data from Remaining RAID 1 Disk nko Linux - Software 18 01-10-2016 09:43 PM
Need help recovering data from a fried hard disk lost_data Linux - Hardware 5 07-16-2010 04:33 PM
recovering data from "incomplete disk" beuten Linux - Hardware 3 12-02-2006 11:22 AM
LVM - recovering data after a disk failure. bogaurd Linux - Software 2 12-19-2005 11:34 AM
recovering data from hard disk planctus Linux - Hardware 4 10-10-2005 04:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:11 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