大网数据广告活动
服务器运维问答

mysqldump using a lot of space

· 52CE 我爱测

I have a server and the / partition is 20GB in size. Databases are stored in /mnt/mysql-data partition is 500GB in size. Now here's the problem. Whenever I run mysqldump it fills up / partition to 100%. I have already moved the t…

问题原文

原帖链接 · Christian Noel · CC BY-SA 4.0

I have a server and the / partition is 20GB in size.

Databases are stored in /mnt/mysql-data partition is 500GB in size.

Now here's the problem. Whenever I run mysqldump it fills up / partition to 100%. I have already moved the tmpdir to /mnt/mysql-data/tmp. My databases are around 40GB all in-all now I want to back them up in /mnt/mysql-data/backups but I can't proceed because the / partition fills up to 100%. my mysqldump command is: mysqldump --all-databases > /mnt/s3share/backup.sql";

Server Details:

  • 10.2.22-MariaDB-log MariaDB Server

  • CentOS Linux release 7.7.1908 (Core)

Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.8G     0  7.8G   0% /dev
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           7.8G  217M  7.6G   3% /run
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/xvda2       24G  2.4G   20G  11% /
/dev/xvda1      976M  168M  757M  19% /boot
tmpfs           1.6G     0  1.6G   0% /run/user/1000
/dev/xvdc1      500G  123G  378G  25% /mnt/mysql-data
tmpfs           1.6G     0  1.6G   0% /run/user/1001
MariaDB [db_inbox]> show global variables like "%tmp%";
+----------------------------+----------------------+  
| Variable_name              | Value                |  
+----------------------------+----------------------+  
| default_tmp_storage_engine |                      |  
| encrypt_tmp_disk_tables    | OFF                  |  
| encrypt_tmp_files          | OFF                  |  
| innodb_tmpdir              |                      |  
| max_tmp_tables             | 32                   |  
| slave_load_tmpdir          | /mnt/mysql-data/tmp  |  
| tmp_disk_table_size        | 18446744073709551615 |  
| tmp_memory_table_size      | 16777216             |  
| tmp_table_size             | 16777216             |  
| tmpdir                     | /mnt/mysql-data/tmp  |  
+----------------------------+----------------------+  
10 rows in set (0.00 sec)                              

update #1:

I forgot to mention that the *.sql backups are being written to /mnt/s3share/backups/ folder which is mounted as s3fs and its cache must be writing to /tmp and that may be a reason why / is being filled up while the sql dump is being created. However, when I run the backup and watch /tmp for changes, it doesn't show any growth. but when I do lsof command on /tmp I can see huge files being deleted. Could this be it?

已采纳解答

原帖链接 · Christian Noel · CC BY-SA 4.0

OK, I was able to solve this problem by moving the s3bucket cache dir from /tmp to /mnt/mysql-data/tmp.

Little did I know that fuse.s3fs was writing to /tmp and there's no way to track which file is growing using du -h /tmp

the code I was running was mysqldump --all-databases > /mnt/s3share/backup.sql where s3share is mounted using fuse.s3fs and has a cache directory targetting /tmp. this is why i thought mysqldump was causing all the growing storage use on root /.

after changing the cache dir of fuse.s3fs to /mnt/mysql-data/tmp, the problem was solved.

this was my mount command before /tmp:

datastore /mnt/s3share fuse _netdev,allow_other,use_cache=/tmp,passwd_file=$PASSWDFILE 0 0

then this is the new mount command /mnt/mysql-data/tmp:

datastore /mnt/s3share fuse _netdev,allow_other,use_cache=/mnt/mysql-data/tmp,passwd_file=$PASSWDFILE 0 0

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-04-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。