Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I accidentally killed my MacBook by water damage, and now I'm to primarly extract my images.

I mounted the drive (HFS+ formated) on my stationary PC using the Storage Device Manager.

I'm able to browse the drive and copy the picures of some directories within the Picures folder of the mac drive, but for other directories, for example this one containing three pictures, i get the follwing when running ls -l

ls: cannot access DSC00001.JPG: Input/output error
ls: cannot access DSC00002.JPG: Input/output error
ls: cannot access DSC00003.JPG: Input/output error
ls: reading directory .: Input/output error
total 3
drwxrwxrwx 1 501 dialout   1957 2011-12-11 18:22 ./
drwx------ 1 501 dialout     82 2012-01-18 20:51 ../
-????????? ? ?   ?            ?                ? DSC00001.JPG
-????????? ? ?   ?            ?                ? DSC00002.JPG
-????????? ? ?   ?            ?                ? DSC00003.JPG

...so... are these files all toast, or is there something I can do?

UPDATE: I tried using ddrescue on a file, but got an Input/output error there aswell.

share|improve this question
As far as commercial tools go, I highly recommend RStudio –  hbdgaf Feb 25 '12 at 11:46

3 Answers 3

up vote 5 down vote accepted

First off, I strongly suggest you attempt to do an entire drive image copy of the damaged drive. You'll need a hard drive at least as large as the partition you are trying to recover. Assuming the partition of that drive is listed in /dev as /dev/sda2, you would mount the backup drive to (say) /mnt/restore

From there, you'd use the command: dd bs=4096 if=/dev/sda2 of=/mnt/restore/sda2.img conv=noerror,sync

This creates an image of the hard drive, including it's 'bad' blocks (if any, as it sounds there are.)

Next, disconnect the drive; a damaged drive only gets worse as it's used.

Next, you'll need to install testdisk:

sudo apt-get install testdisk

Accept it's request for untrusted sources (if you're so inclined.)

Finally, run test

From here, you'll need to use testdisk to find and recover files:

testdisk /mnt/restore/sda2.img

The menu is pretty self-explanatory, but using test disk is probably beyond the scope of this 'answer.' Here's a good place to get started:



These should help you recover your files, and won't do any more damage to your hard drive than necessary. Once you've done as much recovery as you can from the image file, you can safely delete it. You could then try running test disk on the damaged drive directly, and try recovering only the files that are absolutely missing.

Best of luck to you.

share|improve this answer
Thanks! I haven't gotten it to work yet.., but I'll note if I do! –  Theodor Feb 28 '12 at 12:03

You might want to make sure you have the hfsplus package installed: sudo apt-get install hfsplus

Though, if you can get to that point then I'm sure you already do. What generally is going on in these scenarios is that the hard drive is failing at that point. You might want to check dmesg | grep -i "I/O error" for any output. Any output there would almost be a positive of disk failure. Also, if you want more proof you can open the drive inside "Disk Utility" and click the "Smart Data" button. Check your "Reallocated Sector count" and "Seek Error Rate". Or you can just look for red dots.

Let me know if this doesn't help fix your problem.

PS: Did you let the disk dry completely?

share|improve this answer

ddresucue isn't something you use to read individual files, it's best used for copying the entire disk (well the readable portions) onto a working drive. Then you can try and repair it, or dig around and extract files, without worrying that the drive is about to die.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.