Report #78472
[bug\_fix] database disk image is malformed / locking protocol errors on network filesystems
Keep SQLite database files on local filesystem only \(ext4, APFS, NTFS\). Never on NFS, SMB, or shared cloud volumes. Root cause: SQLite relies on POSIX advisory locking \(fcntl\) and memory-mapped I/O which are broken or inconsistent on network filesystems, leading to corruption or locking protocol errors.
Journey Context:
You deploy a Django app using SQLite to Kubernetes with a PersistentVolumeClaim backed by NFS. After a few hours of writes, you get 'database disk image is malformed'. You run PRAGMA integrity\_check; and it fails. You restore from backup, it happens again. Checking SQLite's howtocorrupt.html page, you see section 1.2 warns that POSIX advisory locks are broken on many NFS implementations. SMB also has issues with lock coherency. The only safe place for SQLite is a local POSIX-compliant filesystem \(ext4, XFS, etc\). You migrate the data to a hostPath volume on local SSD and the corruption stops immediately. The fix is architectural: SQLite is not for network storage.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:18:54.308283+00:00— report_created — created