Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My hard drive just corrupted again (think it because i didn't eject via Windows because it wouldn't let me, no programs was using files on the drive either).

I've recovered some files but got a lot more to do, but I want to use the portable HDD again.

What can I use to create a image of the entire hard drive to capture its current state before I format it? I want to mount the image to a drive letter then carry on recovering lost data.

share|improve this question

Get a nice livecd for a Linux distro (I like Gentoo) and bring up a shell with root privileges.

Somehow mount the hard disk partition you want to put your backup on. Partition names on Linux are on the form "/dev/sda1", where the 'a' becomes 'b' and 'c' for second and third hard drive and the number increases for additional partitions on the drive. Assuming sda1 and you use NTFS, you should type

mkdir hd ;
ntfs-3g /dev/sda1 hd/ ;

If you use FAT or something else Linux has kernel write support for, exchange ntfs-3g for mount.

To then copy the external drive to a file, you should type the following. I assume the external drive is the second hard drive alltogether, otherwise see (2). Then the name for the whole drive is "/dev/sdb".

dd bs=1M if=/dev/sdb of=hd/external-drive-backup.img ;

That will require a lot of disk space, so you might want to compress it a bit, for example like so in stead:

dd bs=1M if=/dev/sdb | xz -1 | dd of=hd/external-drive-backup.img.xz ;

Now you're done, you have a nice image of your whole external disk on you hard drive. You can then go on to repartition the disk with parted or somesuch and create new filesystems on it.

share|improve this answer
Add a block size (-bs=1M) to the dd to make the command MUCH faster. – Chris Nava Jan 23 '12 at 5:37

As an extra, I've found that if my external drive won't eject because Window says it's using it (which it isn't), if you logout then log back in, the drive will have been ejected. Just for the future

share|improve this answer

Also you can use Clonezilla - an easy to use and freeware suite with simple step-by-step interface to create hdd backups.

share|improve this answer

You must log in to answer this question.

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