Error
Error Code:
14
MySQL Error 14: File Size Modification Failure
Description
This error signifies that MySQL was unable to change the size of a file, such as a data file or log file, at the operating system level. It typically occurs when MySQL attempts to expand or truncate a file but is blocked by underlying OS restrictions or resource limitations.
Error Message
Can't change size of file (OS errno %d - %s)
Known Causes
4 known causesInsufficient Disk Space
The storage volume hosting MySQL data files has run out of free space, preventing files from expanding as needed.
Incorrect File Permissions
The operating system user account running MySQL lacks the necessary write permissions to modify the size of affected database files or their containing directories.
File System Corruption
Underlying file system errors, corruption, or a read-only mount state can prevent MySQL from performing file size modifications.
File Locked by External Process
Another operating system process or an explicit lock is preventing MySQL from acquiring exclusive access to modify the file's size.
Solutions
3 solutions available1. Check Disk Space and Permissions easy
Ensure sufficient disk space and correct file system permissions for MySQL data directory.
1
Verify available disk space on the partition where your MySQL data directory resides.
df -h /path/to/your/mysql/data/directory
2
Check the ownership and permissions of the MySQL data directory and its files. The `mysql` user (or the user MySQL runs as) needs write permissions.
ls -ld /path/to/your/mysql/data/directory
ls -l /path/to/your/mysql/data/directory
3
If permissions are incorrect, change them. Replace `mysql:mysql` with the correct user and group if your MySQL installation uses a different one.
sudo chown -R mysql:mysql /path/to/your/mysql/data/directory
sudo chmod -R u+w /path/to/your/mysql/data/directory
4
Restart the MySQL service to apply changes.
sudo systemctl restart mysql
2. Investigate Operating System Error Details medium
Analyze the specific OS error code and message provided in the MySQL error log for deeper insights.
1
Locate the MySQL error log file. Common locations include `/var/log/mysql/error.log` or within the MySQL data directory.
tail -f /var/log/mysql/error.log
2
Look for the specific "Can't change size of file" error message. Note the OS errno (a number) and the accompanying OS error string (e.g., 'Operation not permitted', 'No space left on device').
Example log entry:
2023-10-27T10:00:00.123456Z 12345 [ERROR] Can't change size of file (OS errno 28 - No space left on device)
3
Based on the OS error, take appropriate action. For 'No space left on device', free up disk space. For 'Operation not permitted', investigate file system restrictions (e.g., read-only mounts, SELinux/AppArmor policies).
For 'Operation not permitted' with SELinux:
sudo semanage fcontext -a -t mysqld_db_t '/path/to/your/mysql/data/directory(/.*)?'
sudo restorecon -Rv /path/to/your/mysql/data/directory
4
Restart the MySQL service after addressing the OS-level issue.
sudo systemctl restart mysql
3. Check for File System Corruption or Quotas advanced
Rule out file system issues or user/group disk quotas that might be preventing file size changes.
1
Run a file system check on the partition where the MySQL data directory resides. This is often done offline during a maintenance window.
sudo fsck /dev/sdXn (replace /dev/sdXn with your partition)
2
Check if any disk quotas are imposed on the user running the MySQL server or the directory itself.
quota -v -u mysql
3
If quotas are in place and being hit, work with your system administrator to increase them or remove them if they are not intended.
Example for increasing quota (requires root):
edquota -u mysql
4
Restart MySQL after ensuring file system integrity and adjusting quotas.
sudo systemctl restart mysql