Load this when responding to "my drive is dying", filesystem corruption, boot configuration damage, or any destructive operation. These procedures have to be right the first time — getting them wrong destroys data.
These never bend:
fsck_apfs -y. The -y flag answers Yes to repairs, which writes back. Read-only verify (fsck_apfs -n or diskutil verifyVolume) is fine; anything that writes is not.diskutil eraseDisk or format on a drive you want data from.diskutil info SMART "Verified" when log show is full of IO errors. The log is the truth.--partial --inplace --no-whole-file --append-verify --ignore-errors to skip past unreadable sectors fast.tmutil localsnapshot / makes one in under a second.# Resumable, skips errors, preserves metadata
rsync -avh --partial --inplace --no-whole-file --append-verify --ignore-errors \
--info=progress2 \
/Volumes/Failing/important/ /Volumes/Rescue/important/
--partial — keep partially-transferred files (allows resume)--inplace — write directly to destination (don't double-buffer)--no-whole-file — block-level transfer (skip already-copied portions)--append-verify — when resuming, verify the existing portion first--ignore-errors — keep going on individual file failuresExit codes 23-24 indicate "some files failed" — expected on a failing drive. Run again later to retry just the failures.
ditto --rsrc --extattr /Volumes/Failing /Volumes/Rescue
macOS-native, preserves resource forks, xattrs, ACLs, and Finder metadata. Use for:
.fcpbundle)ditto does NOT have a resume mode like rsync, but it's a single-pass syscall-level copy that's fast on healthy data.
For drives with many bad sectors or filesystem corruption so severe rsync can't traverse the tree:
brew install gddrescue
ddrescue -n --idirect /dev/disk2 /Volumes/Rescue/disk2.img /Volumes/Rescue/disk2.map
-n = no scraping (skip retries for now)
--idirect = bypass OS cache, talk directly to device
The .map file records what's been recovered, allowing resume. After the first pass:
# Second pass: scrape bad areas more aggressively
ddrescue -r3 /dev/disk2 /Volumes/Rescue/disk2.img /Volumes/Rescue/disk2.map
Once you have the image, mount it (hdiutil attach /Volumes/Rescue/disk2.img) and extract files from the read-only mount.
diskutil verifyVolume / # Verify boot volume (read-only)
diskutil verifyDisk disk2 # Verify whole disk
fsck_apfs -n /dev/disk2s1 # Lowest-level verify (no writes)
diskutil repairVolume /Volumes/Foo # Writes to disk — only on healthy storage
fsck_apfs -y /dev/disk2s1 # Forbidden on failing drives
fsck_apfs -y requires the volume to be unmounted. The system volume can be unmounted from recoveryOS only.
repairVolume is appropriateRun it when:
If any of those preconditions fails, image first.
APFS snapshots are read-only filesystem states. Two flavors:
Created automatically when TM is enabled. Roll the boot volume back to a specific snapshot:
# List snapshots
tmutil listlocalsnapshots /
# Roll back (Apple Silicon: requires recoveryOS for boot volume)
# Intel + non-boot volumes:
diskutil apfs revert disk2s1 -toSnapshot com.apple.TimeMachine.2026-05-16-120000.local
Take a snapshot before any risky operation:
tmutil localsnapshot /
# Confirms with "Created local snapshot with date: <name>"
If the risky operation goes wrong, revert as above.
Time Machine local snapshots can consume substantial purgeable space. macOS auto-deletes them under disk pressure, but you can force:
tmutil deletelocalsnapshots <name> # specific snapshot
tmutil thinlocalsnapshots / # all eligible
Mount one Mac's drives onto another Mac to recover data:
TEither method gives you read-write access to the patient's drives without booting macOS on the patient.
Where most repair work happens:
Cmd-R at bootFrom recoveryOS you get:
fsck_apfs, diskutil, nvram)Boots with minimal kexts, no third-party LaunchAgents, runs filesystem check.
Boot with Cmd-S
Drops to a root shell before launchd starts. Almost never needed these days; Apple Silicon doesn't support it.
Shows kernel/launchd messages instead of the Apple logo:
sudo nvram boot-args="-v" # persistent until cleared
sudo nvram -d boot-args # clear
In order of safety / reversibility:
Software unmount
diskutil unmount /Volumes/Foo # one volume
diskutil eject /dev/disk2 # whole device (all volumes)
Set offline (won't remount until enabled)
diskutil disableMount /dev/disk2s1
Physical disconnect (external) — only after step 1 succeeds
BIOS / firmware disable (internal) — boot recoveryOS, then physically disconnect
Destruction — for data on a failed drive you're disposing of: see "Cryptographic erase" below
If FileVault was on, erasing the volume effectively destroys data:
diskutil apfs eraseVolume APFS Untitled /Volumes/Foo
The previous encryption key is gone, making prior data unrecoverable without it.
Reinstalling macOS over an existing install does NOT delete user data, but always have a backup.
This restores the OS files only. /Users/ is untouched. Applications need re-checking — some app helper plists may need re-registration.
storage-events.mdscripts/drive-dependencies.shscripts/recover-clone.shwindows-ops/references/recovery-patterns.md