LASER_oneXM

Level 32
Verified
source (bleepingcomputer.com): macOS May Lose Data Due to APFS Filesystem Bug



Under certain conditions, macOS may copy data into the void, leading to data loss of important files, all due to a bug in how the operating system handles APFS sparse disk images.

The issue was discovered and reported to Apple this past week by Mike Bombich, the creator of a Mac backup application named Carbon Copy Cloner.

Bug affects only APFS sparse disk image files
Bombich says the bug affects only "sparse disk images" formatted in Apple's new filesystem format APFS, first deployed macOS High Sierra in March 2017.

A "disk image" is a file format that contains the entire contents and structure of a disk volume, such as USB, CD, DVD, hard disk drive, or network share.

Many Mac applications utilize disk images, especially backup software, allowing users to create copies of other volumes and quickly move files in and out of an older backup image at a later date.

A "sparse" disk image is a type of disk image file that can grow as the user adds more data to it. But sparse image disks can only go as far as the underlying storage medium permits, and they will show a free space available value, depending on the free space that remains on the underlying hard drive.
Users at risk of losing sensitive data
The issue is that APFS sparse disk images fail to synchronize the value of the "free disk space" from the sparse disk image with the real "free disk space" value from the underlying hard drive.

This leads to catastrophic scenarios where users might think they have free space on APFS sparse disk images —but they do not— and end up writing data into a void, once the underlying storage disk is full and data overflows.

Bombich says the bug is not the fact that macOS writes data into the void, but that it fails to warn users that (1) there is no more space on the underlying hard drive and (2) that it shows misleading information.

The misleading information is that for a short period after the write operation has taken place, macOS can still access the file, and even show the file with a proper checksum, tricking the user into believing that the copy/move operation has gone as planned.

In reality, this has not, and this state lasts until a system reboot when any artifacts of the copied files are removed from the OS' memory, and files become corrupted and inaccessible. Here's an example, to better understand how this works.

- A user creates 50 GB APFS-formatted sparse disk image that stores its data on a remote network share of 50 GB.
- The user copies data to the remote network share, taking up 40 GB of data.
- The APFS disk image file is not updated, and continues to show 50 GB of free space.
- The user tries to copy a 20 GB file to the disk image.
- The copy operation goes as planned. The user can still access and open the file right after the copy operation and the checksum is identical to the original file.
- User reboots workstation.
- Copied file becomes corrupt, as 10 GB of its data disappears.
 
Last edited:
D

Deleted member 65228

Apple never fail to surprise us when it's least expected ;)

Good job Apple, we'll be waiting for next week's problem!

Apple got 99 problems and bugs is huge one