Warning: mysqli_query(): (HY000/1021): Disk full (/tmp/#sql-a2c-1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device") in /var/www/html/wp-includes/wp-db.php on line 2024

Warning: mysqli_query(): (HY000/1021): Disk full (/tmp/#sql-a2c-1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device") in /var/www/html/wp-includes/wp-db.php on line 2024
class="post-443576 post type-post status-publish format-standard hentry" id="post-443576">

MySQL on RAMDisk not starting

I’m trying to move all execution of the mysql program (all table data, indexes, etc) onto a RAM Disk for a performance experiment that excludes file IO from my regular SSD.

I started by installing mysql as one normally does: sudo apt install mysql-server. The mysqld program begins, and I can create DBs as normal.

I also created a RAMDisk as per the instructions listed at this site: https://www.linuxbabe.com/command-line/create-ramdisk-linux in the location /mnt/ramdisk and use a size of 25G (I have 64G of RAM available). I can write to this location and observe that my RAM begins to fill up as it should.

Now, I copied my mysql library directory to this RAMDisk using the following command:

cp -rp /var/lib/mysql /mnt/ramdisk

and symlinked to it so that I don’t have to change the datadir parameter in the /etc/mysql/mysql.conf.d/mysqld.cnf file.

mv mysql _mysql    
ln -s /mnt/ramdisk/mysql mysql

I have also changed the permissions such that MySQL “should” be able to access the RAMDisk:

root@HOSTNAME:/var/lib# ls -l | grep mysql
lrwxrwxrwx  1 mysql         mysql           19 Feb 14 16:45 mysql -> /mnt/ramdisk/mysql/
drwx------  6 mysql         mysql         4096 Feb 14 17:06 _mysql
drwx------  2 mysql         mysql         4096 Feb 14 12:14 mysql-files
drwx------  2 mysql         mysql         4096 Feb 12 17:14 mysql-keyring
drwxr-xr-x  2 root          root          4096 Jan 21 06:10 mysql-upgrade

And

root@HOSTNAME:/mnt# ls -l
total 0
drwxrwxrwt 3 mysql mysql 60 Feb 14 17:24 ramdisk

root@HOSTNAME:/mnt/ramdisk# ls -l
total 0
drwx------ 5 mysql mysql 380 Feb 14 16:41 mysql

However, when I now try to restart the mysqld program I’m met with the following error:

USER@HOSTNAME:/$ sudo /etc/init.d/mysql restart
[sudo] password for USER: 
[....] Restarting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
 failed!

Looking into both systemctl status mysql.service and journalctl -xe does not give any more insight into the problem:

USER@HOSTNAME:/$ systemctl status mysql.service
‚óŹ mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2020-02-14 17:30:55 PST; 1min 0s ago
  Process: 19794 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
  Process: 19785 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 17945 (code=exited, status=0/SUCCESS)

Feb 14 17:30:55 HOSTNAME systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Feb 14 17:30:55 HOSTNAME systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Feb 14 17:30:55 HOSTNAME systemd[1]: Stopped MySQL Community Server.
Feb 14 17:30:55 HOSTNAME systemd[1]: mysql.service: Start request repeated too quickly.
Feb 14 17:30:55 HOSTNAME systemd[1]: mysql.service: Failed with result 'exit-code'.
Feb 14 17:30:55 HOSTNAME systemd[1]: Failed to start MySQL Community Server.

And for journalctl -xe:

-- Unit mysql.service has begun starting up.
Feb 14 17:30:54 HOSTNAME audit[19792]: AVC apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/mnt/ramdisk/mysql/HOSTNAME.lower-test" pid=19792 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Feb 14 17:30:54 HOSTNAME audit[19792]: AVC apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/mnt/ramdisk/mysql/HOSTNAME.lower-test" pid=19792 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Feb 14 17:30:54 HOSTNAME audit[19792]: AVC apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/mnt/ramdisk/mysql/HOSTNAME.lower-test" pid=19792 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Feb 14 17:30:54 HOSTNAME audit[19796]: AVC apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/mnt/ramdisk/mysql/HOSTNAME.lower-test" pid=19796 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=125 ouid=125
Feb 14 17:30:54 HOSTNAME audit[19796]: AVC apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/mnt/ramdisk/mysql/HOSTNAME.lower-test" pid=19796 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=125 ouid=125
Feb 14 17:30:54 HOSTNAME audit[19796]: AVC apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/mnt/ramdisk/mysql/HOSTNAME.lower-test" pid=19796 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=125 ouid=125
Feb 14 17:30:54 HOSTNAME audit[19796]: AVC apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/mnt/ramdisk/mysql/ibdata1" pid=19796 comm="mysqld" requested_mask="wr" denied_mask="wr" fsuid=125 ouid=125
Feb 14 17:30:55 HOSTNAME mysqld[19794]: Initialization of mysqld failed: 0
Feb 14 17:30:55 HOSTNAME systemd[1]: mysql.service: Control process exited, code=exited status=1
Feb 14 17:30:55 HOSTNAME systemd[1]: mysql.service: Failed with result 'exit-code'.
Feb 14 17:30:55 HOSTNAME systemd[1]: Failed to start MySQL Community Server.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit mysql.service has failed.

Leave a Reply

Your email address will not be published. Required fields are marked *