Software⏱️ 3 min read📅 2026-06-15

How to Fix: APFS undeclared deleted space and underallocation error

APFS undeclared deleted space and underallocation error fix

Quick Answer: Try running the 'fsck_apfs' command in Terminal to repair APFS file system.

The APFS (Apple File System) undeclared deleted space and underallocation error is a common issue affecting macOS users who have upgraded to 10.13 or later. This error occurs when the system fails to properly free up disk space after deleting files, resulting in an underallocation of the device's capacity.

This problem can be frustrating for users like you who rely on their main machine and cannot afford to format back to HFS+. In this guide, we'll walk you through the root causes and provide two methods to fix this issue.

🔍 Why This Happens

  • The primary reason for this error is that APFS uses a feature called 'sparse allocation' which can lead to underallocation issues. When files are deleted from an APFS volume, the system does not immediately free up the space allocated to those files. Instead, it waits for the next time the file is accessed or modified, at which point the system will attempt to reclaim the space.
  • Another possible cause is that the system's disk cache may be causing issues. When files are deleted from an APFS volume, they may not be immediately removed from the cache, leading to underallocation errors.

🔧 Proven Troubleshooting Steps

Reclaiming Space Using Disk Utility

  1. Step 1: Open Disk Utility and select the main device that's showing the underallocation error. Click on 'First Aid' in the top menu bar.
  2. Step 2: Click on 'Scan Disk' to start the scan process. This may take several minutes depending on the size of your hard drive.
  3. Step 3: Once the scan is complete, click on 'Repair' and follow the prompts to repair any disk errors.

Using fsck_apfs to Reclaim Space

  1. Step 1: Open Terminal and type `sudo fsck_apfs -f /dev/disk0s3` (replace `/dev/disk0s3` with the actual device name of your main drive). Press enter to run the command.
  2. Step 2: Once the command is executed, you may need to manually repair any errors that were found. Type `sudo fsck_apfs -r` to start the repair process and follow the prompts.

🎯 Final Words

Fixing the APFS undeclared deleted space and underallocation error requires patience and persistence. By following these steps, you should be able to reclaim the lost space and resolve this issue. If you're not comfortable with these methods or if the problem persists after trying them, it may be worth considering formatting back to HFS+ as a last resort.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions