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

  • sudo diskutil disableJournal /dev/disk0s2

where disk0s2 is your Mac partition (use ‘df’ command to find out the root disk name, it should be mounted on ‘/’)

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

  • sudo apt-get install hfsprogs

    This will enable you to check & repair the HFS+ paritions.

    4. Check & Repair

    You need to do fsck check on your Mac partition. Use fdisk command to find the Mac device.

    abhinay@ubuntu:~$ fdisk -l
    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

    using fdisk didn’t show the Main Partition of mac, It shows only one partition. The above partition sda1 is the EFI partition (boot partition).
    That means, /dev/sda2 is your Mac partition.

    Perform fsck on sda2

    abhinay@ubuntu:~$ sudo fsck.hfsplus /dev/sda2
    ** /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.

    Hurray! It is repaired now…!

    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

    You are done! :)

    **This worked for me!

    Comment me if you have any troubles or suggestions. Thanks for reading my blog!

    I felt choppy when i scroll up-down in Gmail. There are two workarounds for this issue.
    First thing, change your theme from Clearlooks. But, I really like clearlooks theme.
    The Other one is, play with xorg.conf
    Edit /etc/X11/xorg.conf
    Find this Section:

    Section "Device"
    Identifier	"Configured Video Device"
    EndSection

    Add some properties & change it to:

    Section "Device"
    Identifier	"Configured Video Device"
    Driver		"intel"
    Option		"AccelMethod"		"exa"
    Option		"ExaNoComposite"	"true"
    Option		"MigrationHeuristic"	"greedy"
    EndSection

    This workaround worked with Intel Graphics Card Users. For non Intel Graphics Card Users trying the above is experimental.

    Do Logout & Login. This should solve the choppy scrolling issue in Gmail.

    =http://ubuntuforums.org

    Dear All,

    We are cordially inviting you to attend the convention on “Freedom & Software”. The convention will be attended by IT Professionals, Academicians, Researchers, Entrepreneurs and Engineering Students.

    Venue:
    Russian Cultural Center
    27, Kasthuri Ranga Road
    Landmark: Near Cathedral Road
    Chennai 600018

    Time: 21st of September at 1600 hours

    Register yourself at http://freedomandsoftware.info