How to recover from wiping by dd a partition table on external disk?

Yesterday I used dd to write an OS into my Raspberry Pi flash card. Even though all my commands ( I checked history ) were for /dev/sdd which was the flash , when I checked my external drive(500GB) there were only 2 partitions there, one of 3 GB and one of 15MB instead of all my precious data.

Is there any way to recover from that ? Cause, theoretically my data is still there. Or shall I just start crying ?

This is the command I ran:

sudo dd bs=4M if=~/Downloads/RetroPieImage_ver1.2.1.img of=/dev/sdd

With that dd command you have lost some data.

You can try to recover data using testdisk and/or photorec

sudo apt-get install testdisk

photorec is part of the testdisk package

Here is a step by step tutorial

See also: https://help.ubuntu.com/community/DataRecovery