
dd - part of the 'coreutils' package that you probably already have
ddrescue - GNU DDRescue tool; the Debian package is named gddrescue
dd_rescue - DD_Rescue tool, no Debian package at this time, source available at http://www.garloff.de/kurt/linux/ddrescue/
To make an image using 'dd' and ensure you skip possible errors (otherwise the image creation will fail at the first error), run as root (this is one line) :
root# dd if=/dev/sdf of=/home/username/image.img conv=noerror,sync
where 'if' is your input file (actually, a device) and 'of' is your output file (on a mounted hard drive). 'dd' can also clone hard drives but that's for another day.
To make an image using GNU DDRescue:
root# aptitude install gddrescue
root# ddrescue /dev/sdf /home/username/image.img
If your drive has errors, DDRescue will continue past them. However, you can also use DDRescue in reverse in case of a stuck drive head or the like:
root# ddrescue --reverse /dev/sdf /home/username/image.img
Once you have your image created, you have two options. Please read below to figure out which is best for your situation.
If the files aren't missing or deleted or the drive hasn't been erased or lost a partition table, PhotoRec (below) may be overkill. If the drive's contents are still available but the drive is having issues and you wanna grab what you can from the image, making the image first and mounting that as a 'loopback device' may be enough to interact as if it were a real hard drive:
root# mount -o loop /home/username/image.img /mnt/loopimg
This is interacting with the image only and may be the better place to start; if you can't find files here, then consider using PhotoRec.
If the files were erased or the partition table or file allocation table was lost or the drive crashed, you can use the TestDisk tool named 'PhotoRec' to scan the drive image for various file formats:
root# aptitude install testdisk
user$ photorec /home/username/image.img
More about PhotoRec available on the website, including a tutorial.