MySQL container in LXC can't use O_DIRECT in PVE9

patrickli

Member
Oct 24, 2022
11
0
6
Upgraded to PVE9 and noticed a MySQL docker container running in LXC (yes I know it is not recommended but I've been running this for a few years without issues) was spewing out errors like the following:

Code:
InnoDB: IO Error: 22 during write of 5632 bytes, for file ./db/table.ibd(16), returned 0

Scratched my head for a few hours and tried running different guest OSes (alpine, debian) but all had the same issue.

Since it is definitely disk/io related I started to change some MySQL IO settings. The one that fixed the problem is innodb_flush_method. I've always been using the default which is O_DIRECT. Changing this to fsync fixed the problem. This works but obviously not optimal.

Maybe someone can shed some light into why this would happen.