2

I would like to run a Linux installation on my Mac from a pen drive in order to create an emergency backup of my most important files.

I do not know whether my hard drive is physically broken or just full of corrupted files.

Are there any tricks or (freely available) tools for Linux which can restore broken files from a hard drive, so that I can back them up?

Constantin
  • 201
  • 2
  • 4

1 Answers1

2

First off, you probably want to make sure the you don't have the click of death. This is repeated clicking/knocking noises which indicate a head crash on you hard disk (or some other catastrophic failure). If you have this, you may want to consider taking the drive to a specialist depending on how important the data is. You can try Recovering data from a damaged hard-drive: the "freezer trick", but at some risk.

As for tools that you can use, Arch has a great wiki on this. Not all of the tools will work with HFS+ though (I'm assuming that is the filesystem you have). To summarise and add some extra:

  1. You probably want to start with a tool like ddrescue or dd_rescue. You could try them first by mounting your drive read only and then using them on particular files you want to recover. Alternatively, it may be safer to make a copy of the full disk. If there are bad blocks, these tools will use progressively smaller reads to get as much of the data as possible and also retry the affected area a number of times. Last time I used them the GNU offering (ddrescue) was the more advanced of the two. There is also myrescue which is currently beta software, but focusses on non-damaged areas first unlike the first two.
  2. If you have a corrupted filesystem you can install hfsprogs and use fsck.hfsplus to try to look for damage and repair it. It may be wise to make a full backup of the filesystem before attempting any repairs though as this may do more damage. If there are no issues with bad sectors, just use dd to make the copy.
  3. Depending on the types of files you want to recover, you can look at tools like Foremost, PhotoRec and Magic Rescue. These scan the disk surface and look for data relating to particular file types before trying to restore the file.

Another question which may be relevant here is How to repair a corrupted HFS+ partition from a damaged hard-disk?.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
Graeme
  • 34,027
  • 1
    definitely get a copy of the disk and work on images of it from there on out. The fewer seeks/accesses the better. – mikeserv Dec 29 '14 at 22:54