take a full backup to an external usb drive using a tool like Superduper or CarbonCopyCloner and boot it to make sure it's good (select disk using "Startup Disk" in System Preferences.) You need a good backup before messing with the partitions.
Using Disk Utility (/Applications/Utilities/Disk Utility.app) select your internal drive in the left-hand column and select the "Partition" tab in the right-hand column. Hit the "+" button under partition layout to create an additional partition. You can use the slider in the partition layout or the "Size" textbox to change the partition sizes. Hit "Apply" to confirm changes and write to disk.
All partitions will be dynamically resized, presuming they pass a fsck (filesystem check test.)
- Launch the Install OS X Mountain Lion.app (no need to bother with usb install disk creation) and accept the license agreement. When you get to the screen showing the install disk click the "Show All Disks..." button and select the partition you just created.
- Proceed with the installation as normal (this being Apple you will not be asked for a lot of input.) As part of the installation the installer will boot into the second partition for you. If you want you can use the Migration Assistant in the final stages of the installation to import all users and settings from your Lion partition.
That's all there is to it! I've done this on an iMac and a Macbook Pro so far this week with minimal problems. Only the Macbook Pro couldn't pass the fsck and I needed to boot to the recovery partition to repair the root fs before I was able to shrink and create another partition.
Addendum: repairing the system partition
The system partition cannot be resized if it does not pass a filesystem check and you cannot repair the system partition while you are booted into that system so you will need to boot from an alternate one. Apple has made this very easy by automatically creating a Recovery Partition in OSX Lion and later.
- Reboot the system. While booting press and hold down the "option" (aka "alt") key until you are presented with a list of boot devices and choose the "Recovery HD" disk. (Alternatively press and hold [CMD]+[R] during boot to boot directly to Recovery)
- You are presented with a list of utilities, choose Disk utility
- Now you have the familiar Disk Utility interface but on a linen background. Select your system partition from the left-hand column and select the "First Aid" tab in the right-hand column, finally click the "Repair Disk" button located at the lower right-hand side of the text box.
A lot of text will scroll by in the text box. If all goes well you should end with a message telling you that "Volume repair is complete."
- Now reboot ("Apple Menu" > Restart) and let the system boot as normal.