Mike Bombich, the developer of the popular Carbon Copy Cloner application, has discovered a serious flaw in macOS that may cause data loss on APFS-formatted disk images.
Earlier this week I noticed that an APFS-formatted sparsebundle disk image volume showed ample free space, despite that the underlying disk was completely full. Curious, I copied a video file to the disk image volume to see what would happen. The whole file copied without error! I opened the file, verified that the video played back start to finish, checksummed the file – as far as I could tell, the file was intact and whole on the disk image. When I unmounted and remounted the disk image, however, the video was corrupted. If you’ve ever lost data, you know the kick-in-the-gut feeling that would have ensued. Thankfully, I was just running some tests and the file that disappeared was just test data. Taking a closer look, I discovered two bugs in macOS’s “diskimages-helper” service that lead to this result.
As demonstrated in the video below, Bombich found that an APFS volume’s free space doesn’t reflect a smaller amount of free space on the underlying disk and that the diskimages-helper application doesn’t report errors when write requests fail to grow the disk image.
The two issues have been reported to Apple. Until the problems are resolved, CCC has dropped support for APFS-formatted disk images.