Keywords: MySQL Error 28 | Disk Space Exhaustion | Storage Engine Error
Abstract: This technical paper provides an in-depth examination of MySQL Error 28, covering its causes, diagnostic methods, and resolution strategies. Through systematic disk space analysis, temporary file management, and storage configuration optimization, it presents a complete troubleshooting framework with practical implementation guidance for preventing recurrence.
Error Background and Definition
MySQL Error 28, identified by the message "Got error 28 from storage engine", represents a critical storage-layer failure within the database system. This error explicitly indicates that the storage engine cannot complete the requested operation due to insufficient disk space availability. During database operations involving data writes, temporary table creation, or other disk-intensive tasks, the system triggers this error when available space falls below operational thresholds.
Diagnostic Methodology
Accurate diagnosis of disk space issues requires comprehensive system-level inspection using appropriate commands. In Linux environments, the df -h command serves as the primary diagnostic tool, displaying space utilization across all mounted filesystems in human-readable format.
The command output typically includes critical information such as:
Filesystem Size Used Avail Capacity Mounted on
/dev/vdisk 13G 13G 46M 100% /
devfs 1.0k 1.0k 0B 100% /dev
From the sample output, the root partition (/) demonstrates 100% utilization with only 46MB remaining. This extreme condition clearly explains MySQL's operational failure. Even with ample space on other partitions, exhaustion of the specific partition containing MySQL's data directory or temporary files will inevitably cause service disruption.
Solution Implementation
Addressing disk space exhaustion requires systematic remediation measures. Immediate space reclamation through unnecessary file removal includes:
Cleaning MySQL binary log files:
PURGE BINARY LOGS BEFORE NOW() - INTERVAL 7 DAY;
Removing old error logs and slow query logs:
rm /var/log/mysql/error.log.old
System temporary file cleanup:
sudo apt-get autoclean && sudo apt-get autoremove
Following emergency cleanup, restart the MySQL service:
sudo systemctl restart mysql
Prevention and Optimization Strategies
To prevent Error 28 recurrence, establish long-term storage management protocols. Begin by adjusting MySQL configuration parameters for optimal binary log management:
# Add to my.cnf configuration file
expire_logs_days = 7
max_binlog_size = 100M
Implement regular space monitoring with automated alert mechanisms. Develop scripts to periodically check disk utilization and trigger alerts when usage exceeds 85%:
#!/bin/bash
THRESHOLD=85
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
echo "Disk space alert: Utilization reached $CURRENT%" | mail -s "Space Warning" admin@example.com
fi
For long-term storage architecture planning, distribute data files, log files, and temporary files across separate physical disks or partitions. This isolation strategy effectively prevents single-partition exhaustion from impacting the entire database system.
Advanced Troubleshooting
In complex scenarios, Error 28 may persist despite df -h indicating available space. This typically results from inode exhaustion or filesystem limitations. Check inode utilization:
df -i
If inode usage approaches 100%, clean up numerous small files. Additionally, verify MySQL temporary directory permissions and available space:
ls -la /tmp/
df -h /tmp/
Through systematic space management and continuous monitoring, MySQL database stability can be ensured, preventing service interruptions caused by storage space limitations.