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.
APFS, which simply stands for Apple File System, replaced Apple’s HFS+ file system in 2016 with the aim of providing improved efficiency and stronger encryption to users of its macOS and iOS operating systems.
Bombich has reportedly uncovered a data writing flaw in the system through his work with sparse disk images and published his findings in a new blog post. A sparse disk image is a type of disk image file used on macOS that grows in size as the user adds data to the image, taking up only as much disk space as stored in it.
macOS mounts an image on the desktop and treats as if it was a physically attached drive with a classic disk volume structure. These sparse disk images are often used in backup and disk cloning operations.
According to Bombich, there are two issues with the bug. One: the free space on the APFS-formatted sparse disk image doesn’t update when the free space on the underlying physical host disk is reduced. The second is related to the lack of error reports when write requests fail, which results in data being written into a “void”.
“I noticed that an APFS-formatted sparsebundle disk image volume showed ample free space, despite that the underlying disk was completely full,” he explained in the post.
“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 Bombich unmounted and remounted the disk image, however, he discovered that the video was corrupted.
“If you’ve ever lost data, you know the kick-in-the-gut feeling that would have ensued,” he added. “Thankfully, I was just running some tests and the file that disappeared was just test data.”
The two issues have been reported to Apple. Until the problems are resolved, Carbon Copy Cloner has dropped support for APFS-formatted disk images.