macOS

macOS High Sierra APFS Bug Can Cause Data Loss When Writing to Disk Images

Software developer Mike Bombich has discovered a flaw in macOS High Sierra’s APFS file system that can lead to data loss when writing disk images.

MacRumors:

In a blog post last Thursday, software developer Mike Bombich explained that he had uncovered the data writing flaw in the Apple File System, or APFS, through his regular work with “sparse” disk images.

A “sparse disk image” is a file that macOS mounts on the desktop, and treats as if it were an attached disk drive. Sparse disk images are often used in backing up and cloning disks. Bombich is the creator of Carbon Copy Cloner, which means Bombich is experienced with the use of the 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.

The two images Bombich discovered are that an APFS volume’s free space doesn’t reflect a smaller amount of free space on the underlying disk, and The diskimages-helper application doesn’t report errors when write requests fail to grow the disk image

When macOS users update their Mac to macOS High Sierra, which is the latest version of the venerable operating system, the installation process automatically converts the Mac’s hard drive to APFS.

Ordinary APFS volumes, such as SSD startup drives, are not affected by the bug, so most users will not experience the issues described by Bombich. The flaw usually shows up when making backups to network volumes. Bombich says Carbon Copy Cloner won’t support APFS-formatted sparse disk images until the issue if fixed.

Chris Hauk

Chris is a Senior Editor at Mactrast. He lives somewhere in the deep Southern part of America, and yes, he has to pump in both sunshine and the Internet.