11

Yesterday I installed Ubuntu on my laptop, and due to my bad luck, I accidentally deleted the partition. The data on the disk was very important to me. I tried TestDisk to recover partition but that didn't work for me.

Someone suggested to try software on Windows. But if I install Windows on my laptop then it will overwrite the data, so I'm planning to clone the hard drive by using the 'dd' commands and use that external hard drive to recover data on Windows.

Will it work ?

Jonas Czech
  • 4,017
Danizen
  • 121
  • Did you only delete the partition or also overwrite it (eg. creating a new partition there)? If the former, it should be relatively easy to create a new partition at exactly the same boundaries, and not having overwritten the contents, all the data would be there. – Ángel Jun 29 '16 at 21:42
  • 1
    Actually while installing ubuntu, I chose the 2nd option ( replace windows with Ubuntu). Their was a warning also that it will delete all images and videos but I thought it would only format the drive in which windows is installed. But Ubuntu formated the data and made a single partition. – Danizen Jun 30 '16 at 00:35
  • If you are trying to do data recovery, generally you won't do that with Windows. Since you said you formatted the computer while installing Ubuntu, I assume you pruned Windows. Therefore you should have a look at NTFS recovery. See http://askubuntu.com/a/776317/271 for instructions or http://softwarerecs.stackexchange.com/a/31377/19806 for more guidance and comparison of several tools. – Andrea Lazzarotto Jun 30 '16 at 10:34
  • Regarding your question about dd, see also: http://superuser.com/a/1076597/278831 – Andrea Lazzarotto Jun 30 '16 at 10:35
  • Can you confirm weather this dd command is correct or not.. "sudo dd if=/dev/sda1 of=/dev/sdb1" (I want to clone sda1 on sdb)...as in this link http://softwarerecs.stackexchange.com/questions/7424/raw-copy-from-failed-hard-disk/31377#31377 command are different for cloning. – Danizen Jun 30 '16 at 16:16
  • IF the first partition of the disk sdb is the one you want to get rid of, yes. Additionally, I would add a big value in bs=, so that it runs more efficiently (ie. quicker) – Ángel Jul 01 '16 at 00:03

1 Answers1

15

Yes, dd clones every bit on the drive, including deleted files and free space.

You could also look into CloneZilla, which is a user-friendly LiveCD for cloning and restoring disks, though I'm not sure its disk-image format would be compatible with your Windows software. http://clonezilla.org/

  • 6
    Note that Clonezilla will not clone free space (deleted files). And indeed - Clonezilla images can only be restored with Clonezilla, and aren't compatible with anything else. Also note that images of Ext4 partitions (whatever way they were made) are not compatible with most Windows file recovery apps. – Jonas Czech Jun 29 '16 at 20:13
  • 2
    @JonasCz Clonezilla does allow you to use dd to clone drives, which would in turn clone the deleted files. However, by default Clonezilla does what you state, which is to not clone the free space. – chue x Jun 30 '16 at 00:18
  • So should I go for clonezilla or just do it with terminal ? – Danizen Jun 30 '16 at 01:17
  • Either way should work; if you're comfortable using dd it might be simpler. However, before you do any of this, you might want to check if the Windows disk recovery software supports ext3/ext4 filesystems – Nick Weinberg Jun 30 '16 at 01:22
  • Can you suggest any windows recovery software ? – Danizen Jun 30 '16 at 02:51
  • I don't know anything about any Windows recovery software beyond what I could google. Maybe someone else has ideas, but if testdisk couldn't help, I'm afraid your chances are not great... there are professional data-recovery services, but the good ones are quite expensive – Nick Weinberg Jun 30 '16 at 03:00
  • Through testdisk, i only tried to recover partition. Is there anything more I can give a try ? – Danizen Jun 30 '16 at 03:10
  • And the software about which I was talking only supports NTFS and FAT. – Danizen Jun 30 '16 at 03:23
  • @Danizen There are other tools, such as Photorec (Runs on Linux), and others, see this: How to recover deleted files? There's also DiskInternals Linux Recovery, not free though. – Jonas Czech Jun 30 '16 at 07:56
  • @Danizen Also check http://www.r-tt.com/free_linux_recovery/ – Jonas Czech Jun 30 '16 at 08:02
  • @NickWeinberg OP said he formatted Windows trying to install Ubuntu. I don't think the suggestion to look for EXT recovery software is the best one, he should probably look for NTFS recovery. – Andrea Lazzarotto Jun 30 '16 at 10:32
  • @Danizen may I ask you why you insist in doing the recovery with Windows? Not only it is off-topic here, it won't necessarily make things easier at all. :P – Andrea Lazzarotto Jun 30 '16 at 10:38
  • Actually I'm not so familiar with Ubuntu. And @JonasCz I tried photorec. It recovered some of my data but not the one I was looking for. – Danizen Jun 30 '16 at 15:56