Blog Pro de Jean-Baptiste HEREN

Notes d'un consultant Freelance en Informatique

To content | To menu | To search

Repair HFS+ Volume on OSX

harddrive_osx.pngYesterday I had a little surprise on one of my disks (the backup one.Disk utility was unable to repair it, but here you will find some tips

1- read your disk with Linux

Boot on Ubuntu live CD and try to open your disk. It will mount read-only (default for HFS) but you will be able to grab most of your files to a network or FAT external drive. This saved my life a couple of times.

2- repair with fsck on OSX

Fsck is also available on OSX. Let's open your terminal. On the following commands, replace /dev/disk1s2 with the location of your disk's partition.

2.1 - run a diagnostc

[script]
MyMac:~ jb$ fsck -fy /dev/disk1s2
** /dev/rdisk1s2
BAD SUPER BLOCK: MAGIC NUMBER WRONG

LOOK FOR ALTERNATE SUPERBLOCKS? yes

SEARCH FOR ALTERNATE SUPER-BLOCK FAILED. YOU MUST USE THE
-b OPTION TO FSCK TO SPECIFY THE LOCATION OF AN ALTERNATE
SUPER-BLOCK TO SUPPLY NEEDED INFORMATION; SEE fsck(8).

2.2 - repair by adding the r option

This can take a while, it took 60min for my 1,5TB Disk.

[script]
MyMac:~ jb$ fsck_hfs -fy /dev/disk1s2
** /dev/rdisk1s2
   Executing fsck_hfs (version diskdev_cmds-491.3~2).
** Checking Journaled HFS Plus volume.
** Checking extents overflow file.
** Checking catalog file.
   Invalid node structure
(4, 242826)
** The volume Grozor could not be verified completely.
iMac-de-la-familia:~ jb$ fsck_hfs -ypr /dev/disk1s2
   Executing fsck_hfs (version diskdev_cmds-491.3~2).
** Checking Journaled HFS Plus volume.
** Checking extents overflow file.
** Checking catalog file.
** Rebuilding catalog B-tree.
   Invalid node structure
(4, 242826)
   Invalid record count
(4, 242827)
   Invalid record count
(4, 242828)
   Invalid record count
(4, 242829)
   Invalid record count
(4, 242830)
   Invalid record count
(4, 242831)
** Rechecking volume.
** Checking Journaled HFS Plus volume.
** Checking extents overflow file.
** Checking catalog file.
   Missing thread record (id = 47443244)
   Incorrect number of thread records
(4, 21586)
   Incorrect number of thread records
(4, 21586)
** Checking multi-linked files.
   Incorrect number of file hard links
** Checking catalog hierarchy.
   Invalid directory item count
   (It should be 428 instead of 440)
   Missing thread record (id = 47443242)
   Invalid directory item count
   (It should be 0 instead of 1)
   Invalid directory item count
   (It should be 107 instead of 440)
   Invalid directory item count
   (It should be 673621 instead of 673646)
   Invalid volume file count
   (It should be 4308261 instead of 4309339)
** Checking extended attributes file.
   Incorrect number of extended attributes
   (It should be 1823295 instead of 1823257)
   Incorrect number of Access Control Lists
   (It should be 1823272 instead of 1823234)
** Checking multi-linked directories.
   Incorrect number of directory hard links
** Checking volume bitmap.
   Volume bitmap needs minor repair for orphaned blocks
** Checking volume information.
   Invalid volume free block count
   (It should be 19453978 instead of 7705538)
   Volume header needs minor repair
(2, 0)
** Repairing volume.
...

If your drive is sill not repaired :

[script]
   Invalid first link in hard link chain (id = 47694526)
   (It should be 49482808 instead of 49484125)
** Look for missing items in lost+found directory.
** The volume Grozor could not be repaired.

Then you can try to fix it again with your Disk utilities (Application/utilities) utilitaire_disques.png

Then if you are as lucky than I was, you will be able to mount under OSX. Now it is wise to backup important files (if not already done) and run a physical test.

Jean-Baptiste Heren

Author: Jean-Baptiste Heren

Stay in touch with the latest news and subscribe to the RSS Feed about this category

Macdalor Macdalor ·  26 October 2011, 20:52

brillant! I was getting ready to reformat and loose all data!!! thank you!!!

Matt Matt ·  10 January 2012, 10:03

Thanks for your post. I'm getting similar messages when I run disk utilities in Lion recovery partition, but it always manages to repair it. However, the issues keep coming back (found similar issues three times this week. Do you have any idea if that's hard drive or a software issue? I'd be interested in your thoughts.

no attachment



You Might Also Like

vbox_logo.png

Convert virtual drive from virtualbox to vmware

You have a virtualbox image and want to use it in VMWARE ? If the .ova file does not fits your needs, you can try to convert the hard drive and then use it directly in a configured vmware machine....

Continue reading

harddrive_osx.png

Repair HFS+ Volume on OSX

Yesterday I had a little surprise on one of my disks (the backup one.Disk utility was unable to repair it, but here you will find some tips 1- read your disk with Linux Boot on Ubuntu live CD and try...

Continue reading