Fixing OS X 10.9 Mavericks Migration from external Volume

Today, I updated my sister's MacBook with an SSD, something I've done many times with many different Macs in the past. I used the same procedure I always used, which is first replacing the HD by the SSD, then installing a fresh copy of the latest OS X on the new SSD,  then connecting the old HD via an external USB housing and using Migration Assistant to copy the applications and user accounts.

Only, this time, the migration assistant only found 157k of data (on the 120G disk!) to migrate!

Apparently this is a known issue - there are many reports of Migrations Assistant not seeing the connected external source disks properly.

However, I did not find a convincing recipe for how to work around this problem.

What I found was the explanation what is different in Mavericks' migration assistant: It logs out of the user account it was started from before actually starting its task. Only, this causes all mounted disks (and disk images) to be unmounted. For some reason, it fails to remount them properly, so even if you can choose the name of an external disk as a source for migration, the disk is not really online and the assistant only sees those ominous 157k of data.

So the problem was to find a way to remount the disk, while migration assistant was already running. As it takes over the machine full screen, you can't start any tools or change users at this point.

But you can login from another machine via ssh, and you can mount disks from the commandline easily, thanks to the powers of diskutil.

So the solution was as follows:

  1. Enable ssh login for the target machine: Set the checkbox in "System preferences"->"Sharing"->"Remote login. To the right, there will be a green dot and a text saying "Remote login: On - to login to this computer remotely, type "ssh user@".
  2. This is exactly what you need to type on another computer in the same network to log in via ssh (preferably a Mac, BSD or Linux box, but anything capable of ssh, even a WinXP with putty will do, if you know how to use that). You need to enter your target computer's admin account password to get access.
  3. Now, back on the target machine, start the Migration Assistant, enter the password when asked and confirm terminating all other apps. The welcome screen of Migration Assistant appears. This is the point where Migration Assistant has unmounted all volumes.
  4. Go back to the ssh session on the other computer. Here you can enter the commands to mount a disk. In my case (original HD, connected via external USB housing) it was simply:
    • sudo diskutil list    # showing the available disks. Usually /dev/disk0 is the internal disk, /dev/disk1 the first external one.
    • sudo diskutil mountDisk /dev/disk1
  5. Now, on the target computer, click through the  Migration Assistant dialogs step by step as usual, and everything works as expected :-)

Instead of using diskutil to mount real disks, you might want to use hdiutil to mount images (.dmg, sparse bundles etc.) with a command line like "sudo hdiutil mount /path/to/some/diskimage.dmg". Or maybe both combined, first diskutil to mount an external HD containing disk images, and then hdiutil to mount one of those.

There's plenty of  examples and howtos about how to work with mount, diskutil and hdiutil on the net. But I did not find a single hint using these tools to mount volumes and images for Mavericks' buggy Migration Assistant - so I wrote this. Hope it will save others a bit of time...