Answer the question
In order to leave comments, you need to log in
What and how is the easiest way to automate the creation of backups of KVM machines?
There is a KVM hypervisor with 20 virtual machines. Every day you need to make full backups of some machines. While you have to manually turn off the machines using Virsh, make a backup, and then turn it on again.
Is there any tool besides bash scripts that can help implement the following script below?
1. Initiate virtual machine shutdown.
2. Make a complete copy of the virtual machine (I have them in the qcow2 format in the form of a single file, very convenient, by the way, I copied the file and you're done).
3. Turn on the virtual machine.
6. Start creating a backup of the next virtual machine (points 1 to 5).
4. Shrink the copied virtual machine (more precisely, its virtual hdd) so that the size becomes real (I do it using qemu-image).
5. Compress tar bzip.
Answer the question
In order to leave comments, you need to log in
I agree with 3ton about LVM. But doing a live backup is extreme.
You can get a half-updated database, a half-living file system, and so on. Except that you will make a copy not only of the disk but also of the memory at the time of the pause of the virtual machine.
Without access to the inside of the virtual machine, it is impossible to guarantee that all data has been flushed to the disk.
My advice - reconsider the technology of backups.
I practice the following approach:
Before updating the system on the server, I make a full backup according to the following scheme.
Look towards bdsync and bdsync-manager You
may have to finish something, but where without it
At one time (5-6 years ago) I also asked this question, it was decided to do it on LVM. Now everything is simply solved by an LVM clone and I don’t even turn off the virtual machine. I have another question for you, but how many cores do you have? If I'm not mistaken, recommendations for cores are no less than the number of virtual machines + host.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question