Showing posts with label Computers. Show all posts
Showing posts with label Computers. Show all posts

Fixing invalid node structure in a Mac OSX (w/o having to buy software!)

So it happened. The darned invalid node structure error when I verified my Macintosh disk in an attempt to repair it. This happens to many Mac users whose computers are playing up, and is a fairly serious error seeing as Disk Utility itself cannot repair the error. Neither can the fsck command. And for many users, one cannot boot up their computer again under this error, so if you have attempted to repair it in vain from booting up with the CD/fsck, you're pretty much screwed.


However - you don't need to erase your disk or buy Disk Warrior to fix it. I was in a perilous situation, where I had not backed up anything on my disk and, well, was not really in the mood to fork out money on Disk Warrior or a technician.

With the help of Simon at Devlab, the problem was solved!

Now, as I mentioned the fsck command won't work on its own. However, this command does;
fsck_hfs -rf /dev/diskxsy - where x and y are unique to your computer, but range between 0 and 4 usually

How do you go about doing this for the layman?
1. Restart your computer and immediately press and hold Command-S

2. You will soon go into the console command view.


3. Type in the fsck_hfs -rf /dev/diskxsy command

4. Remember to experiment with x and y, mine ended up being disk0s3. To find out for certain the x number, you have to boot up with your CD (insert your Mac OSX installation CD, reboot and press and hold C). Then, choose the first language option and go to Utilities and Disk Utility at the top menu options. Click on the disk you are having trouble with and click info. Disk identifier will give you your x number.

5. If you get something along these lines:
#: type name size identifier
0=apple_partition_scheme *26.6gb disk0s0
1=apple_partition_map 31.5kb disk0s1
2-apple_driver43 28.0kb disk0s2
3=apple_driver43 28.0kb disk0s3
4=apple_driver_ATA 28.0kb disk0s4
5=apple_driver_ATA 28.8kb disk0s5
6=apple_FWDriver 256.0kb disk0s6
7=apple_driver_IOkit 256.0kb disk0s7
8=apple_patches 256.0kb disk0s8
9=apple_hfs Tiger 26.4gb disk0s10
After running your command line I get this message;
Usage: fsck_hfs [-dfl m[mode]npgruy] special device
d= output debugging info
l= live fsck (lock down and test only)
m arg= octal mode used when creating lost+found directory
n= assume a no response
p= just fix normal inconsistencies
q= quick check returns clean dirty or failure
r= rebuild catalog btree
u= usage
y= assume a yes response
THEN, you need to keep experimenting with you x and y values

5. Once the computer accepts your command, it will start attempting to repair the disk. The command will look something like this:
magneto:~ root# fsck_hfs -rf /dev/disk1s3
** /dev/rdisk1s3
** Checking Journaled HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Rebuilding Catalog B-tree.
Invalid node structure
(4, 75586)
** Rechecking volume.
** Checking Journaled HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
... and so on.

6. Once it is finished, the command will either say:
The volume X was repaired successfully.
or Cannot repair drive after 3 attempts
If it is the prior, hell yes. Time to type in the command exit and reboot (or hard restart if this does not work).
If it is the latter, you can still be happy. Why? Well, some people who attempt this method usually rerun the command until that "Cannot repair drive after 3 attempts" disappears. However, myself and some other people exited the console and rebooted with the startup CD in in order to run Disk Utility. Once we did so, we were able to repair to drive whereas we could not before! Unbelievable! Once this was all over, we were able to start up our drive as per normal.


Please note that these steps will differ amongst computers, so follow them as best you can and improvise where necessary. But at least you will have an operational computer at the end of all this!