Tag Archives: mac

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 bought my dream laptop on Feb ‘08, i was really satisfied with the MacBook. This is my first blog after on MacBook. The MacBook came with the Mac OS X leopard. leopard was pretty awesome. That was my first play on Mac world. But, Really, i felt restricted with what mac gave me, though it gives almost what you need. Then, I installed Ubuntu on my MacBook. Now, I am feeling Free :P on Ubuntu. I can do whatever i want.

    Ubuntu Hardy Desktop Screenshot

    You can flawlessly install Ubuntu on your MacBook. Let’s take a look what you need to do to install Ubuntu on MacBook.

    My MacBook Version :

    Check with your MacBook Configuration before proceeding.

    My MacBook is Santa Rosa v3.1 (Intel Version) release with the below configuration,

    Intel Core 2 Duo 2GHz | 1 GB RAM | 80 GB HDD | 13.1′ inch screen | White Color

    Hardware Details,

    $ lspci
    00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 03)
    00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 03)
    00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 03)
    00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 03)
    00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)
    00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)
    00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
    00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)
    00:1c.4 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 5 (rev 03)
    00:1c.5 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 6 (rev 03)
    00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)
    00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)
    00:1d.2 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03)
    00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)
    00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)
    00:1f.0 ISA bridge: Intel Corporation 82801HEM (ICH8M) LPC Interface Controller (rev 03)
    00:1f.1 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03)
    00:1f.2 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA IDE Controller (rev 03)
    00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03)
    02:00.0 Network controller: Broadcom Corporation BCM4328 802.11a/b/g/n (rev 03)
    03:00.0 Ethernet controller: Marvell Technology Group Ltd. Marvell Yukon 88E8058 PCI-E Gigabit Ethernet Controller (rev 13)
    04:03.0 FireWire (IEEE 1394): Agere Systems FW323 (rev 61)

    1. Make a room for Ubuntu :

    Assuming you have only Mac Leopard Installed on your MacBook.

    We need to resize the Mac OS X ( HFS+ File System ) single partition & create a free space to install Ubuntu.

    We can do this using Ubuntu Live/Installer CD. Before resizing the Mac partition, you need to disable the journaling the Mac partition. You can do this using diskutil utility in Mac OS X, Boot into Mac and Enter the following command in terminal to do this.

    sudo /usr/sbin/diskutil disableJournal /

    You can enable journaling after installing ubuntu, replace disableJournal with enableJournal.

    you need to Boot from the Ubuntu Hardy Heron Live/Installer CD, select start live cd option to start live session. Wait, until you see the desktop.

    Open Gparted ( System > Administration > GNOME Partition ), Right click the Mac OS X partition then select resize option.

    I thougt, 10 GB is enough for Ubuntu. You can use the remaining Mac OS X parition in Ubuntu with Read/Write Mode.

    After you resized the partition (decrease 10 GB size atleast), Create Swap parition & Logical Ext3 Partition in Free Space.

    Resizing the partition takes 30 to 40 min depending on the disk usage. So, Please be patient until it gets resized.

    You can start the Ubuntu Installation right away, Double click on the Install icon from the Ubuntu Desktop.

    Follow the wizard, When you come across Installation procedure go for Manual Installation. DO NOT select Automatic Installation, automatic installation deletes all paritions on your disk to install the Ubuntu.

    Then select the Ext3 Partition as the root partition, then proceed to the next step. Leave everything as default. Also, let it install Grub.

    Ok now, you have done Installing Ubuntu. Now let it restart the Machine. Proceed to the next step.

    2. Starting Ubuntu :

    I assume that everything went well while installing ubuntu. Press & Hold Alt/Option Key while starting the MacBook then select the parition named Windows to boot into Ubuntu Linux. It is recommened to install refit in your Mac. You can download the Mac Disk Image from here http://refit.sourceforge.net/#download . Install it in Mac OS X. Then restart the Machine. You’ll get the Options two select from Linux and Mac OS.

    Select Linux to boot in to Ubuntu Linux. So, you have got a Ubuntu Desktop on your Machine. Wait, but lot of things doesn’t work automatically by default. Such as, No Sound, Apple Hot Keys doesn’t work, trackpad doesn’t work properly (including right-click), No Wireless, No Webcam support, No Bluetooth support. Apart from this, you need to install multimedia packages to support all audio/video formats.

    3. Configure Ubuntu :

    Most of the things work by Following this wiki :

    https://help.ubuntu.com/community/MacBook_Santa_Rosa

    Lot of things, i didn’t cover up yet here. Reason, no time, lack of interest or i am lazy. I ‘ll update this post whenever i feel back.

    later…