Corrupted hard drive. Want to format it, but want to copy a image (of the corrupted) as a backup

3

1

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.

klj613

Posted 2012-01-23T01:10:24.793

Reputation: 549

Answers

6

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.

Eroen

Posted 2012-01-23T01:10:24.793

Reputation: 5 615

1Add a block size (-bs=1M) to the dd to make the command MUCH faster. – Chris Nava – 2012-01-23T05:37:50.733

0

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

matthew

Posted 2012-01-23T01:10:24.793

Reputation: 1

0

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

Anton

Posted 2012-01-23T01:10:24.793

Reputation: 100