Operations 7 min read

Why MySQL Errcode 28 Happens Even With Free Disk Space—and How to Fix It

A MySQL fatal error citing Errcode 28 can stem from inode exhaustion caused by a flood of cron-generated emails, not just lack of disk space, and the article walks through diagnosing the issue with df, df -i, and locating the offending Postfix maildrop directory.

ITPUB
ITPUB
ITPUB
Why MySQL Errcode 28 Happens Even With Free Disk Space—and How to Fix It

While debugging a web page, the author encountered a fatal MySQL error: Can't create/write to file '/var/tmp/#sql_9469_0.MYI' (Errcode: 28) . The error message was clear, but the cause was not immediately obvious.

The error code 28 translates to “No space left on device”. Running perror 28 confirms this mapping.

Assuming insufficient disk space, the author checked the filesystem with df. The screenshot below shows the system partition at only 15% usage and the data partition at 25%, disproving the disk‑space hypothesis.

Further research revealed that Errcode 28 can also indicate inode exhaustion. Using df -i the author discovered that the inode count on /dev/vda1 was approaching two million, suggesting the filesystem had run out of inodes.

To locate the directory consuming the inodes, the author counted files in each directory with: find DIR_NAME -type f | wc -l The command identified /var/spool/postfix/maildrop as containing about 1.8 million files.

I had same problem but disk space was okay (only 40% full). Problem were inodes, I had too many small files and my inodes were full. You can check inode status with df -i

Postfix is a mail server; its maildrop directory stores queued email messages. The flood of files originated from the cron daemon, which sends a status email to the root user after each scheduled task. The system’s /etc/crontab listed over 30 tasks, many running frequently, generating millions of emails.

Excerpt from the crontab:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

Changing the MAILTO line to MAILTO="" stops these emails. After deleting the excess files in maildrop and disabling the cron email notifications, the MySQL Errcode 28 error disappeared.

The incident illustrates how a seemingly unrelated subsystem—cron‑generated mail—can exhaust inodes and trigger MySQL failures, highlighting the importance of holistic system monitoring during debugging.

What is Postfix? It is Wietse Venema’s mail server that started life at IBM research as an alternative to the widely‑used Sendmail program. Now at Google, Wietse continues to support Postfix
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DebugginglinuxmysqlcroninodespostfixErrcode28
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.