How to Use the diskutil verifyVolume and repairVolume Commands on Mac to Fix APFS Errors

When a Mac encounters unexpected kernel panics, frozen finder operations, unmountable external drives, or failing Time Machine backups, underlying filesystem corruption is often the culprit. While the graphical Disk Utility app provides a “First Aid” button, it frequently fails with vague errors or hangs on large multi-terabyte drives. Under the hood, macOS uses the diskutil command-line utility. Using diskutil verifyVolume and diskutil repairVolume in Terminal, administrators can inspect APFS container structures, audit object maps, verify inode checksums, and repair disk corruption with verbose diagnostic logs.

Understanding APFS Volume and Container Architecture

Apple File System (APFS) organizes storage differently from legacy HFS+ volumes:

  • Physical Store: The raw hardware partition on your internal SSD or external drive (e.g., disk0s2).
  • APFS Container: A virtualization pool (e.g., disk1) that hosts multiple logical APFS volumes sharing dynamically allocated free space.
  • APFS Volume: The distinct mounted volumes within the container, such as the read-only Signed System Volume (Macintosh HD), user data (Macintosh HD - Data), Preboot, and Recovery volumes.

Identifying Your Target Disk Identifier with diskutil list

Before running verification commands, locate the exact BSD disk identifier of the volume you want to inspect:

diskutil list

Locate your target volume under the APFS Container heading. Note the identifier in the rightmost column (e.g., disk3s1 for an external SSD volume or disk1s1 for an internal volume).

Verifying File System Integrity (Non-Destructive Read-Only Audit)

To inspect a volume for errors without making any changes to the disk, run verifyVolume:

diskutil verifyVolume /Volumes/ExternalSSD

Alternatively, target the BSD identifier directly:

diskutil verifyVolume disk3s1

The command executes the underlying fsck_apfs engine in read-only mode, checking:

  • Superblock validity and container checkpoint maps.
  • Object map b-trees and reference counts.
  • Snapshots, file extent records, and directory hard links.
  • Inode encryption contexts and checksum integrity.

If the file system is healthy, the terminal outputs: File system check exit code is 0. The volume appears to be OK.

Repairing File System Corruption with repairVolume

If verifyVolume reports exit codes 1 or 8 (indicating file system damage), execute the repair sequence using repairVolume with root privileges:

sudo diskutil repairVolume disk3s1

During repair, diskutil unmounts the volume temporarily, repairs damaged object trees, rebuilds broken allocation maps, and remounts the volume clean upon completion.

Verifying and Repairing the Master APFS Container

Sometimes corruption resides not within an individual volume, but inside the container’s global space manager or checkpoint superblock. To audit and repair the entire container pool:

diskutil verifyDisk disk3
sudo diskutil repairDisk disk3

This checks the master partition table (GPT), container headers, and all child volumes in a unified pass.

Repairing the Internal Boot Volume in macOS Recovery Mode

The macOS internal boot volume contains the locked Signed System Volume (SSV) and active Data volume. Because critical system files cannot be unmounted while macOS is running live, repairVolume on your active startup drive must be performed from macOS Recovery:

  1. Shut down your Mac completely.
  2. On Apple Silicon (M1/M2/M3/M4): Press and hold the power button until “Loading startup options” appears, click Options, and select Continue.
    On Intel Macs: Turn on the Mac and immediately hold Cmd + R until the Apple logo appears.
  3. From the top menu bar in Recovery, select Utilities > Terminal.
  4. Run diskutil list to identify your internal Data volume.
  5. Execute: diskutil repairVolume disk1s2.
  6. Once the check reports exit code 0, reboot normally.

Diskutil Diagnostic Verification Reference

Command Syntax Diagnostic Purpose
diskutil list Lists all physical disks, APFS containers, and volume BSD identifiers.
diskutil verifyVolume [ID] Performs non-destructive read-only filesystem integrity audit.
sudo diskutil repairVolume [ID] Unmounts volume and repairs corrupted APFS b-trees and inodes.
diskutil verifyDisk [DiskID] Checks GUID Partition Table (GPT) and APFS container health.
sudo diskutil repairDisk [DiskID] Repairs master partition maps and storage pool structures.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.