Quick answer for pros
Run redis-cli config set stop-writes-on-bgsave-error no to stop the error temporarily, but fix the real issue — usually disk space or permissions on /var/lib/redis.
Why this error happens
I've seen this error hundreds of times in production. Redis tries to save an RDB snapshot (usually every 5 minutes or when you call BGSAVE), and it fails. The default behavior is to block all writes until you fix it. This is actually good — it stops you from losing data silently. But it also locks your app.
The error message is long: MISCONF Redis is configured to save RDB snapshots, but it's currently not able to persist on disk. Common causes: disk is 100% full, Redis user can't write to the dump directory, or the file system ran out of inodes. I once saw this because someone filled /var/log with debug logs.
Fix steps
- Check disk space. Run
df -h. Look at the partition where Redis stores its dump file — usually/var/lib/redisor/data. If it's 100%, you need to free space. Delete old logs, temp files, or unused containers. - Check inodes. Run
df -i. If inodes are full (100%), you have too many tiny files. That happens with Docker overlay2 layers or mail spools. Usesudo find /var -xdev -type f | wc -lto count files, then clean up. - Check permissions. Run
ls -la /var/lib/redis. The Redis user (usuallyredis) must own the directory. If not, runsudo chown -R redis:redis /var/lib/redis. - Check the config. Open
/etc/redis/redis.conf. Look fordir /var/lib/redisand make sure the path exists. Also checkdbfilename dump.rdb— you don't need to change it unless you moved the file. - Force a save. After fixing, run
redis-cli BGSAVE. Checkredis-cli LASTSAVE— it should return a recent timestamp. Then runredis-cli config set stop-writes-on-bgsave-error noto re-enable writes if they're still blocked.
If the main fix doesn't work
Sometimes you just need to restart Redis. Run sudo systemctl restart redis or sudo service redis-server restart. That clears the error state and reloads the config.
Still stuck? Check the Redis log: sudo tail -100 /var/log/redis/redis-server.log. Look for lines like Failed opening the RDB file or Permission denied. That tells you exactly which file or directory is broken.
If you're on a cloud server with ephemeral storage (like AWS EC2 instance store), the disk might have been recreated. Move the Redis directory to a persistent volume. I've done this on EC2: sudo mkdir -p /mnt/persistent/redis, sudo chown redis:redis /mnt/persistent/redis, then update dir in redis.conf.
Prevention tip
Set up disk monitoring. On Ubuntu, install monit and watch /var/lib/redis usage. On any system, add a cron job that runs df -h /var/lib/redis and sends an alert if it's over 80%. I use this one-liner: df -h /var/lib/redis | awk 'NR==2 {if ($5+0 > 80) system("echo Disk full | mail -s alert you@example.com")}'. That saved my team twice last year.
Also set stop-writes-on-bgsave-error no in your config if you prefer to keep the app running and fix the issue later. But be warned — if you lose power before the snapshots get written, you lose data. I don't recommend this on production databases you care about.