Unable to merge partitions or reinstall OSX I have 1 SSD disc in MacBook Pro mid 2009 with 2 partitions and I would like to make a clean installation.

So.. using Disc Utility I have erased both partitions (OS X Extended - Journaled). So far so good. Now I wanted to merge both partitions and when I do that I get "Operation failed.. Couldn't unmount disk". When I click done I see both partitions are unmounted.

When I try to merge partitions again I get instant error "The volume Macintosh HDD 1 is not journaled. To enable journaling click Enable journaling in the File menu". I did that but no luck. Still the same error.

So I gave up merging partitions and tried to install OS X. But no luck.. there is no partition to select during the installation process. Only the recovery partition is visible.

I tried to unmount discs from terminal using diskutil but none of partitions can be unmounted.

Please help me! Thank you.
You've probably booted the recovery system from the recovery partition of the partition you're trying to merge/delete, so the recovery partition is getting in the way of repartitioning.

How I'd handle this situation depends on whether you've got another Mac and an appropriate macOS installer app handy.

Assuming this is your only Mac, as a safety net, I'd install macOS to an external drive of some kind. A spare USB HDD, or a large enough flash drive (USB stick, SD card, etc.) will do the trick - 32GB is plenty, 16GB is in theory enough too but I'm not sure the installer will allow it. Then I'd boot from that external OS instance and download the macOS installer app from the App Store, or check that the external OS has a working recovery environment. Wipe the internal drive - if Disk Utility won't cooperate, use the command line equivalent: diskutil erase (after checking the disk number, e.g. disk0, using diskutil list).

The macOS installer should now make the freshly erased internal SSD available as an install target.

If you've got another Mac and an appropriate cable handy, the easiest solution is probably creating a macOS installer flash drive using the other Mac and then booting that installer on your MBP. You can then erase the disk using either Disk Utility or diskutil from the installer environment's Terminal, and select the freshly erased disk in the installer.