comparison Linux & administration
Copy-on-write snapshots, reflinks and backups
Snapshots and reflinks can preserve an earlier version by sharing data blocks. Even after every block has diverged, two versions on one device are not an independent backup.
What it means
A copy-on-write snapshot or reflink can preserve an earlier version without making a backup independent of the storage device. On Btrfs, a snapshot starts with the contents of a subvolume; a reflink makes a separate file. In both cases, the two views can point to the same data blocks. You can change the active view without changing the retained one, but if both depend on one device, losing that device takes away both views.
Try it
Simulation: Start with 10 original shared blocks, 3 blocks overwritten in the active copy, and a healthy shared device. Leave the scenario evidence as provided. The two local views use 13 physical data blocks, 7 of them shared. The independent restore-tested copy is set to yes, but it is not used to calculate either block count.
Copy-on-write snapshots, reflinks and backups
Explain shared-block snapshots and why loss of the storage device still destroys copies
Snapshot retains old blocks and active view uses new blocks.
Copy-on-write
- Changed blocks3
- Independent copy evidenceNot evaluated in this branch
Physical block accounting assumes two views on one device; no deletion, reference-count updates or independent failure are simulated.
Evaluated inputs
- Required scenario evidence
- provided
- Blocks overwritten in active copy
- 3 count
- Original shared blocks
- 10 count
- Shared device
- healthy
Not evaluated: Independent restore-tested copy
One block device and two views, no metadata, RAID, dedup, actual snapshot or restore.
About this model
The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.
Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.
- Change Blocks overwritten in active copy from 3 to 10. The result is 20 physical blocks and 0 shared blocks: each of the 10 positions now has an old block and a new one.
- Keep those counts and change Shared device to
lost. Despite the lack of shared blocks, there are now 0 local views available. The result shows 1 independent copy because the scenario says it exists, not because either local view survived. - Change Independent restore-tested copy to
no. The local result stays at 0; the independent count falls to 0. If instead the facts of the scenario are unknown, set Required scenario evidence tomissing. The result is unknown, not a count of zero.
Reset returns to 10 original blocks, 3 overwritten, a healthy device, an independent copy set to yes, and evidence set to provided. This is a local example; it does not inspect storage or perform a restore.
What happens to a shared block
Consider one of the three overwritten positions in the starting example. Before the write, the active view and the snapshot both point to the same block. After the write, the active view points to a new block containing the changed data. The snapshot still points to the old one. Copy-on-write separates the contents at that position; it does not move either version to another device.
That leaves three old blocks used only by the snapshot, three new blocks used only by the active view, and seven unchanged blocks used by both. Each view can still read 10 blocks. Counting the seven shared blocks just once gives the physical total: 3 + 3 + 7 = 13.
References also explain why deleting a file from the active view need not release all its data space. Take an unchanged block with two references, one from each view. Removing the active file's reference leaves one, not zero: the retained snapshot still needs the block. This is a way to reason about deletion, not a deletion control in the simulation. The example counts data blocks only; it does not predict the free space a filesystem will report.
At the zero-change boundary both views share all ten original blocks, so the fixture counts ten physical blocks, not twenty. Losing the shared device still removes both local views. At the opposite boundary, changing all ten blocks removes the sharing but does not create an independent failure domain. The independent-copy choice is a premise about a recovery copy, not a restore test.
In practice
Choose the copy for the event you need to recover from. If the device stays healthy and you want the contents of a subvolume from before an edit, a retained snapshot can provide that view. If you want a separate file to edit while keeping the original file's contents, a reflink can do that without duplicating all its data blocks at the outset. For either choice, the relevant question is which version still references the data you need.
For device loss, ask a different question: What could you restore from if this device were unavailable? Identify where the recovery copy resides, which version it retains, and what a restore exercise actually recovered from it. Two files with different contents can still depend on the same device. Distinct contents establish that versions have diverged; separate storage and a verified restore are the evidence to look for when the device itself is at risk.
Frequently asked questions
Editorial questions based on the listed sources and explicitly labeled local examples.
Does snapshot instantly duplicate every block?
Not in the modeled copy-on-write design. Initially shared blocks can remain shared; later modifications require distinct versions and corresponding space.
Can snapshots consume space later?
Yes. A snapshot can share blocks with the live subvolume at creation. After live data changes, older blocks referenced by the retained snapshot cannot simply be reclaimed. Actual space use depends on the filesystem's allocation and other references.
Does replication count as backup automatically?
No. Replication can preserve availability while also propagating unwanted changes. Verify independent recovery points and a restore appropriate to the failure scenario.
What proves restore?
Identify the independent copy and exact retained version, then use an authorized restore exercise to check what actually comes back. The toy stipulates such a copy; it does not perform or verify a restore.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- Btrfs reflink
reflink and snapshots. Reflinks share data blocks with independent metadata; copy-on-write preserves independent file content; cross-filesystem reflink cannot share blocks.
Checked .
- Btrfs subvolumes
Subvolumes and snapshots. A Btrfs snapshot can share blocks with its live subvolume at creation. Retained references can prevent reclaim of older blocks after changes.
Checked .