Imaging APFS storage in Disk Utility, and size of the VM volume

For various reasons, one of them sheer curiosity, I wanted to image one of my disks, and turned to Disk Utility (version 19.0 (1704), as supplied in Catalina 10.15.6). What happened wasn’t what I expected, nor what it documented in its Help book.

According to the Help book, Disk Utility can create a disk image from a disk, volume, folder or connected device. When creating one from a disk or volume, the image contains the whole of that item, including free space, whereas creating one from a folder only occupies the space needed to contain its data. That sounds strange, as if it hasn’t been updated for APFS, as Apple’s new file system’s volumes don’t have any free space of their own.

My first discovery is that Disk Utility can’t create a disk image from an APFS volume at all, despite the promises in its Help book. There are hints about this in the hdiutil man page, where it warns “with APFS, imaging from a device that is an individual APFS volume is invalid. To create a valid APFS disk image, device needs to be an APFS container or contain an APFS container partition.” If you want to create an image of a volume (or do almost anything else with disk images), then you’re much better off using C-Command’s excellent DropDMG.

I next tried to image a whole APFS container, and that started to look promising, but then failed.


With an error reporting “Resource busy” on a container with mounted volumes, this looks like it can be worked around by unmounting all the volumes in that container before trying to image it. Sure enough, if you do that, Disk Utility happily launches its helper and images the whole container. The size of the resulting container is only slightly larger than the used space in the container, and doesn’t include any free space. Therefore imaging an APFS container – when you remember to eject all its volumes first – is similar in behaviour to imaging an HFS+ folder.

Maybe a kind Apple engineer will get round to fixing this bug in Disk Utility, so that it automatically ejects the volumes in a container to be imaged, and mounts them again once the imaging is complete. I feel sure that this has already been reported in several Feedback entries.

The other issue I wanted to look at was the minimum size of the VM volume of a bootable Catalina container. In my recent account of boot disk structure, I had originally written that the hidden VM volume could be as small as 20 KB. On reflection and at the prompting of knowledgeable readers, this seemed far too small, and I assumed that I had made an error in its units, so hastily amended the article to give that size as 20 MB, which seemed more reasonable, even though it may run around 1-6 GB in ordinary use.

With my iMac Pro and its 32 GB of physical memory freshly started up and no virtual memory in use, Disk Utility reported the VM volume was 20 KB in size, as did diskutil at the command line.



Being an APFS volume, the VM volume will grow and shrink in size according to demand. When there’s no virtual memory in use, you can expect it to be as small as 20 KB. I have recorrected that article as a result.