After many years using the venerable HFS+, Apple has finally released an updated filesystem aptly named the Apple Filesystem (APFS for short). The new APFS, released with macOS High Sierra, sports improvements to encryption, file integrity and space allocation, and adds features such as cloning and snapshots.

What is a filesystem?

A filesystem is the logic an operating system uses to catalog, store, and retrieve data on a storage medium such as a disk drive.

Shrinking partition results in an error

As with any implementation of a new feature set, end users may run into unexpected quirks and incompatibilities. One such quirk I ran into was trying to resize my MacBook Air's system partition to make room for a GNU/Linux install on the same computer. I used Disk Utility to perform a partition shrink (something I've done countless of times in the past) and ran into error code 49153.

How to fix APFS partition shrink errors.

The culprit it seems are locally stored snapshots of Time Machine backups on my macOS High Sierra system partition. The fix is the following.

Backup, Backup, Backup

As always, run a Backup of your system.

Turn off Time Machine

  1. Launch System Preferences.
  2. Select Time Machine.
  3. Uncheck Backup Automatically.

Start a terminal session

  1. Launch Terminal
  2. At the command prompt enter tmutil listlocalsnapshots /. This will list the Time Machine snapshots on your partition.
  3. Next enter tmutil thinlocalsnapshots / 99999999999999. This will delete all of the snapshots. This will take a bit of time.

  4. Check that all of the snapshots are no gone with tmutil listlocalsnapshots /.

Retry your partition shrink with Disk Utility

You can now retry the changes you want to make to your partition. You can follow our Disk Utility guide if you need help or you can run diskutil form the command line if you're more comfortable with terminal and use the man diskutil command for more information.

Re-enable Time Machine

Finally, once your partition shrink has completed, turn Time Machine back on.

  1. Launch System Preferences.
  2. Select Time Machine.
  3. Check Backup Automatically.

Comments or Questions?

That about sums it up. I'm not certain if this occurs on Macs that have upgraded from HFS+ to APFS or if this also occurs on new system installs but hopefully, the need for getting into the terminal will be removed with an update to Disk Utility in the future. Do you have any comments or questions? Leave them in the comment section!

macOS High Sierra

Main

macOS Sierra