Read the chapters in my new book Barcodes with iOS 7 as I hand them in. Great new app opportunities await!
Our DNA is written in Objective-C

Moving to Lion

One of the perks of paying for both the iOS as well as the Mac development program is that you get early access to the latest OSX beta versions. (Apple abhores the term “BETA” and thus calls everything “Developer Preview” lately)

I’ve been running my MacBook Air on most of the preview builds of OSX 10.7 “Lion” and so I was exited to move to the Gold Master version as well. My SSD was partitioned in two halves, one for 10.6 “to be safe if I need it” and one for 10.7. Now with Lion being final and working well I wanted to reclaim the entire SSD for the new and shiny cat.

But something went horribly wrong. Let me tell you about that and raise your awareness for a couple of precautions.

Updating from a Lion Preview to the GM was absolutely problem-free, but did change nothing about my disk being split in too. Less than perfect. A hint by Peter Steinberger relates to installing on a HDD: repair it before you install Lion, because apparently you get stuck if you don’t.

My first thought was that I would be able to simply resize the partition after deleting the Snow Leopard one. But here’s the first catch: while you can non-destructively resize HFS+ partitions, you can only resize their bottom end. So I had removed the upper partition positioned at the beginning of the SSD, but found myself without a way to move the top of the Lion partition to the beginning of the drive.

Sebastian Niesen suggested to me to use the diskutil tool in terminal to simply merge the partitions.

  1. diskutil list to find out the partition names with
  2. diskutil mergePartitions HFS+ Bla diskXsY diskXsZ to merge these two

I felt adventurous and so I aborted the Timemachine Backup that I had started and which would have taken another hour. Which was a really bad idea…

To have something to merge I created an empty HFS+ partition where the 10.6 had been (top half) and then I tried merging. Which did not work, because I kept getting the message that you cannot merge partitions if one of them cannot be unmounted. And usually the partition you booted from cannot be ejected, for obvious reasons.

But I did not give up there on pursuing my own doom, I booted into the recovery partition and found a terminal command there. And with the Lion system partition unmounted I was finally able to merge the partitions. But the result was and empty bucket. Apparently this merge eliminated all the stuff on the Lion partition and just made me a bigger empty one.

You can probably imagine the kind of scream that escaped my throat. No backup and all files gone.

When clear thinking returned to my head I realized that it’s not so bad anyway. I keep all my important source code on my Subversion server, and mail e-mails are on my mail server. So my personal cloud saved the day.

There I was, empty harddisk, how do I get Lion reinstalled?

Again, I tried the recovery partition, because there I had seen an option (besides the one to destroy everything) to reinstall Lion. I tried it several times, only to get an error message that this wouldn’t work. Checking the log mentioned something about app store not being found and a bag being empty. Which leads me to believe that you actually need to have an intact file system on the primary partition so that the Lion recovery can verify your app store receipt. Which it cannot, if you have nuked your system only moments earlier.

I had to start from square 1 and install Snow Leopard. My Air had come with a small USB key containing OSX 10.6.5. Unfortunately this version is too early to run the Lion installer with, instead you get a dialog informing you to this effect.

So one more step was necessary, System Update to get the 10.6.8 Combo Update. With OSX thus finally ready to be pimped to Lion I executed the Lion installer and it was smooth sailing since then. I finally ended up with what I wanted to achieve all along: a fresh install of Lion GM taking up the entire SSD.

These are the learnings from this adventure:

  • Make sure you have a complete backup before attempting anything drastic. It helps to have a combination of “personal cloud” as well as a regular Timemachine backup.
  • If you can spare the money you can remove the old OS partition (if applicable) and extend the Lion Preview partition upwards with a tool like iPartition.
  • Without a tool do to that your best bet is to let the Lion installer do his work, after having removed all partitions and creating one big HFS+ (Journaled) partition. But you need at least OSX 10.6.6 running somewhere to be able to execute the installer.

I tend to dive head first into many things, so the most important learning for me was: to be patient! You waited so long to get Lion on your Mac, if you find yourself rushing into something pause for a moment and make sure that you do your due diligence.

UPDATE: User Mugwump informs us that you can put /Contents/SharedSupport/InstallESD.dmg from the Lion Install App onto an USB stick, you get a bootable and installable Lion USB Stick. If I knew this earlier, I would not have had to reinstall Snow Leopard.

UPDATE 2: Clement Barry pointed out that I could have just upgraded the “top Snow Leopard partition”. But I had all my files and user settings on the bottom preview OSX, which I wanted to keep, so this was not an option for my specific case.

Categories: Apple

%d bloggers like this: