Make filesystem layers writable
Use real OverlayFS copy-up and whiteouts to preserve an immutable base.
Jump to code and terminal ↓An image can share its base
Copying every base file for every container wastes space. OverlayFS combines lower directories with one writable upper directory. Reads use the visible highest file; the first write to a lower file copies it up.
Deletion also needs a record
Deleting a lower file cannot remove it from an immutable layer. OverlayFS records a whiteout in the upper layer so the file is hidden in subsequent merged views. Upper and work directories must be on the same filesystem.
Your change
The launcher receives lower, upper, work, merged, and a command. Mount a private overlay, change into the merged directory, and run the command. Tests modify, add, and delete files, then remount to check persistence and untouched lower layers.
Your goal
Mount an OverlayFS view where writes and deletions affect the upper layer while lower image files remain unchanged.
What the tests observe
- Real OverlayFS mount
- Copy-up preserves lower
- New files in upper
- Whiteout survives remount
Need a nudge?
Hint 1
Use unshare -m and mount --make-rprivate / so the course mount table is unaffected.
Hint 2
mount -t overlay overlay -o lowerdir=LOWER,upperdir=UPPER,workdir=WORK MERGED creates the union.
Hint 3
Run the command after cd MERGED. Do not copy or delete lower files yourself; let the kernel do copy-up and whiteouts.
What happens inside Linux
The kernel performed copy-up and represented deletion without changing the base image. A runtime can reuse that immutable layer across many container instances and give each a separate writable upper directory.
Optional account sync. Exercises work without an account.