3

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?

HorizonBloom
  • 81
  • 1
  • 6

1 Answers1

2

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'

sudodus
  • 46,324
  • 5
  • 88
  • 152
  • As it is a good idea to recover data form a clone of a broken drive it may be a bit overkill if the drive is healthy. Cloning takes horribly long. – Takkat Jun 29 '18 at 14:03
  • The drive is healthy and is running ubuntu perfectly well but a problem occurred where when using Photorec to recover previous data, the reading got stuck in a range and didn't skip nor move on but just keeps on reading the same sectors repeatedly, any solution? – HorizonBloom Jun 29 '18 at 14:14
  • @Takkat, Cloning takes a long time, yes, but if the data are very valuable, I still think it is a good idea to do it from a cloned copy for safety reasons. – sudodus Jun 29 '18 at 16:04
  • @Ashton, Is PhotoRec stuck on the damaged drive itself, or on a cloned copy (a drive), or on a cloned image file? Have you checked if there are bad sectors, that are difficult/impossible to read? -- ddrescue is the best tool I know for reading sectors (bad blocks) that are difficult to read, but some sectors are impossible also for ddrescue. – sudodus Jun 29 '18 at 16:08
  • I haven't made a clone copy image file as it's a 1tb HDD, I keep getting stuck in the same sectors range every time I run photorec, I think the bad sector is in the disk itself, and think that Ubuntu has overwritten those sectors with new data and may be why it repeats the reading? Idrk. How would I skip the sector to read the rest of the sectors and forget the bad sector? I'm not too worried on recovering every dat, just as much as possible as I still have 700gb left to recover – HorizonBloom Jun 29 '18 at 17:01
  • @Ashton, 1. Cloning with ddrescue can help you with that (and really save as much as possible); 2. But if you think that it is overkill, and want to skip the cloning, and you have an ext4 file system, you can use the command sudo e2fsck -cfk /dev/sdxn where x is the drive letter and n is the partition number. The partition should not be mounted. That command will mark the bad sectors, so that reading tools will avoid them. – sudodus Jun 29 '18 at 17:09
  • How do you know what n is.. I may try ddrescue but do you know how to mount the image after creating it? Will using the image skip the bad sectors using Photorec to recover data from the image? – HorizonBloom Jun 29 '18 at 17:44
  • Run the following commands and edit the original question to add the result. Indent each line 4 spaces to render it as 'code'. sudo lsblk -f and sudo lsblk -m and sudo parted -ls and df Then you can get help to identify the partition(s) where you have (had) your data. If there are no useful partitions, I think cloning with ddrescue might be the best alternative. You might also check the S.M.A.R.T. information according to this link. – sudodus Jun 29 '18 at 20:05