Member-only story

Linux — Filesystems Copy-on-Write (CoW)

Tony
4 min readMar 4, 2024

What is CoW

Copy-on-Write (CoW) is a resource management strategy used in computing, including Linux filesystems. It optimizes memory or storage usage by sharing resources until a process or task tries to modify them. At that point, a copy of the shared resource is made so changes don’t affect the other processes using the resource.

In the context of filesystems, Copy-on-Write filesystems optimize disk space and I/O operations. When a file is copied, a CoW filesystem doesn’t immediately create a separate physical copy of the file. Instead, it allows both the original and copied files to point to the same data blocks on the disk. Only when one of the files is modified does the filesystem create a new copy of the affected blocks, leaving the unchanged blocks shared between the copies.

Here are some examples of Copy-on-Write filesystems:

  • Btrfs (B-tree filesystem): This is a modern filesystem that adopts the CoW principle. It supports a broad range of features such as pooling, snapshots, checksums, and RAID.
  • ZFS (Zettabyte filesystem): ZFS also uses CoW, and it provides features like data integrity verification, automatic repair, RAID-Z, and maximum (ZettaByte) capacity.
  • OverlayFS: It’s another type of filesystem that uses the CoW strategy, often…

--

--

Tony
Tony

No responses yet