Repair / Fix Mac HFS+ partition using Ubuntu CD
This post will tell you how to repair / fix Mac HFS+ partition using Ubuntu CD (Live CD or Install CD).What do you need to do this?
Ubuntu CD (I used Ubuntu 8.10 Desktop Edition Install/Live CD)
Mac
Internet Connection (Wired)
Few days back I had installed Debian 5.0 lenny on my MacBook. Because, I don’t have much hard disk capacity (only 80 GB), I had to delete the Linux partition (waiting for Ubuntu 9.04). I used BootCamp Utility (in Mac) to delete the Linux partition. It wipes off all the linux data & restores Mac partition (ex: I had 60GB Mac + 20GB Linux, After restore 80GB* Mac).
I was happy that it was restored. But, the partition had errors after restores. I was not able to copy/store the any data if it exceeds 60GB on Mac, it says the Mac startup disk is full. Then I realized that the Mac file system (i.e., HFS+) had errors. Yes, the Ubuntu CD is there to rescue me. Enough story… follow this to proceed…
1. Disable journaling on Mac parition before booting into Ubuntu CD
Use this command on your Mac terminal
where disk0s2 is your Mac partition (use ‘df’ command to find out the root disk name, it should be mounted on ‘/’)
- sudo diskutil disableJournal /dev/disk0s2
2. Boot from Ubuntu CD
Insert the Ubuntu CD, press ‘C’ on startup to boot from CD.
3. Connect to Internet & Install HFSprogs
After Boot connect to Internet, Yeah! I know the wireless won’t work now. I suggest you to connect from Wired.
I assume that you are connected to Internet now.
Then enable Universe packages using ‘Software Sources’.
Then, Install hfsprogs package
This will enable you to check & repair the HFS+ paritions.
- sudo apt-get install hfsprogs
4. Check & Repair
You need to do fsck check on your Mac partition. Use fdisk command to find the Mac device.
abhinay@ubuntu:~$ fdisk -lusing fdisk didn’t show the Main Partition of mac, It shows only one partition. The above partition sda1 is the EFI partition (boot partition).
WARNING: GPT (GUID Partition Table) detected on ‘/dev/sda’! The util fdisk doesn’t support GPT. Use GNU Parted.
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0×00000000
Device Boot Start End Blocks Id System
/dev/sda1 1 9730 78150743+ ee GPT
That means, /dev/sda2 is your Mac partition.
Perform fsck on sda2
abhinay@ubuntu:~$ sudo fsck.hfsplus /dev/sda2Hurray! It is repaired now…!
** /dev/sda2
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking multi-linked files.
** Checking Catalog hierarchy.
** Checking Extended Attributes file.
** Checking volume bitmap.
Volume Bit Map needs minor repair
** Checking volume information.
** Repairing volume.
** Rechecking volume.
** Checking HFS Plus volume.
** Checking Extents Overflow file.
** Checking Catalog file.
** Checking multi-linked files.
** Checking Catalog hierarchy.
** Checking Extended Attributes file.
** Checking volume bitmap.
** Checking volume information.
** The volume Macintosh HD was repaired successfully.
One more last thing you ‘ll have to do.
5. Enable the journaling on Mac Partition
use this command on Mac to enable the journal back.
sudo diskutil enableJournal /dev/disk0s2