The Apple File System (APFS) architecture enables effortless volume management. Unlike traditional HFS+ partitioning where creating a new volume required carving out a rigid, immovable sector slice, APFS volumes share storage dynamically within a common parent container. Because creating volumes for test environments, temporary data buckets, or virtual machines is so simple, users frequently accumulate redundant volumes that need to be removed.
When you delete an APFS volume, you must ensure that its allocated blocks are returned to the container free-space pool cleanly without damaging sibling volumes or corrupting container metadata. In macOS Terminal, the diskutil apfs command provides direct, robust control to delete and re-format APFS volumes safely.
deleteVolume vs eraseVolume: Key Differences
Understanding which operation to deploy is vital before issuing terminal commands:
- deleteVolume: Completely destroys the APFS volume record and evicts the volume from the container. All physical blocks previously allocated to that volume are instantly freed and returned to the shared APFS container storage pool. The volume ceases to exist.
- eraseVolume: Formats the volume in-place, wiping all stored user data and rebuilding fresh APFS directory structures while keeping the volume container entry intact. The volume remains mounted under its original or newly specified name.
Identifying Your Target Volume Identifier
Before executing destructive volume operations, you must confirm the exact device node to prevent accidental data loss:
diskutil apfs list
Review the output to locate your target volume. Verify three critical identifiers:
- Volume Name: e.g.,
"StagingData"or"TempBackup". - Device Identifier: e.g.,
disk3s2. - Role: Ensure the volume does not possess critical system roles like
System,Data,Preboot,Recovery, orVM, which are required for macOS to boot.
Deleting an APFS Volume from a Container
To permanently delete an APFS volume and reclaim all its storage space into the shared container:
diskutil apfs deleteVolume /dev/disk3s2
Execution workflow:
diskutilunmounts the volume cleanly from the filesystem.- The kernel updates the APFS space manager (spaceman) bitmap, unmarking all allocated extents.
- The volume record is removed from the APFS container superblock.
- Terminal outputs:
Deleted APFS Volume disk3s2 on APFS Container disk3.
Erasing and Reformatting an APFS Volume In-Place
If you want to quickly wipe all files from a volume without removing its container presence:
diskutil apfs eraseVolume "CleanVolume" -format APFS /dev/disk3s2
You can also format the wiped volume as encrypted or case-sensitive by altering the format argument:
APFS: Standard case-insensitive APFS.APFS Case-sensitive: Case-sensitive APFS.APFS (Encrypted): Prompts for a passphrase and initializes hardware-accelerated encryption.
Command Reference Matrix
The table below summarizes essential commands for volume deletion and erasing:
| Command | Required Privileges | Operational Role |
|---|---|---|
diskutil apfs deleteVolume diskNsM |
Standard / Sudo | Permanently deletes the volume and returns free space to the container. |
diskutil apfs eraseVolume "Name" -format APFS diskNsM |
Standard / Sudo | Wipes all data in-place and rebuilds pristine APFS metadata. |
diskutil apfs deleteVolumeGroup diskNsM |
Administrative (sudo) | Simultaneously purges an APFS System and Data volume pair (used in macOS Recovery). |
diskutil unmountDisk force diskNsM |
Standard | Forces an active volume to unmount if background processes block deletion. |
Troubleshooting: Volume is Busy or Cannot be Unmounted
If deleteVolume fails with Error: -69888: Couldn't unmount disk, an application, background process, or QuickLook preview daemon is actively reading an open file on the volume:
- Find which process is holding an open file descriptor on the volume:
lsof | grep "/Volumes/VolumeName" - Terminate the offending process or force unmount the volume:
diskutil unmount force /dev/disk3s2 - Re-run the delete command:
diskutil apfs deleteVolume /dev/disk3s2
Frequently Asked Questions
Can I delete an APFS volume containing snapshots?
Yes. When you execute deleteVolume, all internal volume snapshots are automatically purged and reclaimed along with user files.
Can I delete the macOS System or Data volumes?
While booted into regular macOS, kernel System Integrity Protection (SIP) and Signed System Volume (SSV) locks prevent deletion of the active startup volumes. These volumes can only be modified from macOS Recovery Mode.