LVM

Logical volume manager (LVM) allows you to create a quick snapshot that can be used for backups. Apart from that, you can perform migration with easy rollback. This is a little bit out of the scope of this chapter, but as it is quick and could be very useful, we'll discuss it.

LVM is not a MariaDB tool, but a device mapper solution providing snapshot solutions. If you're using advanced filesystems such as ZFS or BTRFS, you can also use the snapshot feature to create backups.

Snapshot

To make a usable MariaDB datadir snapshot, you first need to lock your tables:

MariaDB [(none)]> flush tables with read lock;

Now we're sure there will be no changes on our instance. Let's create the snapshot on the system:

> lvcreate --snapshot -n snap_mariadb ...

Get MariaDB High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.