SafeDisk AI

AI agent storage incident

Codex SQLite WAL Disk Full On Linux

Free checks first Ask free AI judgment

If `~/.codex/logs_2.sqlite-wal` grows to GBs or hundreds of GBs, deleting the visible WAL may not free space. Stale or suspended Codex TUI sessions can keep deleted WAL file descriptors open, so `du ~/.codex` looks small while `df -h` still says the filesystem is full.

AI storage deletion judgment

Find what the AI tool can delete.

Copy the read-only check first. If the output still needs judgment, leave your email and we send the free SafeDisk AI deletion trial step only when the agent cache or session state needs review.

Add command output optional

Free trial step. We reply first with a delete / confirm / protect judgment or one read-only detail we still need.

See sample result Ask AI about one file

What is happening

SQLite WAL files are normal, but they need checkpointing. Long-lived readers can prevent truncation. If a stale Codex process still holds a deleted `logs_2.sqlite-wal`, the directory size may look fixed while the filesystem remains full because the deleted inode is still allocated.

Safe recovery order

  1. Stop starting new Codex sessions while the filesystem is near full.
  2. Use `lsof +L1` to prove whether deleted WAL or SHM files are still open.
  3. Identify stale or suspended Codex processes with `ps`, `tmux ls`, and `fuser`.
  4. Exit stale sessions cleanly if possible; otherwise terminate only the stale PIDs that hold the deleted WAL.
  5. Run a SQLite checkpoint only after readers release the database.
  6. Re-check `df -h`, `du -xsh ~/.codex`, and `lsof +L1` before deleting anything else.
Copy-ready Linux runbook

Use this when `du` and `df` disagree.

The runbook separates visible file size from deleted-open-inode allocation, then checkpoints the WAL after stale readers are gone.

du -xsh "$HOME/.codex" 2>/dev/null
df -h "$HOME"
lsof -nP +L1 2>/dev/null | awk 'NR>1 && $7 ~ /^[0-9]+$/ && $7 > 1000000000 {print $7, $2, $1, $4, $9}' | sort -nr | head -40 | numfmt --field=1 --to=iec --suffix=B
fuser "$HOME/.codex/logs_2.sqlite" 2>/dev/null
sqlite3 "$HOME/.codex/logs_2.sqlite" "PRAGMA wal_checkpoint(TRUNCATE);"

Do Not Delete First

Free AI deletion trial

Need a delete / confirm / protect answer for AI tool files?

Submit the form first; the command output or one-line agent storage symptom can follow. We check whether free guidance is enough before asking for the free SafeDisk AI deletion trial.

Add output optional

Start with email. Output can follow after the first reply.