User Tools

Site Tools


zfs:structure:copy-on-write_semantics

ZFS - Structure - Copy-on-Write semantics

Copy on Write (COW) is a fundamental underpinning beneath most of what makes ZFS awesome.

  • When a file is modified, the copy-on-write filesystem writes out a new version of the block that is modified, then updates the metadata of the files to unlink the old block, and link the new block just written.
  • Unlinking the old block and linking in the new is accomplished in a single operation, so it cannot be interrupted.
    • If the power went down after it happens, you have the new version of the file, and if the power went off before, then you have the old version.
    • Either way, the filesystem is consistent.

Copy-on-write in ZFS is not only at the filesystem level.

  • It is also at the disk management level.
  • This means that the RAID hole, a condition in which a stripe is only partially written before the system crashes, making the array inconsistent and corrupt after a restart, does not affect ZFS.
  • Stripe writes are atomic, the vdev is always consistent.
zfs/structure/copy-on-write_semantics.txt · Last modified: 2021/10/13 01:58 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki