LinuxQuestions.org
Help answer threads with 0 replies.
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 01-10-2010, 04:18 PM   #1
vatachino
LQ Newbie
 
Registered: Jan 2010
Posts: 8

Rep: Reputation: 0
Help recovering data from ext3 partition with hardware errors


I have an external 3.5" USB 250Gb HDD which is showing symptoms of hardware problems (repeated /var/log/messages errors of "reset high speed USB device using ehci_hcd"). This was originally plugged in to my NSLU2 running Debian Etch. I have just installed Ubuntu Desktop 9.10 to a spare Pentium-3M laptop and was hoping to copy the contents of this HDD to a fresh drive. However, I cannot mount it even read-only; mount -o ro /dev/sde3 /mnt/disk fails, and the /var/log/messages error is "recovery required on readonly filesystem", "write access unavailable, cannot proceed". I cannot understand why mounting a disk read-only should require write access. Following advice I googled elsewhere, I tried running mke2fs -n /dev/sde3 to try to list the alternative superblocks - but once again I got the error that the device was read-only.

How can I go about accessing the data on this disk?

Thanks in advance for your assistance.

Nick
 
Old 01-10-2010, 04:46 PM   #2
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 672

Rep: Reputation: 94
use dd to copy the disk image, then try to work on it

dd if=/dev/$DISK of=$HOME/diskimage

if you get read errors , dd can ignore them, keep reading the rest.
 
Old 01-10-2010, 05:05 PM   #3
vatachino
LQ Newbie
 
Registered: Jan 2010
Posts: 8

Original Poster
Rep: Reputation: 0
dd if=/dev/sde3 of=/new_backup/diskimage

terminated after 23Mb, which is not good for a 250Gb partition which was very nearly full.

I'm trying again with conv=noerror at the end.

Considering the read errors I'm getting, how do I go about mounting the disk image as a usable filesystem?
 
Old 01-10-2010, 05:13 PM   #4
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 672

Rep: Reputation: 94
Quote:
Originally Posted by vatachino View Post
dd if=/dev/sde3 of=/new_backup/diskimage

terminated after 23Mb, which is not good for a 250Gb partition which was very nearly full.

I'm trying again with conv=noerror at the end.

Considering the read errors I'm getting, how do I go about mounting the disk image as a usable filesystem?
using loopback. as long as read errors are not on the some important block (like superblock). it should mount
 
Old 01-10-2010, 05:27 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,839

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
Quote:
Originally Posted by vatachino View Post
However, I cannot mount it even read-only; mount -o ro /dev/sde3 /mnt/disk fails, and the /var/log/messages error is "recovery required on readonly filesystem", "write access unavailable, cannot proceed". I cannot understand why mounting a disk read-only should require write access.
Because ext3 is a journalling f/s, and you have a dirty journal. Without the journal committed you have (potentially) files that have been updated, but the updates haven't actually been written back to the file. I'd suggest you mount it for update - after it (hopefully successfully) runs the journal, remount as ro.
 
Old 01-10-2010, 05:28 PM   #6
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 672

Rep: Reputation: 94
Quote:
Originally Posted by syg00 View Post
Because ext3 is a journalling f/s, and you have a dirty journal. Without the journal committed you have (potentially) files that have been updated, but the updates haven't actually been written back to the file. I'd suggest you mount it for update - after it (hopefully successfully) runs the journal, remount as ro.
and don't forget to finish the dd, and work on the disk image. this is unix, it makes no difference.
 
Old 01-10-2010, 05:43 PM   #7
vatachino
LQ Newbie
 
Registered: Jan 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
Because ext3 is a journalling f/s, and you have a dirty journal. Without the journal committed you have (potentially) files that have been updated, but the updates haven't actually been written back to the file. I'd suggest you mount it for update - after it (hopefully successfully) runs the journal, remount as ro.
Thanks for the suggestion, but mounting it read-only actually tries to open it read-write to replay the journal anyway - and my hardware errors mean that journal replay is not possible. I initially tried to mount it read-write but that failed, so I thought mounting it read-only should allow me to get the data off because that would mean the system wouldn't need to write to the physical disk.

I still think it is logically nonsense for a read-only mount option to require write access to the disk! Why can't it replay it in RAM so the actual disk isn't touched? I can easily add a terabyte of swap space if necessary. Seems like bad design to me.
 
Old 01-10-2010, 05:46 PM   #8
vatachino
LQ Newbie
 
Registered: Jan 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ozanbaba View Post
and don't forget to finish the dd, and work on the disk image. this is unix, it makes no difference.
Thanks for the help. It looks like the dd is going to take at least 12 hours at the current rate of progress. Before this thread goes cold - won't mounting the dd image as a read-only loopback device have the same problems about being unable to replay the journal as I do on the real file system? How do I go about avoiding that?
 
Old 01-10-2010, 06:02 PM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
Quote:
Originally Posted by vatachino View Post
I still think it is logically nonsense for a read-only mount option to require write access to the disk! (..) Seems like bad design to me.
I can see you're getting frustrated with things but that kind of comment won't do you or anyone else any good.


Quote:
Originally Posted by vatachino View Post
won't mounting the dd image as a read-only loopback device have the same problems about being unable to replay the journal as I do on the real file system?
Yes.


Quote:
Originally Posted by vatachino View Post
How do I go about avoiding that?
You don't. Make a copy of your disk image, loopmount the file, let kpartx figure out the partitions then run a dry run verbose fsck, then fsck. Fsck will replay the journal but may dump files in lost+found. Relocation makes it slightly harder to retrieve data from unallocated space but it's a trade-off. (An alternative could be to convert your dd image to a vmdk, add the disk to a VMware guest, snapshot it and make it non-persistent. This way you can run a fsck on bootup, grab files, and still have your image copy unaltered.) BTW there's tools like 'ddrescue' and dd_rescue' that may perform faster when facing disk errors.

Last edited by unSpawn; 01-10-2010 at 06:08 PM. Reason: //More *is* more.
 
Old 01-10-2010, 07:56 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,839

Rep: Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822Reputation: 1822
Quote:
Originally Posted by vatachino View Post
Thanks for the suggestion, but mounting it read-only actually tries to open it read-write to replay the journal anyway
Yes that is what I recall from my testing. As you hadn't mentioned it I presumed things may have changed since then.
Quote:
I still think it is logically nonsense for a read-only mount option to require write access to the disk! Why can't it replay it in RAM so the actual disk isn't touched? I can easily add a terabyte of swap space if necessary. Seems like bad design to me.
I've had this discussion elsewhere. I assume Ted is of the opinion that he won't hand over a non-verified filesystem to userspace. Seems reasonable to me.
As for doing it in RAM - how you going to do that if block device driver can't read the disk in the first place ?.
Quote:
BTW there's tools like 'ddrescue' and dd_rescue' that may perform faster when facing disk errors.
Much better option - may not be faster, but deal with errors sanely. Which can't be said of "dd".
 
Old 01-11-2010, 11:14 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
Quote:
Originally Posted by syg00 View Post
may not be faster
By "faster" I mean that by using 'dd_rescue' you're not forced to use a small block size by default as it figures out the largest block size to use itself and only uses a small block size when dealing with errors.
 
Old 01-11-2010, 10:28 PM   #12
itsbrad212
Member
 
Registered: Nov 2009
Location: Chicago
Distribution: Arch and OpenBSD
Posts: 104

Rep: Reputation: 19
Removed
 
  


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 data from lost+found directory on ext3 fs kayasaman Linux - General 4 07-31-2009 02:55 PM
Recovering a deleted and formatted over ext3 partition? Soniku Linux - General 4 04-02-2007 08:12 PM
Recovering data from an ext3 fs with no superblocks UncleTaz Linux - General 2 03-07-2004 02:22 PM
Recovering Data From A Freshly Reformatted Ext3 Partition johnleemk Linux - Hardware 1 02-04-2004 02:48 AM
recovering data from ext3 chupacabra Linux - General 2 10-21-2002 11:32 AM


All times are GMT -5. The time now is 12:22 PM.

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