LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 10-13-2012, 11:59 AM   #1
nerces
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Rep: Reputation: Disabled
Recovering partitions from a disk with damaged first blocs


Bonjour a tous

Some months ago I replaced the 360G by 1T and I was happy, very happy until a bad day when my laptop did'nt went to sleep properly and was transported on a bike with the disk spinning. After that it did'nt boot any more of course. Few unvaluable data were added during these months fortunately. Nevertheless I tried to recover something.

I put the disk in an external USB enclosure.
First attempt on the laptop whith the previous disk (ubuntu 10.04 and linux3.0). The disc is recognized with read errors and the raw device /dev/sdb is not created and disapears.

Second attempt on an older system (ubuntu 8.04 and linux 2.6.12). I'am able to copy data from the damaged disk on another 1T disk with dd ddrescue and safecopy. Usualy the copy stops without any message after few dozen of G.


Then I use gpart to find the starting points of the partitions.

The next step is to use a loop device on the backup disk with offset to mount the partition on the system.

It should work but is not working as it should


Does somehome has experienced that problems?

Alex
 
Old 10-13-2012, 01:31 PM   #2
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,508

Rep: Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221Reputation: 1221
You can find related threads at the bottom, try testdisk.
 
Old 10-13-2012, 08:47 PM   #3
nerces
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
testdisk fails since it access the MBR and open is blocking
 
Old 10-13-2012, 09:16 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,126

Rep: Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985
Quote:
Originally Posted by nerces View Post
The next step is to use a loop device on the backup disk with offset to mount the partition on the system.
It should work but is not working as it should
Mount requires a valid filesystem. If the damaged area includes the first couple of cylinders (likely if the MBR is lost), then you have also lost the beginning of the filesystem for the first partition at least. Hence the inability to mount that. Other partitions may (or may not) loop-mount successfully depending on luck.
 
Old 10-14-2012, 05:01 AM   #5
nerces
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Of course since the beginning of the disk is damaged, there is no hope to recover the first partition wich hosts the system, The system is perfectly standart and is completely separated from my data.

I found at least one partition on the partial copy made by dd and skipping bad cylinders. I'm able to inspect the loop device created with the proper offset with debugfs and to mount it on a linux-3.0.

I modified gpart to prevent it to try to read the MBR what was hanging the process, and start running it on the whole disk skipping the begining. It last quite a while.

I need then just to find out how to prevent my linux-3 or ubuntu to remove the raw device if it is not able to read the MBR when I plug the USB-SATA adapter..
 
Old 10-24-2012, 09:03 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,998
Blog Entries: 54

Rep: Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745
Quote:
Originally Posted by nerces View Post
The disc is recognized with read errors and the raw device /dev/sdb is not created and disapears.
Any stderr, diagnostic output, dmesg and syslog output from the moment you powered up and tried to access the USB enclosure would have been welcome.


Quote:
Originally Posted by nerces View Post
Second attempt on an older system (ubuntu 8.04 and linux 2.6.12). I'am able to copy data from the damaged disk on another 1T disk with dd ddrescue and safecopy. Usualy the copy stops without any message after few dozen of G.
See dd_rescue instead as I explained here?


Quote:
Originally Posted by nerces View Post
Then I use gpart to find the starting points of the partitions.
Instead use 'testdisk' with the "/debug /log" flags and store the log file somewhere safe.


Quote:
Originally Posted by nerces View Post
The next step is to use a loop device on the backup disk with offset to mount the partition on the system.
It should work but is not working as it should
No, the next step should have been ensuring a copy of the disk was made to file and work on that. Besides please don't talk about errors ("is not working") but show them instead (stderr, diagnostic tool output, dmesg, syslog).


Quote:
Originally Posted by nerces View Post
Of course since the beginning of the disk is damaged, there is no hope to recover the first partition wich hosts the system, The system is perfectly standart and is completely separated from my data.
There are several options open to you. For instance testdisk allows you to write a standard MBR and if testdisk can recover partition boundaries after that it may well be able to rewrite the PT as well. I strongly suggest you first make a good copy of the disk or partition though. And if the first partition of the disk only contains the system and the subsequent partitions data to retrieve, why not image only those?
 
Old 10-24-2012, 12:04 PM   #7
nerces
LQ Newbie
 
Registered: Mar 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
As I wrote previously my problem is solved and I got my data back with the following procedure.

Instead of copying all the recoverable sectors from the damaged disk on a new disk:
I modified gpart to prevent it to access the mbr
whith this modified gpart I was able to detect the begining off all my partitions but the first which hosted only a plain system
I used loop devices with offsets to mount the detected file-systems (the mount failed at the begining because some of my file-systems where ext4 and the old system I used did'nt support ext4)
I selectively rsynced the modifications to the original disk (which was copied and expanded to the 1Tb disk)

From all the tests I did, it appears to me that
dd whith conv=noerror,sync skip=xxx seek=xxx is not worse than ddrescue
safecopy is also a usefull tool
testdisk works only on a disk without errors (after a full copy)

Any media error (read error on disk) takes several seconds to recover.
If they were kernel parameters preventing multiple retries and offlining the device with errors, data recovery could be much more effective.

Alex
 
  


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
Recovering deleted files from vfat partition on damaged disk kresho Linux - Hardware 2 10-31-2008 03:06 AM
Help recovering damaged tar.gz file 0x29a Linux - Software 6 10-28-2008 03:28 PM
Help recovering damaged partition matheusleite Linux - Newbie 1 10-10-2007 12:48 PM
Recovering damaged flash drive Avatar33 Linux - Hardware 5 03-12-2005 07:50 AM
Recovering data from damaged CD corn Linux - Hardware 4 09-23-2004 12:32 AM


All times are GMT -5. The time now is 03:56 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration