-4

The disk is full and my query hangs on the mysql query.

From the mysql manual:

When a disk-full condition occurs, MySQL does the following:

It checks once every minute to see whether there is enough space to write the current row. If there is enough space, it continues as if nothing had happened.

Every 10 minutes it writes an entry to the log file, warning about the disk-full condition.

Is there any option to change the behavior? I need it return if it finds the disk is full.

1
  • 6
    You should monitor your disk space usage using a dedicated monitoring tool and correct the problem when it occurs. Analyse what is causing this space overload and solve it.
    – krisFR
    Commented Mar 17, 2015 at 13:05

2 Answers 2

2

There is no such option in Mysql.

If Mysql needs to write to disk and has no space available it cannot write anything, that's it.

If you have disk space issues, your best bet would be to monitor your disk space usage using a dedicated monitoring tool. When an alert is raised, solve it before it affects Mysql functionnalities.

Try to identify what is causing this space overload and solve it. At very least, consider adding more disk.

A disk full problem is never what a system admin (nor DBA) wants !

1

As already mentioned you never want to let your disk get full. Assuming you're on a Linux-based system and this is an issue you could setup a cron-job to check your disk space usage and email it to you at a set interval.

#!/bin/sh
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
  echo $output
  usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
  partition=$(echo $output | awk '{ print $2 }' )
  if [ $usep -ge 90 ]; then
    echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
     mail -s "Alert: Almost out of disk space $usep%" [email protected]
  fi
done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .