Here’s how I cloned a drive with bad sectors using ‘dd‘.
Since I did this on a Mac, I saved the output image file as a ‘.img’ file. This would give me the ability to mount the image after I created it if I needed to get individual files.
Clone the failing drive to an image file, skip bad sector errors with ‘noerror’:
- Connect the drive to a Unix / Linux machine – do not mount the disk
- Find the drive name in /dev (for me it was /dev/disk1)
- Verify the host system has enough local storage to create the image, and in a terminal type:
sudo dd conv=noerror,sync if=/dev/disk1 of=disk.img
- Give it time to create the image. You may see errors when it hits bad sectors, but it’ll keep running thanks to ‘noerror’.
Copying from the image file to the new drive:
- Connect the new drive and make sure it isn’t mounted (if it’s really new it shouldn’t have any file system or partitions at all)
- Find the drive name in /dev (for me it was /dev/disk1)
- Type in a terminal:
sudo dd conv=noerror,sync if=disk.img of=/dev/disk1
- Give it time to copy from the image to the new disk.
The nice thing is that it copies everything. For me, the MBR was still there along with all partitions. If you wanted to just copy a single partition you could just be more specific (/dev/disk1s1 or however your system represents them). If the new drive was larger than the original drive, you’ll notice that there will be unallocated space. You can either create a separate partition, or use a utility to grow an existing one. Recent versions of Windows and OS X have this capability built in.
On boot, the machine I was repairing recognized the filesystem was dirty (it was a Windows XP machine / NTFS), and immediately ran a SCANDISK. I also manually ran it again once I booted into the system, and also ran ‘sfc /scannow’ to verify the system files were intact.
That’s all you have to do. No expensive cloning software needed, just the power of Unix / Linux.