2020/07/03

Livemount MySQL with Data Integration API

New in v10 is that you can mount disk via iSCSI to any other machines. In the lab, I was recently playing with MySQL and wondered if I could live mount it's backup to another server. It, turns out, you can. So what are the use-case? Well you could test if the databases are mountable without having the spin up a lab. You could allow your devs to access real production data without accessing the production servers. But of course, feel free to find other use cases 😏

To get started, you need another machine where you have MySQL installed. So this is a plain Ubuntu server with ssh + MySQL installed as a target for live mount. You can see that I'm missing my production martini database


The next step is to publish the your restore point that you backed up. You can find a sample in the documentation .




Ok with that done, we can go to the Linux Machine. You do need to install the open-iscsi tools


Once that is done, you can mount the iscsi volume. For this you need two commands




Here is a screenshot of the discovery process (finding the volumes) and the mounting. By doing an fdisk -l before and after, you can see that /dev/sdb is showing up. The most important part(ion) is of course /dev/sdb2. I also included a logout to show that it is going away but of course at this point, you only need to do the login part


Now let's mount /dev/sdb2. For this, we make a temporary directory under /mnt and mount /dev/sdb2



At this point you want to stop the mysql database, mount the mysql database file directory to the correct location and restart the DB. I did have to correct the permissions so that the directory and all its files are owned by mysql after the mount




And there you have it, martini database is back

Once you are done, you need to clean up stuff



At this point, you can unpublish the session.


And voila, everything is cleaned up.

You can also automate the whole process, check the complete code on VeeamHUB