Mariadb – How to repair a large theisam database when diskspace is low

disk-spacemariadbmyisam

MariaDB 10 | CentOS 5.x

I have a large myisam database with some tables that are marked as crashed. The collective size in /var/lib/mysql/fooDatabase/ is 17 GB. I have 4 GB of space left.

Initially, I tried running mysqlcheck --verbose --auto-repair fooDatabase but that failed and in logs I see:

[Warning] mysqld: Disk is full writing '.fooDatabase/foo_TABLE.TMD' (Errcode:28 "No space left on device"_. Waiting for someone to free space...)

I restarted mariadb and reclaimed the disk space but I'm back to square one here.

I'm now running repair table foo_TABLE; but I'm not sure if I'll experience the same problem or not.

At this point, I've squeezed as much free disk space out of the system as I can. Are there any other options? Are there any repair operations that are more sparing with temporary disk space? Any other options?

Best Answer

You don't have many options here.

Since you're running MyISAM storage engine, you may try to snapshot your files, e.g. with mysqlhotcopy, repair the snapshot on another host with much more space, then copy the repaired data files back to the original host.