If you suspect your hard drive is dying (unusually large amounts of disk thrashing, long access times, frequent file corruption, refuses to boot), and you have a spare disk, it's not hard to clone the disk. It will be easier to recover data from the clone, since continued use of the bad disk can make things worse.
- If the disk is your boot disk, move it to another computer. Otherwise, be sure to unmount it first.
- Determine what device and partition the disk appears on, perhaps using mount or fdisk.
- Use ddrescue to make an image of the disk:
$ ddrescue /dev/sdb1 IMAGEFILE LOGFILEwhere sdb1 is the node for your source disk. ddrescue is like dd (which writes a copy of all the disk's raw data to a file), but works better for damaged disks: it fills in zeros for parts of the disk it can't read; you can run ddrescue as many times as you want, and if you provide the same LOGFILE it will attempt to fill in the gaps in the image that it didn't get before.
- Write the image to a new disk:
$ dd if=IMAGEFILE of=/dev/sdc1where sdc1 is the node for your target disk.
- Mount the filesystem and run fsck or an equivalent. For NTFS volumes, moving the drive to a Windows computer and running chkdsk /F works wonders.