Skip to main content
Question

Migrating mysql database to an expansion drive on RHEL 7

  • February 12, 2020
  • 1 reply
  • 12 views

Forum|alt.badge.img+4

Good day. Anyone out there have a JSS hosted on Red Hat 7 that has successfully moved the database from the OS drive to an added VMware expansion drive? The /dev/mapper/rhel-root keeps filing up since the database was installed on the root partition (only 90 gigs). I'm on 10.17.

Since the /dev/mapper/rhel-root is only allocated 11 gigs and cant be expanded, it runs out of space quickly. If I try to upload a package file in JSS, it will fail once it becomes full. I've added an expansion drive and would like to move the mysql database to it. I've tried following guides like https://www.digitalocean.com/community/tutorials/how-to-change-a-mysql-data-directory-to-a-new-location-on-centos-7 but every time the database fails to start up after moving. If someone has done this, PLEASE let me know the process. Thanks!

1 reply

Forum|alt.badge.img+4
  • Author
  • Contributor
  • February 12, 2020

Self resolved. I had to point SELinux to the new db location and the db started right up. Below is what I was missing.

semanage fcontext -a -t mysqld_db_t "/path/to/my/custom/datadir(/.*)?"

restorecon -Rv /path/to/my/custom/datadir