- This is not an ideal solution at all, but I had to go through this since a standard path to change the data folder of MariaDB failed on me.
- This instruction is a follow-up on How to set up a VM that has a local copy of Wikipedia and How to increase a VM's disk space, and thus, this will not help other situations.
- You will remove mariadb and mariadb-server from the VM first
- You will remove mariadb related files such as
/etc/my.cnf
and/var/lib/mysql
- You will change the mounting point of a new partition to
/var/lib/mysql
- You will run
mysql_secure_installation
and the rest of commands again from How to set up a VM that has a local copy of Wikipedia
- Remove mariadb and mariadb-server from VM
[vagrant@localhost ~]$ sudo systemctl stop mariadb
[vagrant@localhost ~]$ sudo yum remove mariadb mariadb-server
[vagrant@localhost ~]$ sudo rm /etc/my.cnf
[vagrant@localhost ~]$ sudo rm -rf /var/lib/mysql
- Unmount the new partition and remount as
/var/lib/mysql
[vagrant@localhost ~]$ sudo umount /dev/sda2
[vagrant@localhost ~]$ sudo vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sat Jun 1 17:13:31 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=8ac075e3-1124-4bb6-bef7-a6811bf8b870 / xfs defaults 0 0
UUID=547a98b3-59a1-4748-90ac-fba19cd6524c /var/lib/mysql xfs defaults 0 0
/swapfile none swap defaults 0 0
[vagrant@localhost ~]$ sudo mkdir /var/lib/mysql
[vagrant@localhost ~]$ sudo mount -a
[vagrant@localhost ~]$ df -H
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 43G 7.5G 36G 18% /
devtmpfs 4.1G 0 4.1G 0% /dev
tmpfs 4.2G 0 4.2G 0% /dev/shm
tmpfs 4.2G 9.0M 4.1G 1% /run
tmpfs 4.2G 0 4.2G 0% /sys/fs/cgroup
tmpfs 821M 0 821M 0% /run/user/1000
/dev/sda2 226G 74M 226G 1% /var/lib/mysql
Now you have >200GB of space for MariaDB.
[vagrant@localhost ~]$ sudo yum install -y mariadb mariadb-server
[vagrant@localhost ~]$ sudo systemctl enable mariadb
[vagrant@localhost ~]$ sudo systemctl start mariadb
[vagrant@localhost ~]$ sudo mysql_secure_installation
Then, follow the instruction from How to set up a VM that has a local copy of Wikipedia for the rest of the process.