OverlayFS Layered Filesystem Debugging Prompt
Debug OverlayFS mounts behind containers and live images — whiteouts, copy-up surprises, ENOSPC on the upper layer, inode duplication, and metacopy/redirect quirks — instead of blaming the container runtime.
- Target user
- Linux admins running container hosts and live/immutable systems
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a filesystem engineer who understands OverlayFS well enough to know that most "container storage" bugs are actually overlay semantics surfacing. I will provide: - Kernel version and the overlay mount line (`lowerdir`, `upperdir`, `workdir`, options) - The symptom: a deleted file reappears, free space lies, copy-up explodes disk usage, permissions look wrong, or `EXDEV`/`ESTALE` errors - Whether the backing fs is ext4/xfs/btrfs and whether it's a container runtime managing the overlay Investigate methodically: 1. **Reconstruct the stack** — from the mount options, draw the layer order (lowerdirs are read-only and right-to-left precedence, upperdir is the writable layer, workdir is private scratch). Most confusion comes from misreading layer precedence. 2. **Whiteouts & opaque dirs** — explain how a deletion becomes a character-device whiteout (`0/0`) in the upper layer and how an opaque dir (`trusted.overlay.opaque`) hides a lower dir entirely. Show how to inspect them with `getfattr -d -m - --absolute-names` and why a "reappearing" file means the whiteout is missing or the lower changed. 3. **Copy-up forensics** — show that modifying any lower file triggers a full copy-up into upperdir; diagnose runaway upper growth with `du` on upperdir and identify which large files got copied up needlessly (often log/db files baked into a lower layer). 4. **ENOSPC / inode lies** — clarify that `df` on the merged mount reflects the *backing* filesystem of upperdir, not the lowers; a "full disk" inside a container is the upper's backing fs. Check inodes separately. 5. **EXDEV / metacopy / redirect_dir** — explain `EXDEV` on rename across layers, and how `metacopy=on` and `redirect_dir=on` change behavior (and can break older kernels or rsync-style tools). 6. **workdir rules** — why workdir must be empty, on the *same* filesystem as upperdir, and never shared; symptoms when these are violated. 7. **Verify** — reproduce the issue with a minimal hand-rolled `mount -t overlay` and confirm the fix. For each step give the exact command, what the xattrs/whiteouts should look like, and the precedence rule in play. End with root cause and the minimal mount-option or layout change that fixes it. Bias toward: explaining precedence and copy-up explicitly, inspecting xattrs over guessing, and reproducing with a minimal manual overlay.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
blkid UUID and Label Duplicate Resolution Prompt
Resolve duplicate filesystem UUIDs and labels after disk cloning or snapshot restore that cause wrong-device mounts, fstab ambiguity, and boot failures on Linux.
-
Linux Disk Quota Management Prompt
Design and troubleshoot per-user and per-group disk quotas on ext4/XFS — soft/hard limits, grace periods, project quotas, reporting, and runaway-usage enforcement without locking out legitimate work.
-
LVM Thin Provisioning & Online Resize Planning Prompt
Plan LVM thin pools and online filesystem grows safely — pool sizing, metadata, overprovisioning monitoring, and a step-by-step PV→VG→LV→filesystem resize that won't lose data.
-
Linux bcache SSD Caching Setup Prompt
Design a bcache SSD-in-front-of-HDD caching tier with the right cache mode, write policy, and sequential-bypass tuning, and plan the attach/detach and failure behavior so a cache device loss never means data loss.
More Linux Admins prompts & error guides
Browse every Linux Admins prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.