MySQL Error: 'Got error 28 from storage engine' — Cause, Fix, and Troubleshooting Guide
Fix MySQL 'Got error 28 from storage engine': the data disk or tmpdir is full. Free space, relocate tmpdir, and prevent recurrence.
- #mysql
- #mariadb
- #database
- #troubleshooting
Stuck on this MySQL error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
Overview
Got error 28 from storage engine means the operating system returned ENOSFC / errno 28 — “No space left on device” — to MySQL:
ERROR 1030 (HY000): Got error 28 from storage engine
Error number 28 is a raw OS errno, not a MySQL logic error. Either the data directory volume (/var/lib/mysql) is full, or — very commonly — the temporary directory (tmpdir) filled up while MySQL wrote an on-disk temp table for a big sort/join. It usually appears under load on SELECTs with large GROUP BY/ORDER BY, or on any write once the data volume is exhausted.
Symptoms
- Queries and writes fail with “error 28 from storage engine” or “No space left on device”.
- Large
SELECTs (sorts, joins,GROUP BY) fail while small ones succeed — a fulltmpdir. - The error log shows write failures;
dfshows a volume at 100%. - Replication stops because the relay log or binary log volume filled.
Common Root Causes
1. Data volume full
/var/lib/mysql (ibdata, per-table .ibd, binlogs) has consumed the disk.
df -h /var/lib/mysql
Filesystem Size Used Avail Use% Mounted on
/dev/nvme1n1 100G 100G 0G 100% /var/lib/mysql
2. tmpdir full from on-disk temp tables
A big sort/join spills to tmpdir (often /tmp, a small root partition) and exhausts it mid-query.
df -h /tmp
3. Binary/relay logs never purged
Long binlog_expire_logs_seconds or a stuck replica keeps binlogs forever until the disk fills.
4. Runaway growth — no monitoring
A large import, an unbounded log table, or a missing PURGE job silently ate the space.
How to diagnose
Find what filled up:
df -h # which mount is at 100%
du -sh /var/lib/mysql/* | sort -h | tail # biggest consumers
Check MySQL’s tmpdir and binlog settings:
SHOW VARIABLES LIKE 'tmpdir';
SHOW VARIABLES LIKE 'binlog_expire_logs_seconds';
SHOW BINARY LOGS;
Inspect the error log for the first “No space left” line to time the onset:
journalctl -u mysql --no-pager | grep -i "no space left" | head
Fixes
Free space immediately. Purge old binary logs once you confirm replicas have consumed them:
PURGE BINARY LOGS BEFORE NOW() - INTERVAL 3 DAY;
Set an expiry so they self-clean:
[mysqld]
binlog_expire_logs_seconds = 259200 # 3 days
Move tmpdir to a larger volume if temp tables are the cause:
[mysqld]
tmpdir = /var/lib/mysql-tmp
Reclaim space from a bloated InnoDB table (rebuilds and shrinks the .ibd):
OPTIMIZE TABLE big_log_table;
Then grow the volume (cloud disk resize + resize2fs/xfs_growfs) so there is durable headroom. For a full data disk where MySQL will not start, expand the volume first, then start MySQL.
What to watch out for
- Clearing space by deleting files under
/var/lib/mysqlby hand corrupts InnoDB — only usePURGE BINARY LOGS,DROP/OPTIMIZE, or grow the disk. tmpdiron a small root partition is a classic trap; give it real space or point it at the data volume.OPTIMIZE TABLE/ALTERneeds free space equal to the table size to rebuild — do not run it on a nearly full disk.- Reducing
tmp_table_size/max_heap_table_sizesends more temp tables to disk; tune queries to avoid huge sorts rather than just enlarging tmpdir. - Alert at ~80% disk on the data and tmp volumes so error 28 never surprises you.
Related
- ERROR 1114: The table is full — a related capacity ceiling (tablespace/temp-table limits).
- ERROR 1194: Table marked as crashed — a full disk mid-write is a leading cause of MyISAM corruption.
- ERROR 1040: Too many connections — another resource-exhaustion failure to distinguish under load.
Fixed it? Get 500 MySQL & DevOps AI prompts — free
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.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
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.