apfs-cow-timemachine

command
v0.6.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

apfs-cow-timemachine

Zero-CGo, zero-sudo FSEvents-driven APFS Copy-on-Write time machine built with x/fswatch, x/apfs, x/compression, and x/plist.

What It Demonstrates

  • Live FSEvents Watching (x/fswatch): Monitors a workspace on a dedicated GCD serial queue with debouncing and .timemachine/ exclusion.
  • Instant APFS CoW Snapshots & Restore (x/apfs): Captures zero-copy file snapshots on save via clonefile(2) (apfs.CloneFile) and restores earlier snapshots atomically in microseconds.
  • Apple LZFSE Compressed Diffs (x/compression): Computes line diffs between successive file versions and compresses them with compression.LZFSE via libcompression.dylib.
  • Binary-Plist Manifests (x/plist): Persists and verifies snapshot metadata in Apple's compact binary property list format (plist.FormatBinary).

Usage

# Self-contained temp-workspace demo (default when -dir is omitted)
CGO_ENABLED=0 go run ./examples/kernel/apfs-cow-timemachine -demo

# Watch a live directory (writes snapshots to <dir>/.timemachine)
CGO_ENABLED=0 go run ./examples/kernel/apfs-cow-timemachine -dir ./my-workspace

Measured Output

apfs-cow-timemachine (demo workspace: /private/var/folders/kj/qbc32fzd2pv6ngnsysy8vpmw0000gn/T/apfs-cow-timemachine-612343434)
  [save #1 -> FSEvents] snap #01: size=237 KiB | clonefile= 351µs | diff=242744B -> LZFSE 378B (642.2x)
  [save #2 -> FSEvents] snap #02: size=237 KiB | clonefile= 271µs | diff=2640B -> LZFSE 388B (6.8x)
  [save #3 -> FSEvents] snap #03: size=237 KiB | clonefile= 262µs | diff=2640B -> LZFSE 388B (6.8x)
  [manifest] binary plist=746B (format=binary:true, 3 snapshots verified)
  [restore ] snap #01 restored via APFS CoW in 205µs (byte-identical to v1: true)

Documentation

Rendered for darwin/amd64

Overview

Command apfs-cow-timemachine watches a directory with macOS FSEvents and captures instant APFS clonefile(2) Copy-on-Write snapshots, Apple LZFSE compressed diffs, and a binary-plist manifest without cgo or sudo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL