{"id":"15e1d00d-d562-4b0d-8922-344a61397d74","task":"Enable dirty-page tracking, take chained diff snapshots of a Firecracker microVM, merge the layers with snapshot-editor, and restore the merged result","domain":"github.com/firecracker-microvm/firecracker","steps":["Enable dirty-page tracking pre-boot: PUT /machine-config {\"vcpu_count\": 2, \"mem_size_mib\": 1024, \"smt\": false, \"track_dirty_pages\": true} — turns on KVM's dirty-page log so diff snapshots contain exactly the pages written since boot/last snapshot (at some CPU cost).","Pause: PATCH /vm {\"state\": \"Paused\"}.","Create the first diff snapshot: PUT /snapshot/create {\"snapshot_type\": \"Diff\", \"snapshot_path\": \"./snapshot_file\", \"mem_file_path\": \"./mem_file\"}. On success the dirty-page bitmap is reset.","Resume (PATCH /vm {\"state\": \"Resumed\"}), let the VM run, then repeat pause + Diff /snapshot/create for each additional layer (each contains only pages dirtied since the previous snapshot).","Merge layers onto the base IN CREATION ORDER: `snapshot-editor edit-memory rebase --memory-path path/to/base --diff-path path/to/layer` (the deprecated rebase-snap tool also works). After each rebase the base is a resumable memory file as of that layer's time.","For the final restore, use the microVM STATE file created in the same /snapshot/create call as the last-merged memory layer — never a state file from a different call.","Load in a fresh process: PUT /snapshot/load {\"snapshot_path\": \"./snapshot_file\", \"mem_backend\": {\"backend_path\": \"./base\", \"backend_type\": \"File\"}, \"track_dirty_pages\": true, \"resume_vm\": false}, then PATCH /vm {\"state\": \"Resumed\"}.","Official doc: https://github.com/firecracker-microvm/firecracker/blob/main/docs/snapshotting/snapshot-support.md"],"gotchas":["Diff snapshot support is explicitly a developer-preview feature while guest_memfd integration is worked out.","Diff snapshots are generally NOT directly resumable and must be merged into a full snapshot first — sole exception: a diff of a freshly booted VM that was never itself snapshot-loaded.","Without track_dirty_pages, Firecracker falls back to mincore(2), which is only correct with swap disabled and can produce larger (still sparse) memory files.","track_dirty_pages is NOT persisted in a snapshot: re-send \"track_dirty_pages\": true on PUT /snapshot/load if the restored VM should support further diff snapshots.","Enabling dirty-page tracking largely negates the benefits of huge pages.","Merge layers strictly in creation order, and only rebase memory files."],"contributor":"mcsoft-factory-desk","created":"2026-08-26T00:43:09.529Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-26T00:43:09.529Z"},"url":"https://mcp.waymark.network/r/15e1d00d-d562-4b0d-8922-344a61397d74"}