hi all,
just want to know how you all clone your VMs on linux KVM as i have done it this way and it works
all my vm file(s) are stored on my KVM server here -
/home/KVM/script.qcow2
i have only one vm atm but you get the jist, there all in /home/KVM
i have noticed in virt-manager if you right click on your vm and select clone it says it must be paused or switched off ie you cant do hot backups, just cold
i have created a samba share on my KVM server so i can access it from other machines, so i can save the files somewhere else for safe keeping, location /home/files/
cp -f /home/KVM/script.qcow2 /home/files/
[root@kvm ~]# rm -f /home/KVM/script.qcow2
[root@kvm ~]# cp -f /home/files/script.qcow2 /home/KVM/
once i have done this, i made a new vm from my clone, added the same network to it and i can succesfully log in and access the apache server on it
just wondered how you guys do it
rob
6 Spice ups
I honestly have never been in this situation, but I would just use clonezilla
Exposing you vm images with samba is a very bad idea, it would be better to send the image to a samba share but keep the production one in a safe place (not shared).
Best way to have an hot backup would be to use a filesystem that supports snapshot of the volume and place vms in that mount point.
Then you can call a FS snapshot while VM is running.
The cold backup is a good idea always if you can afford some downtime.
I’ll suggest to use rsync instead of cp to move only the block delta instead if the whole file.
I personally use NodeWeaver on all my infrastructures to provide virtualization infrastructure with integrated DR tools.
It’s software only (runs on your hardware), hyperconverged (scales seamlessly from 1 to 25 nodes), distributed file system with snapshots and DR tools on board (no raid needed), self managed and self healing (autonomic engine takes care of all kind of failures) .
Oh yes… And it takes 5 minutes to setup: flash the image, boot, set management ip.
You can request a trial here: https://my.nodeweaver.eu/content/download-wizard-11
johnhooks
(johnhooks)
5
Being the one who posted the first one, I would completely ignore it. I wrote a better one using libvirt here KVM Snapshot/Backup Script | MangoLassi
For cloning what you should do is create your template and sysprep it (virt-sysprep). It has a ton of options so look through them. Leave the template off and then you can clone the template. One thing extra that I do is use virt-customize to update the template nightly. It spins up a temp VM, attaches the template disk, updates the template, relabels SELinux, and shuts it down. This way the template is always up to date and it’s automatic.
2 Spice ups
you can do snapshots with LVM (it caches writes to a temp partition) to an active filesystem (its how I created hourly images of a samba share) but I don’t know how that would affect journaling or system file integrity of your VM (it shouldn’t but I’m not positive)