title: mysql select query "No Space Left On Device"
body: <p>My system is using Ubuntu with mysql database:<br>
  I have a complex mysql select query to run.  </p>
  
  <pre><code>mysql -u root -p  myDB &lt; query.sql  
  </code></pre>
  
  <p>But when I try to run it it always gives me:  </p>
  
  <blockquote>
    <p>ERROR 3 (HY000) at line 1: Error writing file
    '/mnt/disk/tmp/MY0Wy7vA' (Errcode: 28 - No space left on device)</p>
  </blockquote>
  
  <p>I have 11 GB free on disk and while the query is running, I keep track of it using  </p>
  
  <pre><code>df -h
  </code></pre>
  
  <p>and </p>
  
  <pre><code>df -hi
  </code></pre>
  
  <p>to keep track of inodes  </p>
  
  <p>and I don't see any decrease in disk space while the query is running. All the time there is always 11 GB free on disk where the tmp folder is located.   </p>
  
  <p>This is the output of <code>df -h</code>:  </p>
  
  <pre><code>ubuntu@ip-10-0-0-177:~$ df -h  
  Filesystem      Size  Used Avail Use% Mounted on  
  udev            3.9G     0  3.9G   0% /dev  
  tmpfs           799M   57M  742M   8% /run  
  /dev/xvda1       30G   24G  5.4G  82% /  
  tmpfs           3.9G     0  3.9G   0% /dev/shm  
  tmpfs           5.0M     0  5.0M   0% /run/lock  
  tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup  
  /dev/xvdf1       50G   39G   11G  80% /mnt/disk  
  tmpfs           799M     0  799M   0% /run/user/1000  
  </code></pre>
  
  <p>This is the output of <code>df -aTh</code>:  </p>
  
  <blockquote>
    <p>Filesystem     Type         Size  Used Avail Use% Mounted on<br>
    /dev/xvdf1     ext4          50G   39G   11G  80% /mnt/disk  </p>
  </blockquote>