Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm an Italian Windows programmer. I know almost nothing of Linux, so please be patient if the question is dumb and pardon my bad english.

I need to clone a NTFS partition from a damaged, near to die hard disk (SCSI, if this matters) to a new one (SATA).

I've installed the last version of Hiren's Boot CD utilities on a USB stick, and tried with GParted, which told me that it can't copy/paste the partition because it's damaged and "flagged" by windows to run CHKDSK. I followed the Warning advice and tried to repair it using CHKDSK /f (it took 9 hours and exited with an error after "phase 3") and a Linux program I can't recall right now, without success.

I tried to clone using Clonezilla, and it failed as well, for the same reasons. In the HBCD there's dd_rescue, but it failed again because it can't find "ntfs.something".

In the end, all that I want is to clone that partition as it is, with his errors and everything. I can repair it on the new drive.

So, what should I do?

share|improve this question
    
What was the error message returned by CHKDSK /f after "phase 3"? –  paraxor Jun 22 '13 at 18:19

3 Answers 3

An alternative to ddrescue is regular dd using conv=noerror,sync options.

dd if=/dev/olddisk of=/dev/newdisk bs=4k conv=noerror,sync

If it hits an error, it will skip the block (4k in case of 4k blocksize as in this example), and it will write binary zeroes on the target. So errornous regions of the old disk will be zeroed out on the new disk.

A larger blocksize like bs=1M may speed the process up considerably as many HDDs react badly to and slow down on read errors; on the other hand it could mean a 1M hole in the copy even if there was only a single bad 4k sector. This is okay for large consecutive bad areas, not so great for isolated bad sectors.

Unfortunately dd does not tell you exactly where the errors were in this copy process. There is also no direct way to retry reading defective zones (although personally, I did not yet have a case of defective disk where such retries would have helped any).

share|improve this answer
    
Why is the conv=sync option useful in this case? I looked at man dd, but it's very cryptic. –  landroni Jan 27 at 16:52
1  
@landroni: sync writes zeroes in place of bad blocks so source and target data will be written to the same offsets. without sync, the copy is corrupt starting from the first bad block encountered on the source disk. –  frostschutz Jan 27 at 17:50
    
After reading the gddrescue docs, I come to believing that ddrescue has a superior strategy in trying to deal with bad sectors. The dd approach is probably fine in case of some bad sectors, but less so for very problematic hard-drives. –  landroni Feb 2 at 19:21

You can of course try to repair the NTFS partition on the original drive, but I cannot recommend to do so, as the problems might be caused by hardware failure and repairing could make things worst.

Make a block for block copy with ddrescue to a file first. If there are any block that cannot be copied ddrescue will continue with the rest of the disc.

If ddrescue doesn't find any bad blocks then you can try to use repair software on the file (mounted via loopback). If there are problems with the SCSI drive or you just want to be sure to be able to start over from scratch, make a copy of your file and try to repair the NTFS filesystem on the second copy. As copying a disk with errors can be time consuming process, you might have to interrupt the process (because you need the computer, to let the drive cool down, or to restart the firmware of the drive).

That is why in my experience ddrescue is far superior in problematic cases than is dd with conv=noerror. ddrescue keeps a log about what it has done and restarts based on that information, a feature unavailable to dd. ddrescue is also smarter in reading blocks starting from the end, if it encounters a problem area. It will arrive much quicker at an image copy state that you can use as the basis for a filesystem check (and you can continue to ddrescue the original copy). You can only do something like that with dd if you are willing to spent a lot of time calculating offsets by hand.

You can also copy the file to a NTFS partition of the right size, put the drive in a windows machine and use the native repair tools from there.

share|improve this answer
1  
Very useful! Could you add an exact command-line example of ddrescue in action, similar to the dd example in the other answer? –  landroni Jan 27 at 10:43
1  
@landroni I could (basically ddrescue /dev/sdX driveimage logfile) but you really should spent the effort on reading ddrescue documentation. If your system is broken, there are a lot of reasons to read the manual before potentially making things worse. –  Anthon Jan 27 at 12:29
    
I am now looking at the man page, but some of the options are cryptic. What would be the most conservative ddrescue equivalent of dd if=/dev/olddisk of=/dev/newdisk bs=4k conv=noerror,sync? Keeping in mind that it would be run on a damaged (and dying) disk, and that "trying hard to rescue data in case of read errors" isn't really an option. Thanks! –  landroni Jan 27 at 16:44
    
@landroni with the options given in my previous comment each sector in a block is only tried once. The only way I know of that you can improve on that is if you know which areas are OK for sure and use -i and -s to recover those. –  Anthon Jan 27 at 17:06
    
Well, last time I tried ddrescue /dev/sr0 driveimage.iso (on a scratched CD), the programme tried to read again a lot of bad sectors, a lot of times. I may be wrong, but I would be skittish about running ddrescue with no other limiting options on a dying disk. –  landroni Jan 27 at 17:21

I would attempt to repair the disk with either HDAT (freeware) or possibly Spinrite (Commercial). I've used both of these tools to recover disks that were failing and they have both worked well in the past.

Until the drive is in a usable state I don't anticipate you getting too far in your recovery efforts. Once the disk has been cleared I'd use Clonezilla to replicate it as quickly as you can to an alternate HDD.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.