Skip to main content
3 of 3
deleted 9 characters in body
Chris Davies
  • 128.3k
  • 16
  • 179
  • 324

The error is, dd: error reading '/dev/sda': Input/output error, which tells you that the problem is reading the source disk and not writing to the destination. You can replace the destination disk as many times as you like and it won't resolve the issue of reading the source.

Instead of using dd, consider rescuing the data off the disk before it dies completely. Either copy the files using something like rsync or cp, or take an image copy with ddrescue.

ddrescue -v /dev/sda /dev/sdb /some/path/not/on/sda_or_sdb 

The last parameter points to a relatively small temporary file (the map file) that is on neither /dev/sda nor /dev/sdb. It could be on an external USB memory stick if you have nothing else.

The ddrescue command understands that a source disk may be faulty. It reads relatively large blocks at a time until it hits an error, and at that point it marks the section for closer inspection and smaller copy attempts. The map file is used to allow for restarts and continuations in the event that your source disk locks up and the system has to be restarted. It'll do its best to copy everything it can.

Once you've copied the disk, your /dev/sdb will appear to have partitions corresponding only to the original disk's size. You can use fdisk or gparted/parted to fix that up afterwards.

If you had an error copying data you should first use one of the fsck family to check and fix the partitions. For example, e2fsck -f /dev/sdb1.

Chris Davies
  • 128.3k
  • 16
  • 179
  • 324