Answer the question
In order to leave comments, you need to log in
Recommend the best option for transferring (backup)?
There is a server on Debian with a KVM virtualization system. The entire screw is organized as an LVM volume. The host system selects about 40 gigs, the virtual machines get 20 for themselves (I feel initially shushed, it could have been less, for 2 years it has never been even 10 used) gigs for the system and, if necessary, for data.
Now, according to the functionality (connections between virtual machines), it is necessary to transfer one of the virtual machines from one server to another. There are hundreds of gigs of free space on LVM on both servers, but the servers are located in different countries.
Before that, I worked with backups only under Windows with Acronis True Image. Therefore, in my vision, a normal solution is the ability to create a disk image with a virtual machine without stopping the virtual machine, which ultimately takes up no more space than the data on the disk (for example, if the disk is 20 and the data is 7 there, as a result, the backup is no more than 7 gigs for saving the channel between servers), and preferably with compression. I also want to be able to backup data from a 20 gig disk in Acronis, and restore this case on a 10 gig disk, provided that the data is less than 10 gig, similarly in the direction of increasing the restored disk.
In addition, I would be grateful for an explanation of how to transfer the virtual machine configuration between servers, so as not to raise and configure the configuration from the old server in a new place.
If there is an option with automation, it would be great, but even a manual solution will suit me perfectly.
And as an automation of raising the test environment, I would be grateful for an explanation: how to use a script in a working host system to launch the installation of a clean virtual machine with the necessary set of software in order to copy only data for further backup.
Upd1 (removed, explained that the second step is just the same snapshot). Is it possible to at least partially implement the requested through snapshots ???
Answer the question
In order to leave comments, you need to log in
one.
virsh dumpxml vm > vm.xml # получаем конфиг виртуалки
virsh define vm.xml # создаем ВМ из конфига
virsh start vm # запускаем ВМ
2.
теоретически можно так:
lvcreate -L1G -s -n vmhdd.backup /dev/VG/vmhdd # создаем снимок тома ВМ
ssh [email protected] lvcreate -L20G -n vmhdd VG # создаем том на новом сервере с размером тома оригинала
dd if=/dev/VG/vmhdd.backup | gzip | ssh [email protected] "gunzip | dd of=/dev/VG/vmhdd" # копируем содержимое тома
lvremove /dev/VG/vmhdd.backup # удаляем снимок
3. Изменить размер тома можно на новом сервере или перед копированием используя resize2fs (ext) или стандартными средствами (Windows)
-> parted -> lvresize
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question