I plugged then uplugged my HFS (Non-journaled) external USB drive with its own power outlet from the RPi2, now the drive is corrupted

dmesg | tail -20:

[ 14.840735] hfsplus: Filesystem was not cleanly unmounted, running fsck.hfsplus is recommended. mounting read-only.
[ 14.844873] hfsplus: invalid catalog max_key_len 18573
[ 14.844925] hfsplus: failed to load catalog file
[ 20.126286] hfsplus: Filesystem was not cleanly unmounted, running fsck.hfsplus is recommended. mounting read-only.
[ 20.128148] hfsplus: invalid catalog max_key_len 18573
[ 20.128218] hfsplus: failed to load catalog file

I tried to use Disk Utility on my Mac to repair the drive but got this

Verify and Repair volume “disk4s2”
Repairing file system.
Checking Journaled HFS Plus volume.
Invalid B-tree node size
The volume could not be verified completely.
File system check exit code is 8.
Updating boot support partitions for the volume as required.
Error: Disk Utility can’t repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.

I tried to rebuild the drive using StellarVolumeOptimizer app but no luck.

I tried some fsck.hfsplus command but it didn't help.

What should i do? I don't want to lose all the data in the drive.

  • Did you properly unmount the disk before you detached it? A better place to ask about this might be the apple site, Ask Different. – goldilocks May 2 '15 at 13:12

You can VERY likely solve this. :-)

In Mac's Disk Utility, click on the disk (this is the out-dented line naming the drive) and run repair. It should come out ok, but I always feel like it can't hurt.

Now for each drive below that (these are your partitions) do the same. Click on it and click "Repair Disk" YES, I know you got (and will likely get) "...can't repair this disk.." Do it AGAIN. AGAIN. AGAIN. I kept losing Time Machine Backups and and reformatted the drive before but this time I had no patience and just kept running it. I'd wait and run it again. I'd do just a verify. I'd repair again. Finally it started solving SOME of the problems and eventually it solved ALL. I've also used other things (hdutil and fsck in terminal) but it's the same thing, so just keep running it. I felt very victorious when it worked, believe that.

FINALLY - and I'm hoping and expecting that this worked and you got your drive back up (not the orig poster, as that's MONTHS ago but you reading now) - every now and then (every time would not be too much!) when you shut down your pi, disconnect that drive and plug it into the Mac. Run repair in disk utility. I've seen where the drive loads fine on the pi (RW is a big sign to me that it's 'ok') but then when I run repair TONS of index problems and catalog problems are found which are repaired. My guess is those show up after they are too extensive to get around on the pi.

Also, try using 'shutdown -F' instead of shutdown and 'shutdown -rF' instead of reboot (with 'now' if that's your thing) to get a disk check on the boot disk on reboot.



| improve this answer | |
  • 1
    Very interesting technique in running repair over and over... It must be a Macintosh Hack. Hehehe, but you should backup all data first any way before hammering or tinkering with this rubbish file system. – Piotr Kula Jan 25 '16 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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