While trying to write a OS image to a SD card for my single board computer via the terminal, I ended up accidentally writing the image to one of my 500gb hard drives in my computer instead of the SD card. Originally the drive was NTFS formatted, now it has the contents of the OS image (Two partitions a fat16 that is 80MiB and a ext4 that is 465.66MiB). the command I used was "sudo ./format_sd.sh /dev/sdc" (The script I ran can be found here: https://github.com/avafinger/nanopi-a64-firmware/blob/master/format_sd.sh) I have tried TestDisk but it only recognized the partitions that were accidentally written to it. I'm running Ubuntu Studio 18.04.2 LTS.

Is there any way I can recover most or all of the files?

  • It may help if you tell us how the drive was formatted (ie. what is in the script you ran), and the release (or age) of the Ubuntu you are/were using. A few months ago overwrite a connected (1tb) usb-drive with a dd write of a 19.04 daily ISO (OS image) and I got most if not all my data back; but the method I used I don't recall as was just a reaction to the realization of what I'd done, a walk away whilst I calmed down & then how I'd could fix/reverse it. I don't know how you did it, your release of Ubuntu & only questions come to mind, but I can tell you restoring backups is easiest – guiverc Apr 8 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.