I mistakely installed ubuntu over my 1tb drive removing essential data and photos which took about 5 mins to install, so I want to know if I can use ddrescue in Ubuntu to create a virtual image of the drive to and then use TestDisk/Photorec to recover lost data? Or is it more recommended to use testdisk straight on the HDD drive?
Recover from a cloned copy or image
Yes, it is a good idea to make a cloned copy or an image with
ddrescue
and do the recovery job on the cloned copy. It reduces the risk, that the recovery attempts will damage what is still possible to recover on the drive.Links
Accidentally did dd /dev/sda - See also the other answers.
Repair the partition table and file system of a pendrive - scroll down to find 'Advanced repair of a partition table, file system and/or recovery of files'