2

I recently wiped my hard disk with a fresh Ubuntu installation. I'm planning to use Testdisk to recover the files.

However, since I do not have prior experience, I feel it would be safer if I could keep an image of the hard drive as well. That way, I can work on the image to avoid wrecking the original drive even more.

I have two questions:

1) Could you suggest a tool for the same?

2) Since I need the image for recovery, I don't want to overwrite the hard disk anymore than it already has been. Hence, could you comment if the tool would affect the hard drive in any way (if it is run via a usb)?

1

2 Answers 2

7

You need to have some things prepared first:

  • your original hard-drive from where you will read all the bits (you have this one, obviously);
  • a separate hard-drive where you will write the backup - this one needs to be already partitioned & formatted and must have ENOUGH free space to host your backup file (if your original hard-drive has 80 GB, you must have at least 80 GB free on a partition of the backup hard-drive to create the backup);
  • a Linux LiveCD/LiveDVD/LiveUSB to boot from - it must have the "dd" utility. I guess using the CD/DVD/USB you already used to install Ubuntu should be ok.

Steps:

1) make sure both hard-drives are connected to the computer you will be using;

2) boot from the LiveCD/LiveDVD/LiveUSB and check what drive is what - let's say from now on that original drive is sda and backup drive is sdb. Let's also say the backup drive has only 1 partition, sdb1.

3) make sure nothing from sda is mounted;

4) make sure the backup partition (/dev/sdb1) is mounted (let's say to /media/sdb1);

5) you need to run from a terminal the "dd" command like this (it means: "copy bit-by-bit the whole sda hard-drive to file backup.img in /media/sdb1 using a block-size of 1 MB"):

dd if=/dev/sda of=/media/sdb1/backup.img bs=1M

Please know that, depending on your original drive size, step 5) will take less or more (or a lot of) time.

Good luck and let us know what happens!

Note: you can always restore from the backup file by using:

dd if=/media/sdb1/backup.img of=/dev/sda bs=1M

Again, please make sure to check what drive is what - sdb is the backup drive, sda is the drive where the backup will be restored.

2
  • Thanks a lot for the detailed instructions! I have a quick question - does the block size matter while using dd keeping in mind that I have a 2TB hdd? I'll copy the disk and attempt recovery using photorec tomorrow and post the results here. (Fingers crossed) Jun 26, 2013 at 21:16
  • Yes, the block size matters, but unfortunately there is only one way to determine the optimal block size, and that's a benchmark (with various block sizes and choosing the value that gives the best times) on the specific system/drive combination. Various opinions say the value should be definitely a power of 2. For modern hard drives, my guess is it should be multiple of 1 MB (but no more than the hard drive cache, I think).
    – Fane
    Jun 27, 2013 at 9:03
1

I heard dd can do it: link -- but I never used it

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .