You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker容器报error 28 from storage engine错误,磁盘有剩余空间如何解决?

Fixing MySQL Error 1030 (Error 28 from Storage Engine) When Docker Container Runs Out of Space

Hey there, let's break down this issue and work through fixes step by step. First off, that ERROR 1030 Got error 28 from storage engine is definitely a disk space error—but it's not your host's overall free space that's the problem, it's the filesystem your Docker containers are using that's completely full.

Why this happens even with 40GB free on your host

Looking at your df -h output from the Apache container:

Filesystem Size Used Avail Use% Mounted on
none 60G 57G 0 100% /
tmpfs 64M 0 64M 0% /dev
tmpfs 1000M 0 1000M 0% /sys/fs/cgroup
/dev/vda2 60G 57G 0 100% /var/www
shm 64M 0 64M 0% /dev/shm
osxfs 465G 425G 41G 92% /etc/apache2/sites-available/000-default.conf
tmpfs 1000M 0 1000M 0% /sys/firmware

Your container's root filesystem (/) and the /var/www mount (backed by the host's /dev/vda2 partition) are both at 100% usage. The 40GB free you see is on the osxfs partition, which your containers aren't using for core storage like database data or web app files.

Step-by-step fixes

1. Clean up space inside the affected containers

First, jump into your Apache or database container to clear out unnecessary files:

  • Enter the container: docker exec -it <container_name> bash (replace <container_name> with db_1 or your Apache container's name)
  • Clear old log files (safe to truncate or delete):
    # Truncate all log files to zero size (keeps the files, clears content)
    find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
    # Or delete old rotated logs (like .log.1, .log.2.gz)
    find /var/log -type f -name "*.log.*" -exec rm {} \;
    
  • Delete temporary files in /tmp:
    rm -rf /tmp/*
    
  • If /var/www has old backups, unused assets, or outdated project files, move them to the host's osxfs partition (since it has free space) or delete them entirely.

2. Clean up Docker's unused resources on the host

Your host might have leftover Docker images, containers, or volumes taking up space on the /dev/vda2 partition. Run these commands on your host machine:

  • Check Docker's space usage to see where the bloat is:
    docker system df
    
  • Delete stopped containers:
    docker rm $(docker ps -aq -f status=exited)
    
  • Delete dangling (unused) images:
    docker rmi $(docker images -aq -f dangling=true)
    
  • Prune unused volumes (warning: this deletes volumes not attached to any container—make sure you've backed up important data first):
    docker volume prune
    

3. Move container data to a partition with free space

If /dev/vda2 is consistently filling up, migrate your container's data to the roomy osxfs partition:

  1. Stop your containers: docker-compose stop (if using Docker Compose)
  2. Copy the contents of /var/www (or your database's data directory) from /dev/vda2 to a directory on osxfs (e.g., /mnt/osxfs/www-data)
  3. Update your docker-compose.yml (or run command) to mount the new directory instead of the old one. For example:
    services:
      apache:
        volumes:
          - /mnt/osxfs/www-data:/var/www
      db:
        volumes:
          - /mnt/osxfs/db-data:/var/lib/mysql
    
  4. Restart your containers: docker-compose up -d

4. Clean up MySQL-specific data (for the db_1 container)

If the database itself is filling the partition:

  • Enter the db_1 container's MySQL shell: docker exec -it db_1 mysql -u root -p
  • Purge old binary logs (if you don't need them for replication or point-in-time recovery):
    PURGE BINARY LOGS BEFORE '2024-01-01 00:00:00'; -- Replace with a date before your oldest needed log
    
  • Delete old database backups stored inside the container, or move them to the host's free partition.

内容的提问来源于stack exchange,提问作者Torben

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:53:48