MacOS – How to install Mountain Lion on a disk that cannot be formatted in recovery mode

disk-utilitymacosupgrade

I'm trying to do a clean install of Mountain Lion but I'm not being able to format my partition.

I previously had Lion, encrypted the disk, then upgraded to Mountain Lion, then booted into recovery mode to format & reinstall Mountain Lion.

On recovery mode (Cmd+R), when I tried to format the encrypted partition I got an error saying something like "not enough space on core something". Now the partition doesn't show up on Disk Utility; only the disk, "Macintosh HD", but I am not able to repartition it.

The Mountain Lion installer doesn't find any disk to install itself on.

I cannot boot the system either (without booting to recovery).

If I open the terminal and type diskutil list I can see that there's an Apple_CoreStorage on /dev/disk0s2, but I cannot reformat that volume ("The disk is in use by Core Storage as a Physical Volume").

How to format the disk and install Mountain Lion?

Best Answer

You should be able to use dd to destroy the partition's header. You can then format (erase) it and run the install.

From the installer run Terminal and type the following:

dd if=/dev/zero of=/dev/disk0s2 bs=1024 count=1024

Do be warned, this will irrecoverably destroy all data on that partition. But it looks like that's what you're expecting. Make sure you don't accidentally target the wrong thing.

Also note that I haven't done this, exactly. I've used this technique to destroy the entire partition table, not just a single partition. But I think it should work.

When you're done quit Terminal and run Disk Utility. You won't get any complaints about Core Storage.