mysql select query "No Space Left On Device" - mysql

My system is using Ubuntu with mysql database:
I have a complex mysql select query to run.
mysql -u root -p myDB < query.sql
But when I try to run it it always gives me:
ERROR 3 (HY000) at line 1: Error writing file
'/mnt/disk/tmp/MY0Wy7vA' (Errcode: 28 - No space left on device)
I have 11 GB free on disk and while the query is running, I keep track of it using
df -h
and
df -hi
to keep track of inodes
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.
This is the output of df -h:
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
This is the output of df -aTh:
Filesystem Type Size Used Avail Use% Mounted on
/dev/xvdf1 ext4 50G 39G 11G 80% /mnt/disk

Take a look at the part of the error that indicate it’s actually writing to /tmp (see below)
: Error writing file '/mnt/disk/tmp/MY0Wy7vA
In some Linux distributions, /tmp is mounted as a tmpfs (ramdisk), so even if your disk has plenty of space you can get a "no space" error if you try to write too much there.
To investigate about the mount, try
$ cat /proc/mounts
OR
$ cat /proc/self/mounts
Or better yet
df - aTh
df -h /tmp
To see hidden ones, try
du -sc * .[^.]* | sort -n
Among other things you can try making MySQL use a different temp directory, or to not use tmpfs for /tmp
If TMPDIR is not set in my.cnf, MySQL uses the system default which is usually /tmp
You can change the MySQL tmp dir as the following suggests:
Changing the tmp folder of mysql
Credits ::
https://github.com/LogBlock/LogBlock/issues/540

Related

Lightsail Bitnami - Error establishing a database connection

I have a WordPress website hosted by AWS Lightsail.
When I access my website, I got this error - Error establishing a database connection
I didn't change anything for the last few days, and it was working okay.
Also, I have two snapshots and tried to restore the instance, but I got same error messages.
I tried to fix it by adding define('WP_ALLOW_REPAIR', true); line in my wp-config.php file, but it's not working.
I tried to access mysql on the terminal by following the command mysql -u root -p and typed password that I got from cat bitnami_application_password, but I got this error message - ERROR 2002 (HY000): Can't connect to local server through socket '/opt/bitnami/mariadb/tmp /mysql.sock' (111)
$ ps -ef | grep mysql
bitnami 3483 802 0 15:17 pts/0 00:00:00 grep mysql
If I run df -h, I got this:
Filesystem Size Used Avail Use% Mounted on
udev 989M 0 989M 0% /dev
tmpfs 200M 2.9M 197M 2% /run
/dev/xvda1 59G 8.6G 48G 16% /
tmpfs 998M 0 998M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 998M 0 998M 0% /sys/fs/cgroup
/dev/xvda15 124M 278K 124M 1% /boot/efi
tmpfs 200M 0 200M 0% /run/user/1000
If I run sudo service mysql stop, I got this error message:
Failed to stop mysql.service: Unit mysql.service not loaded.
If I run sudo /opt/bitnami/ctlscript.sh status, I got this message:
Cannot find any running daemon to contact. If it is running, make sure you are pointing to the right pid file (/var/run/gonit.pid)

Cannot access MYSQL database on AWS lightsail

I am working on a simple application using the LAMP stack using AWS/Lightsail. It worked once, but I rebooted the instance and it stopped working. The data was not available. I suspected issue with MySQL. Below is what I tried. Can anyone suggest any solution for this?
bitnami#ip-123-45-67-89:~$ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/bitnami/mysql
/tmp/mysql.sock' (2)
bitnami#ip-123-45-67-89:~$ sudo /opt/bitnami/ctlscript.sh status
Cannot find any running daemon to contact. If it is running, make sure you are pointing to
the right pid file (/var/run/gonit.pid)
bitnami#ip-123-45-67-89:~$ ps aux | grep mysql
mysql 607 0.0 6.0 1254660 29812 ? Ssl 04:11 0:11 /usr/sbin/mysqld
bitnami 3338 0.0 0.1 6076 824 pts/0 S+ 14:27 0:00 grep mysql
bitnami#ip-123-45-67-89:~$ sudo /opt/bitnami/ctlscript.sh status
Cannot find any running daemon to contact. If it is running, make sure you are pointing to
the right pid file (/var/run/gonit.pid)
bitnami#ip-123-45-67-89:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 233M 0 233M 0% /dev
tmpfs 49M 2.8M 46M 6% /run
/dev/xvda1 20G 9.5G 9.2G 51% /
tmpfs 242M 0 242M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 242M 0 242M 0% /sys/fs/cgroup
/dev/xvda15 124M 262K 124M 1% /boot/efi
tmpfs 49M 0 49M 0% /run/user/1000
bitnami#ip-123-45-67-89:~$ sudo /opt/bitnami/ctlscript.sh stop mysql
Stopped mysql
bitnami#ip-123-45-67-89:~$ sudo /opt/bitnami/ctlscript.sh start mysql
Failed to start mysql: Failed to start mysql
bitnami#ip-123-45-67-89:~$ ps aux | grep mysql
mysql 607 0.0 3.8 1254660 18912 ? Ssl 04:11 0:11 /usr/sbin/mysqld
bitnami 3560 0.0 0.1 6076 884 pts/0 S+ 14:39 0:00 grep mysql

Unable to start mysql on ubuntu

I'm trying to mysql, but I'm receiving this error:
sudo /etc/init.d/apache2 start
* Starting web server apache2 *
ubuntu#ip-172-31-19-47:/var/www/html/anunciolocal$ sudo /etc/init.d/mysql start
* /etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!
When I checked my memory:
ubuntu#ip-172-31-19-47:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 996M 12K 996M 1% /dev
tmpfs 201M 344K 200M 1% /run
/dev/xvda1 16G 15G 307M 98% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 1001M 0 1001M 0% /run/shm
none 100M 0 100M 0% /run/user
overflow 1.0M 992K 32K 97% /tmp
How do I solve it?
Try running it this way
sudo service mysql stop
sudo service mysql start
/etc/init.d/mysql: ERROR: The partition with /var/lib/mysql is too full!
this is why you cant start mysql
please clear /dev/xvda1 the disk has no enough space

How can I create a custom sized disk using LXC

Good day,
I have been looking through a lot of documentation and nothing really appears to confirm how to expand the disk size of the the LXC containers that I am spinning up..
Here is what I have tried so far,
I warn you the items below look unrelated, but confirm my thoughts that it is and should be possible to alter the disk size.
LXC how to change network adapters
I followed the document with hopes that I could modify the size of the / and judging from this question it looks like it is possible...
https://askubuntu.com/questions/779609/lxd-container-disk-and-block-i-o-limits-edit-its-a-zfs-pool-limit
I tried doing this and It does write to the config , but the configuration never takes.
lxc profile device set tuleapprofile root size 20GB
lxc launch -p tuleapprofile images:centos/6/amd64 tuleap
TULEAP PROFILE
lxc profile show tuleapprofile
config: {}
description: Default LXD profile
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr0
type: nic
root:
path: /
pool: default
size: 20GB
type: disk
name: tuleapprofile
used_by: []
df -h
8.9G 188M 8.8G 3% /
none 492K 0 492K 0% /dev
udev 3.9G 0 3.9G 0% /dev/full
udev 3.9G 0 3.9G 0% /dev/null
udev 3.9G 0 3.9G 0% /dev/random
udev 3.9G 0 3.9G 0% /dev/tty
udev 3.9G 0 3.9G 0% /dev/urandom
udev 3.9G 0 3.9G 0% /dev/zero
udev 3.9G 0 3.9G 0% /dev/fuse
udev 3.9G 0 3.9G 0% /dev/net/tun
tmpfs 100K 0 100K 0% /dev/lxd
tmpfs 100K 0 100K 0% /dev/.lxd-mounts
tmpfs 3.9G 0 3.9G 0% /dev/shm
All I want is to have / in the LXC containers be larger (by 20 G ) so I can install what I need. how can I do this. The method doesn't really matter , but I would like to have this.
Thanks

GitLab Click to deploy boot disk size

On the Gitlab Click2Deploy in Google Compute engine, there is a Boot Disk Size field that defaults to 100gb.
However df -h reveals that the boot disk is partitioned to 10gb.
Is this normal, or a bug?
[lol#gitlab-ydzp ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 10G 2.4G 7.7G 24% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.2M 1.8G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
The image used to create the boot disk has a partition size of 10G. There is another 90G available in your disk as unpartitioned space. Please follow the steps described in the link below to repartition your disk: Repartitioning a root persistent disk