Redis Error Guide: 'MISCONF Redis is configured to save RDB snapshots but is currently unable to persist on disk' — Fix the Failing BGSAVE
Fix MISCONF Redis is configured to save RDB snapshots but unable to persist on disk: diagnose full disk, permissions on dir, failed BGSAVE, and stop-writes-on-bgsave-error.
- #redis
- #troubleshooting
- #errors
- #persistence
Overview
Redis raises MISCONF when it is configured to take RDB snapshots (save rules are set) but the last background save (BGSAVE) failed. By default stop-writes-on-bgsave-error yes makes Redis refuse every write command after a failed snapshot, so the entire application starts failing on SET, INCR, LPUSH, etc., even though reads still work.
The literal error clients receive:
(error) MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
The message is deliberately about writes being disabled, not about a connection problem. The real fault is on the disk side: the child process that writes the .rdb file could not complete, usually because the disk is full, the dir is not writable, or fork() failed for memory reasons.
Symptoms
- All write commands return the
MISCONFerror;GET/TTLstill succeed. INFO persistenceshowsrdb_last_bgsave_status:err.- Application logs fill with write failures while Redis stays reachable.
redis-cli SET k v
(error) MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk.
redis-cli INFO persistence | grep -E 'rdb_last_bgsave_status|rdb_last_save_time|rdb_bgsave_in_progress'
rdb_bgsave_in_progress:0
rdb_last_bgsave_status:err
Common Root Causes
1. The data disk is full
BGSAVE writes a temporary file in dir and renames it. If the filesystem is full the child dies and the status flips to err.
redis-cli CONFIG GET dir
df -h "$(redis-cli --no-raw CONFIG GET dir | sed -n 2p)"
Filesystem Size Used Avail Use% Mounted on
/dev/vdb 20G 20G 0 100% /var/lib/redis
2. The dir is not writable by the redis user
A permission or ownership change (often after a restore or volume remount) means the redis process can no longer create the RDB file.
redis-cli CONFIG GET dir
ls -ld /var/lib/redis
drwxr-xr-x 2 root root 4096 Jul 3 02:10 /var/lib/redis
If the directory is owned by root and Redis runs as redis, the temp file cannot be created.
3. fork() failed (memory overcommit)
BGSAVE forks a child. If the host lacks memory and vm.overcommit_memory=0, the fork is denied and the save fails.
redis-cli INFO stats | grep -E 'rdb_.*fork|total_forks'
sysctl vm.overcommit_memory
grep -i "Can't save in background: fork" /var/log/redis/redis-server.log
vm.overcommit_memory = 0
Can't save in background: fork: Cannot allocate memory
4. Read-only or failing filesystem
A remounted-read-only filesystem or a dying disk gives EROFS/EIO on write.
grep -E 'redis|/var/lib/redis' /proc/mounts
dmesg | grep -iE 'I/O error|read-only|EXT4-fs error' | tail
Diagnostic Workflow
Step 1: Confirm the persistence status
redis-cli INFO persistence | grep -E 'rdb_last_bgsave_status|aof_last_bgrewrite_status|rdb_changes_since_last_save'
rdb_last_bgsave_status:err confirms a failed snapshot is the cause.
Step 2: Read the Redis log for the exact disk error
sudo journalctl -u redis-server --no-pager | grep -iE 'Background saving|MISCONF|fork|No space|Permission' | tail -20
sudo tail -50 /var/log/redis/redis-server.log
# Background saving error
# Write error saving DB on disk: No space left on device
Step 3: Check disk space and the target directory
DIR=$(redis-cli CONFIG GET dir | sed -n 2p)
df -h "$DIR"
ls -ld "$DIR"
sudo -u redis test -w "$DIR" && echo writable || echo NOT-writable
Step 4: Try a manual save to reproduce
redis-cli BGSAVE
redis-cli INFO persistence | grep rdb_last_bgsave_status
If it flips back to ok, the underlying disk issue is resolved.
Step 5: Ask MEMORY DOCTOR and check fork health
redis-cli MEMORY DOCTOR
redis-cli INFO memory | grep -E 'used_memory_human|maxmemory_human'
sysctl vm.overcommit_memory
Example Root Cause Analysis
At 02:11 an alert fires: the checkout service is throwing “MISCONF” on every session write. Reads are fine and Redis is reachable, so it is not a connectivity issue. INFO persistence shows rdb_last_bgsave_status:err.
The Redis log gives the exact cause:
# Background saving started by pid 8123
# Write error saving DB on disk: No space left on device
# Background saving error
df -h on the data volume confirms it is 100% full — a large dump.rdb plus rotated logs filled /var/lib/redis. The fix is to reclaim space, then trigger a clean save so writes re-enable automatically:
sudo journalctl --vacuum-size=100M
sudo rm /var/lib/redis/temp-*.rdb # leftover partial snapshots only
redis-cli BGSAVE
redis-cli INFO persistence | grep rdb_last_bgsave_status # -> ok
redis-cli SET healthcheck ok # write succeeds again
As an emergency stopgap only (not a fix) you can allow writes to resume before the disk is healthy:
redis-cli CONFIG SET stop-writes-on-bgsave-error no
But this risks accepting writes you cannot persist, so re-enable it after fixing the disk. Longer term, the volume was resized and snapshot retention capped.
Prevention Best Practices
- Alert on
rdb_last_bgsave_statusand free space on thedirfilesystem well before 100%. - Right-size the data volume: it needs headroom for a full copy-on-write RDB plus the live dataset.
- Set
vm.overcommit_memory = 1soBGSAVEfork does not fail under memory pressure. - Keep
dirowned by the redis user; verify after every restore or volume remount. - Decide deliberately between RDB, AOF (
appendonly yes), or both; do not leavesaverules configured on an instance you treat as a cache. - Keep
stop-writes-on-bgsave-error yesin production so silent data loss is impossible — treat the MISCONF error as the safety net it is. - Drop the log lines into the free incident assistant, and see more Redis guides.
Quick Command Reference
# Confirm the failed snapshot
redis-cli INFO persistence | grep -E 'rdb_last_bgsave_status|rdb_changes_since_last_save'
# Exact disk error from the log
sudo journalctl -u redis-server | grep -iE 'Background saving|No space|Permission|fork' | tail
sudo tail -50 /var/log/redis/redis-server.log
# Disk & directory checks
DIR=$(redis-cli CONFIG GET dir | sed -n 2p); df -h "$DIR"; ls -ld "$DIR"
# Reproduce and recover
redis-cli BGSAVE
redis-cli INFO persistence | grep rdb_last_bgsave_status
# Emergency only (re-enable after fixing disk)
redis-cli CONFIG SET stop-writes-on-bgsave-error no
Conclusion
MISCONF ... unable to persist on disk is Redis protecting your data: a background save failed, so stop-writes-on-bgsave-error disables writes rather than accept data it cannot durably store. The typical root causes are:
- The data disk is full.
- The
diris not writable by the redis user. fork()failed under memory pressure (vm.overcommit_memory=0).- A read-only or failing filesystem.
Always read the Redis log for the underlying disk message, fix the real disk/permission/memory problem, then run BGSAVE to confirm the status returns to ok — writes re-enable automatically once a snapshot succeeds.
Download the Free 500-Prompt DevOps AI Toolkit
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.