Glossary
Copy-on-write
A technique where copies share the same underlying data until one of them is changed, and only the changed part is then duplicated.
Copy-on-write (CoW) is a resource management technique in which a copy shares the original’s data until one side writes to it. At that point the system duplicates only the part being changed, so the writer gets its own version and the other copy is left untouched. Copying becomes almost free at the start, and the cost is paid later, in small pieces, only for data that changes.
How copy-on-write works
A copy-on-write system tracks data through references. When you copy something, the system creates a new reference to the same blocks or memory pages and marks them as shared. Reads follow the reference as normal. A write to a shared block triggers the copy: the system allocates a new block, writes the changed data there and points the writer’s reference at it. Unchanged blocks stay shared.
The same mechanism explains why copy-on-write snapshots are fast. Taking a filesystem snapshot records the current set of block pointers instead of duplicating the data. Later writes go to new blocks, so the snapshot keeps seeing the old ones, and space is only used for what changes afterwards. That is how a filesystem can keep many snapshots of a large volume.
Where copy-on-write is used
Operating systems use it for process creation. When a Unix process calls fork, the child shares the parent’s memory pages, and a page is copied only when one of them writes to it. Filesystems such as ZFS, Btrfs and Apple’s APFS use copy-on-write for data and metadata, which is what makes their snapshots and clones close to instant.
Containers rely on it too. Image layers are read-only and shared between containers, and a container that modifies a file gets its own copy in a writable top layer. Tools for data versioning apply the idea to datasets: lakeFS, for example, creates branches that reference existing objects in object storage instead of copying them, which Exabase vs lakeFS covers.
An agent sandbox often uses the same trick to give each run its own filesystem cheaply, starting from a shared template and copying only what the run changes. Best AI agent sandboxes compares the main options.
Ways to keep earlier versions of data
Approach | How it works | Storage cost | What you can restore |
|---|---|---|---|
Full copy | Duplicates all data at copy time | The full size of every copy | Any copy, independently |
Copy-on-write | Shares data and copies blocks only when they change | Only the changed blocks | A snapshot or clone of the whole volume |
Change records | Records metadata or operations over time | Small, grows with activity | Individual items to an earlier state |
Many systems combine them. Version history per file, point-in-time recovery for databases and the choice covered in snapshot vs backup each sit at a different point on this trade-off.
Trade-offs
Copy-on-write moves cost from copy time to write time. Files rewritten in place many times, such as database files or virtual machine disks, can fragment because each change lands in a new location, and some filesystems let you turn copy-on-write off for them. Space accounting also gets harder: deleting a file may free nothing while a snapshot still references its blocks, so pruning old snapshots is part of running a copy-on-write system.
Copy-on-write and AI agents
Cheap copies make agent experiments safer. An agent can work on a clone of its agent workspace, and a person can keep the result or discard it. That pairs with checkpointing, which saves the agent’s own execution state, and with agent rollback, which restores the data it changed. Testing agents on real data without risking it covers the practical side.
How Exabase versions data
Exabase does not expose copy-on-write branches or clones of file content; its recovery features work at the metadata level. With filesystem snapshotting enabled on a Base, Exabase records each resource’s name, description, kind, icon, folder and deletion state, hourly for the last 24 hours and in six-hour windows up to seven days. File content is not captured, and notes keep their own content history through the notepad snapshot endpoints.
Snapshotting is off by default and turned on per Base with the snapshot settings endpoint; the filesystem snapshotting guide explains how to query a Base at an earlier time. Deleted resources go to the bin for 30 days, a form of soft delete. Together these support agent undo: seeing what a run moved, renamed or deleted, and recovering it. The agent context versioning use case shows the pattern, and why we built Bases as filesystems explains the structure behind it.
FAQs
What does copy-on-write mean in simple terms?
Copies share the same data until someone changes one of them. Only then is the changed part duplicated, so copying is fast and uses little extra space.
Why are copy-on-write snapshots so fast?
A snapshot records pointers to existing blocks instead of copying data. Later writes go to new blocks, so the snapshot costs almost nothing to create and grows only as data changes.
What are the downsides of copy-on-write?
Writes cost more and data can fragment, especially for files rewritten in place such as databases. Snapshots also keep old blocks alive, so deleting files may not free space until those snapshots are removed.
Is copy-on-write the same as a snapshot?
They are related. Copy-on-write is the mechanism, and a snapshot is one thing you can build with it, along with clones, forks and branches.
Which filesystems use copy-on-write?
ZFS, Btrfs and APFS are the best-known examples. ext4 and NTFS overwrite data in place by default.
Does Exabase use copy-on-write for snapshots?
Exabase does not document its storage internals. Its snapshots record resource metadata over time rather than file content, so you can see and recover what changed in a Base; the Bases page covers what is included.
Related pages: Filesystem snapshot, Data versioning, Version history, Snapshot vs backup, Soft delete, Virtual file system, Agent sandbox, Agent undo, Exabase vs lakeFS, Best AI agent sandboxes.