Sample Header Ad - 728x90

Displaying difference between APFS snapshots

11 votes
3 answers
948 views
## Problem APFS is amazing... and infuriating with its lack of tools available. What I'm trying to do is simply an equivalent of btrfs send --no-data -p /snapshots/parent /snapshots/child ## My investigation 1. Most of the google-fu returns usages of tmutil - tmutil is able to listlocalsnapshots / deletelocalsnapshots / localsnapshot (create) - tmutil compare doesn't accept 2 snapshots - tmutil compare EXISTING_SNAPSHOT returns cryptic & undocumented *Must specify a snapshot root when performing a machine comparison.* - tmutil calculatedrift doesn't seem to be related to APFS snapshots - tmutil contains some undocumented options, but nothing related to snapshots - Snapshot created by tmutil have hardcoded com.apple.TimeMachine.YYYY-MM-DD-HHMMSS.local naming format 2. diskutil contains limited snapshots support - diskutil deleteSnapshot works as intended - diskutil listSnapshots list snapshots with sizes and some metadata (unlike tmutil) - No facility for creating snapshots 3. Kernel contains fs_snapshot_* syscalls - The documentation is almost non-existent, but [a single man page is available](https://github.com/apple/darwin-xnu/blob/master/bsd/man/man2/fs_snapshot_create.2) - All usual operations (fs_snapshot_delete / fs_snapshot_list / fs_snapshot_create / fs_snapshot_mount) are supported - GitHub ahl/apfs [hosts a small utility](https://github.com/ahl/apfs/blob/master/snapUtil.c) which demonstrates the syscalls usage - fs_snapshot_list list **only** com.apple.TimeMachine.* snapshots - Any write operations (e.g. fs_snapshot_create) end up with application being killed with fs_snapshot_create: Operation not permitted (probably due to documented in the man reason: "require an additional entitlement") 4. Commercial app, Carbon Copy Cloner, is able to manipulate snapshots - For obvious reasons they don't disclose how they do that ;) ## Help? ;) Is there any method of getting a diff between two snapshots? Any documentation how they can be managed? The only naïve approach which because of speed is not feasible is running rsync between r/o mounted snapshots... but this is just stupid.
Asked by kiler129 (350 rep)
Mar 30, 2020, 02:37 AM
Last activity: Jan 8, 2025, 06:44 AM