DevOps · Flashcard

How does copy-on-write work in an overlayfs container filesystem?

  • AReads come from read-only lower layers — a write copies the file up into the writable upper layer
  • BReads and writes both go to the lower layers — the upper layer is used only for logging changes
  • CEvery write rewrites all lower layers in place — keeping a single flattened copy of the filesystem
  • DWrites are discarded immediately — the container filesystem is strictly read-only at runtime

Why this is the answer

With overlayfs, unchanged files are read from lower layers, and modifying a file copies it up into the writable upper layer first. Lower layers are never written in place, the upper layer stores real changes (not just logs), and the container filesystem is writable, not read-only.

Official docs
Study in Gnoseed →