I moved my data directory to another location. It works if this is on the same disk, just at a different location (i.e., moved /var/lib/mysql/ and edited the datadir entry in the server.cnf).
However, when the data directory is on a mounted drive it does not work well. It generally works, but when the system boots, MariaDB times out.
I changed the systemd service for mariadb to ensure that mounting took place: I added RequiresMountsFor=/mnt/foo. I can see by the timestamps that the service is started as soon as the disk is mounted. Starting MariaDB works occasionally, but most times mariadb times out:
Dec 11 10:41:59 rpi systemd[1]: Mounted /mnt/foo.
|
...
|
Dec 11 10:41:59 rpi systemd[1]: Starting MariaDB 10.3.17 database server...
|
Dec 11 10:41:59 rpi mysqld[962]: 2019-12-11 10:41:59 0 [Note] /usr/sbin/mysqld (mysqld 10.3.17-MariaDB-0+deb10u1) starting as process 962 ...
|
Dec 11 10:43:29 rpi systemd[1]: mariadb.service: Start operation timed out. Terminating.
|
Dec 11 10:43:32 rpi systemd[1]: mariadb.service: Failed with result 'timeout'.
|
Dec 11 10:43:32 rpi systemd[1]: Failed to start MariaDB 10.3.17 database server.
|
Starting it manually after works fine.