mysql 5.6 to mariadb 10.1.x centos 7.x datadir issue

jsparks

Member
Sep 16, 2015
7
0
1
Halifax
cPanel Access Level
Root Administrator
I'm looking to upgrade/switch away from MySQL 5.6 in favor of MariaDB 10.1.x however, I received the following fatal error:

As of MariaDB 10.1.16, the data directory cannot reside in /home, /usr, /etc, /boot, or /root directories on systemd equipped systems. You must move your MySQL data directory outside of these directories before continuing with this upgrade.

I understand from a bit of research that this might be related to the default SELinux permissions but not exactly sure.

My question and issue is that my sql datadir is >170gb, and I don't have another partition other than /home to move it to. Is there anyway I can work around this, perhaps a symlink??

After a couple hours of googling I've hit a wall, surely someone else has encountered this, and was able to persevere?

Thanks in advance!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Hello,

Using a data directory within /home, /usr, /etc, /boot, or /root is unsupported because of changes in MariaDB that would lead to it failing to start (MariaDB uses a default systemd unit configuration that enables the "ProtectSystem" and "ProtectHome" features). Unfortunately, the only supported workaround in your case would be to setup a new server with an updated partition scheme with enough space for your databases in /var/lib/mysql and then migrate the accounts to it via "WHM >> Transfer Tool".

Thank you.
 

jsparks

Member
Sep 16, 2015
7
0
1
Halifax
cPanel Access Level
Root Administrator
Hi Michael,

If mysql datadir is set to /home/mysql, could I just bind this to a different path via mount --bind? Optionally, I've read that setting ProtectHome=false in /usr/lib/systemd/system/mariadb.service could do the trick.

I've not tested either of these options in CPanel, but would you know if either of these methods would provide a stop-gap solution?

Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Hello,

While unsupported, setting up a bind mount to point /var/lib/mysql/ to the desired /home/ directory should allow it to work until you've had a chance to increase the size of your /var/ partition or migrate to a server with a new partition scheme.

Thank you.
 

Kurieuo

Well-Known Member
Dec 13, 2002
106
0
166
Australia
Hello,

While unsupported, setting up a bind mount to point /var/lib/mysql/ to the desired /home/ directory should allow it to work until you've had a chance to increase the size of your /var/ partition or migrate to a server with a new partition scheme.

Thank you.
I've read its good to avoid bind mounting unless necessary since it can look like just a second copy. Is there any downside to this with cPanel detecting database sizes or the like? Is there any real disadvantage to bind mounting the mysql folder?

I find myself in a similar situation where I need to move the var/lib/mysql folder (or maybe logs would be a better option for now) because I just overlooked the mysql folder in a rushed server move.
 

Kurieuo

Well-Known Member
Dec 13, 2002
106
0
166
Australia
Hi Michael,

If mysql datadir is set to /home/mysql, could I just bind this to a different path via mount --bind? Optionally, I've read that setting ProtectHome=false in /usr/lib/systemd/system/mariadb.service could do the trick.

I've not tested either of these options in CPanel, but would you know if either of these methods would provide a stop-gap solution?

Thanks
JS, how did your move go? Any issues noticed since?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Hello @Kurieuo,

The downside is that we don't test cPanel & WHM on environments where the MySQL data directory is configured as a bind mount. While I've not seen reports of any problems with this setup, it's not something we routinely test against. I recommend against setting up the bind mount for this purpose if at all possible. It's only intended as a temporary workaround until you have an opportunity to add a new mount with additional space or migrate the accounts to a server with a new partition scheme.

Thank you.