LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 06-22-2009, 05:00 AM   #1
bmcws
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Rep: Reputation: 0
Question cp of dd image failed, better to mount image and then copy?


Hello,

I'm trying to copy a _large_ disk image file (made by dd - about 230GB) from an external USB disk to an internal disk. The cp (and nautilus copy and paste) fails with dmesg errors:

Code:
sd 5:0:0:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 5:0:0:0: [sdb] Sense Key : Medium Error [current] 
sd 5:0:0:0: [sdb] Add. Sense: Unrecovered read error
end_request: I/O error, dev sdb, sector 646375991
Buffer I/O error on device sdb1, logical block 80796991
Buffer I/O error on device sdb1, logical block 80796992
Buffer I/O error on device sdb1, logical block 80796993
Buffer I/O error on device sdb1, logical block 80796994
Buffer I/O error on device sdb1, logical block 80796995
Buffer I/O error on device sdb1, logical block 80796996
Buffer I/O error on device sdb1, logical block 80796997
Buffer I/O error on device sdb1, logical block 80796998
Buffer I/O error on device sdb1, logical block 80796999
Buffer I/O error on device sdb1, logical block 80797000
__ratelimit: 20 callbacks suppressed
npviewer.bin[18191]: segfault at ff9bea2c ip 00000000ff9bea2c sp 00000000ffd66d0c error 14
npviewer.bin[2304]: segfault at ff9bea2c ip 00000000ff9bea2c sp 00000000ff88c83c error 14
sd 5:0:0:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 5:0:0:0: [sdb] Sense Key : Medium Error [current] 
sd 5:0:0:0: [sdb] Add. Sense: Unrecovered read error
end_request: I/O error, dev sdb, sector 646376143
Buffer I/O error on device sdb1, logical block 80797010
sd 5:0:0:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 5:0:0:0: [sdb] Sense Key : Medium Error [current] 
sd 5:0:0:0: [sdb] Add. Sense: Unrecovered read error
end_request: I/O error, dev sdb, sector 646376143
Buffer I/O error on device sdb1, logical block 80797010
sd 5:0:0:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 5:0:0:0: [sdb] Sense Key : Medium Error [current] 
sd 5:0:0:0: [sdb] Add. Sense: Unrecovered read error
end_request: I/O error, dev sdb, sector 646376143
Buffer I/O error on device sdb1, logical block 80797010
sd 5:0:0:0: [sdb] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
sd 5:0:0:0: [sdb] Sense Key : Medium Error [current] 
sd 5:0:0:0: [sdb] Add. Sense: Unrecovered read error
end_request: I/O error, dev sdb, sector 646376143
Buffer I/O error on device sdb1, logical block 80797010
What's the best way of recovering the data or as much data as possible (and find out which files are effected on the imaged disk)?

1. Would dd do any better at copying the file without errors?
2. Would mounting the image, then copying the files (using cp) on the mounted image copy all files in 'good' areas of the disk - and let me know which files did not copy properly; or would it just stop when it comes to the first error?
3. Any other ideas?

Help would be very much appreciated!

Thanks,

Bernard
 
Old 06-22-2009, 06:38 AM   #2
jsteel
Member
 
Registered: Mar 2007
Location: England
Distribution: Arch
Posts: 392

Rep: Reputation: 34
I don't think dd is what you want here. If you leave it copying (even if it is throwing up errors) does at least some data get copied across? If so I would call this the "good data", and everything else is corrupt in some way.
 
Old 06-22-2009, 06:45 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,944
Blog Entries: 54

Rep: Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731
Quote:
Originally Posted by bmcws View Post
The cp (and nautilus copy and paste) fails
Why would "nautilus copy and paste" behave different or more tolerant/resilient?


Quote:
Originally Posted by bmcws View Post
Code:
        end_request: I/O error, dev sdb, sector 646375991

        end_request: I/O error, dev sdb, sector 646376143
        end_request: I/O error, dev sdb, sector 646376143
        end_request: I/O error, dev sdb, sector 646376143
        end_request: I/O error, dev sdb, sector 646376143

Buffer I/O error on device sdb1, logical block 80796991
Buffer I/O error on device sdb1, logical block 80796992
Buffer I/O error on device sdb1, logical block 80796993
Buffer I/O error on device sdb1, logical block 80796994
Buffer I/O error on device sdb1, logical block 80796995
Buffer I/O error on device sdb1, logical block 80796996
Buffer I/O error on device sdb1, logical block 80796997
Buffer I/O error on device sdb1, logical block 80796998
Buffer I/O error on device sdb1, logical block 80796999
Buffer I/O error on device sdb1, logical block 80797000

Buffer I/O error on device sdb1, logical block 80797010
Buffer I/O error on device sdb1, logical block 80797010
Buffer I/O error on device sdb1, logical block 80797010
Buffer I/O error on device sdb1, logical block 80797010

Quote:
Originally Posted by bmcws View Post
What's the best way of recovering the data or as much data as possible (and find out which files are effected on the imaged disk)?
If your priority is to find out which files are effected then you could dry-run a fsck on the partition and see what gives. But modifying the disks contents in any way or wasting time while the drive is near end-of-life diminishes your chances of recovery. So if your priority is to get the 'dd' image off the removable then go save that data and leave the "find out" part for when time is a luxury.


Quote:
Originally Posted by bmcws View Post
1. Would dd do any better at copying the file without errors?
Yes if the error is software-based. No if the error is hardware-based. Luckily there are versions of 'dd' that can retry on error, read from back to front, resume operations and such like dd_rescue, dcfldd or ddrescue. It's not a Holy Grail in that it will automagically save everything but it will likely save way more compared to 'cp'.


Quote:
Originally Posted by bmcws View Post
2. Would mounting the image, then copying the files (using cp) on the mounted image copy all files in 'good' areas of the disk - and let me know which files did not copy properly; or would it just stop when it comes to the first error?
Prolly error out. If it's an IDE in a case and you loopmount the image then you stack looks like this: HD > usb_storage speaking SCSI > kernel speaking VFS for mounted filesystem > kernel providing loopmount for image > kernel speaking VFS for loopmounted filesystem. Anything that interpretes (VFS) a filesystem has software-based tolerance up to some point. Anything that "speaks" directly to the disk can have tolerances that go beyond the capabilities of VFS. If the problem is hardware-based or the image is way important you want to minimise risk, aim for HD > usb_storage speaking SCSI and dd_rescue the HD to an image somewhere safe.

Last edited by unSpawn; 06-22-2009 at 06:47 AM.
 
Old 06-23-2009, 04:44 AM   #4
bmcws
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jsteel View Post
I don't think dd is what you want here. If you leave it copying (even if it is throwing up errors) does at least some data get copied across? If so I would call this the "good data", and everything else is corrupt in some way.
The copy did actually copy across some data: about 90 percent of it... ddrescue seemed to do a better job of it... More details in my next post...
 
Old 06-23-2009, 05:43 AM   #5
bmcws
LQ Newbie
 
Registered: Jun 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Why would "nautilus copy and paste" behave different or more tolerant/resilient?
No idea, just gave it a try: strangely, the copy and paste copied exactly same amount of data as a normal dd (about 90%), but the cp did only about half of the data.

Quote:
... hardware-based or the image is way important you want to minimise risk, aim for HD > usb_storage speaking SCSI and dd_rescue the HD to an image somewhere safe.
I ddrescue'd the file and there was only 2 errors/8192 B of errors. How do I find out where the errors are? Stupidly, I didn't specify a logfile: does ddrescue have a log somewhere else? I have block and sector numbers from dmesg, but how do I go about finding out which files, if any, are effected on the disk image?
 
Old 06-23-2009, 06:41 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,944
Blog Entries: 54

Rep: Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731
Quote:
Originally Posted by bmcws View Post
How do I find out where the errors are? (..) I have block and sector numbers from dmesg, but how do I go about finding out which files, if any, are effected on the disk image?
The location in bytes is logical sector * blocksize. For harddisks that's usually 512 bytes. Looking at the logical block numbers you have posted that would mean the errors start at `echo "80797010*512"|bc -l` bytes with a length of `echo "(80797010*512)-(80796991*512)"|bc -l`. Note dd_rescue supports "-s" so to verify (and obtain logging) you could start again using an offset a few logical blocks before 80796991 and a few past 80797010 on the original and the most recent disk image. Comparing output should show the imaged disk having zeroes where the original is b0rken. To see if the integrity of the image file that resides on this image file (of your external USB disk) is intact would be to loopmount this image file's partition, hash the image it contains, then hash the original disk. To pinpoint b0rkage, make it easier and more efficient you could use 'sha1sum' which provides "piecewise" mode. This means you could hash either the most recent disk image or the original harddisk (you know, the one you dd'ed the image file from onto your external USB disk of which you made an image file ;-p) and check it against the other.
 
  


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
How can I copy image from website? linmix Fedora 8 06-15-2005 12:01 AM
HardDrive to HD image copy gerrymatbeacon Linux - Newbie 1 08-13-2004 03:18 PM
How to Copy Kernel Image to a CD? Lucinda Slackware 9 05-26-2004 03:07 AM
floppy disk - image copy towlie Slackware 5 04-21-2004 05:33 PM
Image Copy vickna Linux - Newbie 4 04-22-2003 03:32 PM


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