FSCK_APFS(8) System Manager's Manual FSCK_APFS(8)

fsck_apfsAPFS consistency check

fsck_apfs [-n | -y] [-q] [-l] [-s] [-S] [-o] [-b num] [-c] [-C] [-d] [-E path] [-F | -M] [-g | -x] [-W] [-T] [-D] device

The fsck_apfs utility verifies and repairs APFS containers and volumes.

fsck_apfs checks the specified APFS containers and volumes and tries to repair all detected inconsistencies.

Because of inconsistencies between the block device and the buffer cache, the raw device should always be used.

In its current state, fsck_apfs checks the integrity of various container data structures.

The options are as follows:

Causes fsck_apfs to quickly check whether the device is `clean'. If device is an APFS volume, fsck_apfs will quickly check the APFS container and the specified APFS volume. If device is an APFS container, fsck_apfs will quickly check the APFS container and all the APFS volumes in it. By default, no repairs are attempted during a quick check.
Never attempt to repair any damage that is found.
Always attempt to repair any damage that is found.
Enable live verification mode. This makes it possible to check an APFS container which is currently mounted read-write, although no repairs can be made. Note that live verification mode may cause your system to stop responding until fsck_apfs completes.
Print space verification summary.
Skip iteration of snapshots (top-level snapshot structures will still be checked), although no repairs can be made.
Repair overallocations; please do not run an older fsck_apfs on newer systems with this option.
<num>
Set the default cache block size to num KB.
Enable the gathering and printing of cache statistics.
Force a sync of the container prior to freezing it in live verification mode.
Print extra debugging information.
<path>
Write warning and error summary information to path in addition to the standard location (/var/log/fsck_apfs_error.log). Pass - to write it to stdout.
Force checking of encrypted volumes, requiring the volumes to be unlocked.
Skip checks requiring decryption of volume data. Unencrypted volume metadata is still checked.
Use "GUI" mode for the output. Output is in a form suitable for parsing by other programs.
Output will be in XML.
Treat warnings as fatal. By default, fsck_apfs will exit with a return code of 0 if there are warnings but no errors. This option will cause it to exit with an appropriate error code in that situation.
Enable B-Tree node repairs. Only used when repairing so either -y must be present, or both -n and -q must be absent.
When doing B-Tree node repairs, allow searching free blocks for candidate nodes. This requires the -T option as well.

fsck_apfs exits with 0 on success, and >0 if error occurs.

fsck(8)

May 6, 2023 Mac OS X