I accidentally started a backup from /dev/sda3 my root partition that is formatted as ext4 to my backup hard drive dev/sdb2 which was formatted as NTFS. I did this using the dd command:

dd if=dev/sda3 of=/dev/sdb2

When I recognized the mistake I canceled the command, but now when I run lsblk -f it lists the backup hard drive as ext4.

I am also not unable to mount the disk. I receive this error:

mount: /media/HD: wrong fs type, bad option, bad superblock on /dev/sdb2, 
missing codepage or helper program, or other error.

Is there anyway to rescue any of the files on the hard drive that may not have been overwritten?

marked as duplicate by Scott, Mr Shunz, Fabby, Stephen Kitt, Kiwy May 10 at 9:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Try https://www.cgsecurity.org/wiki/TestDisk. There's a good chance it's available on your Linux distro (I checked Ubuntu, Debian, and CentOS). I used it to recover files from a reformatted Windows drive for a friend. (It's mentioned in an answer linked in the quesion's comments, but wasn't the accepted answer for that situation.) You'll need something to write the recovered files to.


You should first backup the current bad partition to some big external disk

dd if=/dev/sdb2 of=/mountpoint/of/bigdisk/backup_of_sdb2.dd

then you can test various techniques to try to recover your former sdb2 content. Use utilities, and revert to the starting point of they failed, using the backed up file.

One way to do a fix manually could be to also dump that db2 content onto a whole empty external drive (to its /dev/sdX, or /dev/sdX1 ?) and then change that partition type to ntfs (with fdisk) and use a windows to try to fix it? (may recover some lost directory structure)...

And lastly... always have backups of important data (on 2 local separate disks, and one remote location as well in case of robbery or fire...). makes those occurence much less painful to deal with.

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