0

I'm using symlinks to move some MySQL databases to another device with more space. All works fine until one of those DBs gets dropped and then re-created: the symlink is deleted in the process of dropping the database. And then a regular directory is created in place of the symlink, so the db end up on the "wrong" device.

I have also tried mounting a device on the path where the symlink would be, but then MySQL complains when dropping the database:

ERROR 1010 (HY000) at line 1: Error dropping database (can't rmdir './my_db', errno: 16 "Device or resource busy")

Is there a way to have my cake and eat it too? I.e. to move the database to another device and also have it there in case it gets deleted and re-created?

Using MariaDB 10.0.34 on Ubuntu 16.04

frnhr
  • 125
  • 7
  • 1
    Look at the `DATA DIRECTORY` option for `CREATE TABLE` in https://dev.mysql.com/doc/refman/5.7/en/create-table.html. "For InnoDB, the DATA DIRECTORY='directory' option allows you to create InnoDB file-per-table tablespaces outside the MySQL data directory." – ceejayoz Mar 12 '18 at 18:15
  • How can this help? ^ Looks like I would have to alter the software that creates those DBs. – frnhr Mar 13 '18 at 18:11

0 Answers0