Reading view

There are new articles available, click to refresh the page.

How to migrate macOS virtual machines

Virtual Machines running macOS on Apple silicon Macs are more versatile than the host they run on. When you want to create a new VM, or modify an existing one, there are some powerful options available.

One of the most useful is to duplicate an existing VM: as APFS will do that using clone files, and the virtual disk in a VM is stored as a sparse file, that will use much less disk space than making a completely new VM. If you’re likely to need a supply of VMs running the same version of macOS, why not create a base VM using the IPSW for that version, duplicate it, then set up each clone as you require?

For even more flexibility, you can increase the size of the VM as I have already explained. The only remaining problem is how you can migrate the contents of one VM to another. Although my previous attempts to do this had been unsuccessful, Michael was kind enough to provide the solution, and this article explains how to use Migration Assistant in two VMs running concurrently to copy the contents of one VM to another, on the same host Mac. This should also enable you to migrate between a VM and a Mac.

To perform a successful migration, Migration Assistant needs to connect to a mounted Data volume on local storage, or over a network. It can’t use a VM shared folder on the host as the source (server). If your virtualiser supports root level access to USB storage, enabling it to mount an external disk in the VM, then you should be able to migrate from a Time Machine or other backup on that disk. Migration can be performed during initial setup and customisation of macOS, or by running Migration Assistant later. In this walkthrough, I’ll use the former.

You need

To do this, the virtualiser has two fundamental requirements:

  • it must be able to run two macOS VMs concurrently,
  • you must be able to assign them different MAC addresses.

Apple enforces a limit of two macOS VMs running concurrently on the same Mac, a rule written into the macOS license. Although that might seem stingy, macOS isn’t like Linux and you can’t run Tahoe on a single core with a mere 3-4 GB of memory. However, if you can spare at least 3 P cores and around 12 GB of memory for each, there should be ample to perform a migration. In practice, that means the host Mac should have a total of eight or more P cores, and at least 32 GB of memory.

MAC addresses are supposed to be unique. As the connection between these two VMs is over your local network, your DHCP server must allocate them two different IP addresses, or they won’t be able to migrate. The way to ensure that works is to assign each VM its own and different MAC address.

My own free Viable satisfies both requirements. Here I’ll use that to set up a new VM as the migration client, using an existing VM as the server. For the sake of simplicity, I’ll assume the MAC address of the server is the default, and won’t change that.

Procedure

This uses two macOS VMs running at the same time:

  • the destination for the migrated files is a new VM and is the migration client,
  • the source of those files is an existing VM and is the migration server.

Start by installing the IPSW to create your new VM. Rather than going straight on to its first run, at this stage open the server VM with the default MAC set, log into it, and locate Migration Assistant in /Applications/Utilities ready to run.

Now change the MAC address in Viable’s window to something different. I used d6:a7:58:8e:79:d4 instead of d6:a7:58:8e:78:d4. Then open the new VM, the migration client, and take it through its configuration, opting to migrate to it from another Mac.

When you reach the screen that sets that up, open Migration Assistant on the server VM, and set it to transfer data To another Mac. Then switch back to the client VM, and you should see that server offered as the source for your migration. Select it and perform the PIN authorisation so they can connect.

On the client, select the items you want to migrate to that VM, and proceed.

After a few minutes, the migration should complete, allowing the client to finish setting up with its new user account. You can then shut down the server and reset the MAC address and other settings in Viable.

Summary

Viable’s narrative documents the sequence:

  • Install the IPSW to create the new client VM.
  • Start up the server VM with 3 cores and 12 GB memory, and the default MAC of d6:a7:58:8e:78:d4.
  • Start up the client VM, with the same cores and memory, and a different MAC of d6:a7:58:8e:79:d4
  • When the new (client) VM reaches the Transfer information to this Mac window, open Migration Assistant on the server (old) VM and set it to transfer To another Mac.
  • Select the items to migrate on the new (client) Mac and proceed.

Apple’s instructions on migration are here.

Last Week on My Mac: Has macOS virtualisation ground to a halt?

Before macOS Tahoe, the biggest sticking point in virtualising macOS on Apple silicon Macs has been their lack of support for the App Store. From the outset this has been an ironic limitation. Here’s some of Apple’s most advanced technology running on its latest hardware, and it can’t even run the apps that Apple sells, only those supplied direct by their developers.

VMs can now have iCloud and iCloud Drive support, Messages, FaceTime, FileVault, and plentiful shared folders, but the one thing they have lacked that renders them useless for many users and many purposes is that can’t sign into Apple services, particularly the App Store. Some apps, including those in Apple’s iWork suite, will run in a VM despite it being unable to sign into your account, but you can only window-shop in the App Store, and most of its apps will simply refuse to run, even free ones.

I’ve long suspected that this is an example of Apple Commercial constraining Apple Engineering. To be useful, macOS VMs would have to be exempted limits on the number of Macs authorised to access services, and that could open up the possibility of third-parties bypassing FairPlay and the digital rights controls embedded in macOS. It must be deeply frustrating to those working on virtualisation, knowing that it could be done but won’t be.

So the only substantial new feature for macOS virtualisation in Tahoe is the introduction of ASIF disk images. For the time being, I’m not sure they’re going to change much for most of us who host our VMs on local APFS storage. As they still don’t enjoy proper API support, I don’t see any compelling reason to rush into their use, unless you want to host your VMs in the cloud.

Upgrading to Tahoe has, though, drawn attention to problems lurking for those who created VMs of 50 GB or smaller, who now want to enlarge them for this purpose.

Resizing VMs

Don’t skimp when creating a new VM. Give it a useful size, as its Disk.img is stored as a sparse file, so won’t take all that disk space unless you fill it to capacity. I now make my default VMs 100 GB to ensure there’s ample free for updates and anything else that might arise.

If you do have a treasured VM that’s too small, you may well be able to increase its size, either using Disk Utility or the hdiutil resize command tool if you prefer. To do this, start by duplicating your VM in the Finder. That creates a clone, and lets you fall back to the unaltered original if the resizing goes horribly wrong.

To resize the disk image using Disk Utility, you first have to move it out from inside its VM bundle, easily done in the Finder. Then in Disk Utility’s Images menu use the Resize… command, select that Disk.img and enter its new size. Add a little, around 8%, to allow for overheads, and let Disk Utility get on with the work.

Here’s Disk Utility inside this Tahoe VM, showing its 50 GB virtual disk.

I then resized it to just over 100 GB.

Here it is afterwards, now showing a full 100 GB.

I gather from others that resizing doesn’t always work. If you can’t get it to, then the only way forward is to create a new VM with the larger capacity and copy across the contents of your old VM. One obvious way to make that simpler and more thorough would be to use Migration, either during configuration of the new VM, or shortly afterwards.

I’m very grateful to Michael for telling us of his success in migrating from a small to a larger VM in Tahoe. I’m also more than a little jealous, as I’ve so far been unable to get it to work for me.

I’m also mystified as to how two macOS VMs running concurrently on the same Mac could establish a connection to support the file transfers required in migration. Neither can expose its virtual folders as shared folders for the other, and in any case shared folders are strictly circumscribed. Sharing them over AFP runs into a quirk of their bridged networking, that both of the VMs will default to using the same network IP address. In my failed tests, the destination Migration Assistant was able to recognise the source, but failed to connect to it successfully.

For the moment macOS virtualisation hasn’t made any substantial improvements in Tahoe. It still can’t sign into Apple services, and AI remains unavailable. Let’s hope the next year brings more and better, and realises more of its potential.

Should you use Tahoe’s new ASIF disk images?

Among the many new features Apple lists for macOS 26 Tahoe is a new disk image format, Apple Sparse Image Format or ASIF. In that list it appears as a feature for virtualisation, and is explained as: “Create virtualized disk images with a virtualized file format that can be formatted to any kind of file system.”

Yet in the help pages for Disk Utility, the claim goes further: “A modern sparse read/write image. The space it uses on your disk is proportional to the data it contains, making it efficient and general-purpose.” In Apple’s developer documentation for virtualisation, there’s more detail still:
“Apple Sparse Image Format (ASIF) files transfer more efficiently between hosts or disks because their intrinsic structure doesn’t depend on the host file system’s capabilities. The size the ASIF file takes on the file system is proportional to the actual data stored in the disk image.”

This article considers whether this new ASIF disk image format, as implemented in macOS 26.0, is more suitable for general purposes than the other two leading contenders. Should you use ASIF instead of sparse bundle or read-write (UDRW) disk images?

Testing

To assess the performance of these disk images, read and write speeds were measured in macOS 26.0 Tahoe running on a Mac mini M4 Pro with a 2 TB internal SSD. Each disk image was created using Disk Utility, with a single APFS volume in a disk of maximum size 100 GB stored on the internal SSD, with FileVault enabled. Each format was tested using plain APFS, and separately using APFS Encrypted with 256-bit AES.

When each disk image was created and mounted, a single folder was created in it, and the image unmounted. The disk image was mounted again, and a standard write test performed into the folder using Stibium. That writes in random order a total of 160 files ranging in size from 2 MB to 2 GB, totalling 53 GB. Once the write speed had been measured the image was unmounted again and Stibium closed. For the read test the image was mounted again and all 160 files in the test folder were read in random order using Stibium to measure their speed.

Results

Read and write performance for each of the tests are shown in the table, where results are ranked by read speed.

All three disk image formats achieve similar read and write speeds with unencrypted images. There were substantial differences in performance, though, when encryption was used. With encryption, the sparse bundle was faster than both RAW (Read-Write, UDRW) and ASIF. The new format read at exactly half the speed of a sparse bundle, and at 57% of write speed. ASIF with APFS Encrypted was the slowest of the seven tests in both read and write.

Differences in the size on disk of images were small. Empty disks were smallest for sparse bundles and ASIF, and following deletion of all test files, ASIF returned to the smallest size, indicating that it’s the most space-efficient.

Why use ASIF?

If ASIF doesn’t perform any better than existing formats, and any gains in space on disk are small, when and why should you use the new format? To appreciate its strengths, you need to consider how the other two formats work in terms of the file system they’re hosted on, and the file system they run internally.

A sparse bundle stores its contents on many band files inside its bundle. When its internal file system is able to compact free space, used space can be compacted into a minimum number of bundles, and those containing just free space can be deleted. Thus the total size of its bundle will vary according to the space required to store its contents. Coupled with efficient read and write support this results in good space efficiency and performance.

When a Raw Read-Write disk image has an internal file system that is capable of Trimming free space, as APFS and HFS+ can, that process will compact free space within the image. When the image is stored on a host file system that supports sparse file format, as APFS does, the space in the image that is free can be skipped, resulting in a space-efficient sparse file. However, a host file system like HFS+ that doesn’t offer a sparse file format is unable to take advantage of that.

ASIF is claimed to be able to accomplish similar economy of storage space without relying on the host file system’s special file formats, making it more suitable when the conditions required by sparse bundles and Raw Read-Write disk images aren’t available.

Although this new feature has been announced for virtualisation, it’s most probably only going to be useful for those running VMs stored on file systems other than APFS. Prior to the introduction of ASIF, VMs hosted on APFS have used Raw Read-Write style storage which has benefited from sparse file format, whether they’re macOS or Linux. Where ASIF may be of greatest benefit is for VMs run from network shares or cloud services, whose host file system won’t be APFS.

Recommendations

  • ASIF should be the disk image format of choice when neither sparse bundles nor Raw Read-Write images can achieve similar economy in host storage space.
  • In other circumstances, where sparse bundles or Raw Read-Write images can provide space-efficient storage and full performance, they are still to be preferred.
  • At present, ASIF isn’t generally a better replacement for sparse bundles or Raw Read-Write images, particularly when their internal and host file systems are APFS.
  • ASIF is likely to be of greatest benefit to those running macOS or Linux virtual machines from network shares or cloud services, where the VM can’t be hosted on APFS.

❌