Why can't I just copy a .qcow2 file in KVM, while the VM is stopped, as a backup?
Hi Guys
I've got a stupid question - I've got a fully configured Centos 6-running VM running just fine inside a KVM instance inside of Centos 6. E. g. Centos-in-a-Centos. The virtual disk file is in qcow2 format and has a set size of 1 TB - due to qcow2 being sparse (right?) it is about 200 GB in actual size. It seems very complicated (and dangerous) to "snapshot" the running VM to try and make a backup of the actual physical qcow2 file. Is there any reason why I cannot just copy the qcow2 file in its entirety (while the VM is NOT running!) and move this file to a backup medium, as a backup of the entire VM? Will this file then work if the physical hardware fails and I can recreate a KVM instance, and just copy it back and start it up again? I've been googling like mad, but all suggested solutions never mention this, so I assume I'm totally ass-backward in thinking a simple "copy the dead VM's qcow2 file somewhere" will work to effectively backup the entire VM machine? Am I wrong or right as regards this? What are snapshots for then, if not to backup? Sorry, quite new to virting. Please advise. Thank you, |
several things
1. backing up a disk image will give you nothing but a disk image. You also need the VM definitions (virsh dumpxml VMNAME > backup.xml) 2. backing up the base image of a VM, while the VM runs off of a live snapshot is not very safe, if the live snapshot wasn't done during a guest's quiesce time. Restoring a VM with such an image will not be consistent, you'll end up with a VM that's in the same state as if you started a machine that had it's cable pulled out while it was working. You need to coordinate a quiesce command in the guest, with the taking of the live snapshot, and even that doesn't give 100% confidence, because you still don't have the VM's current system state. If you have the disk image and the VM definitions backed up, you can start it on any other KVM/libvirt host later on, with, maybe, some tweaks to the definition XML, if it contained anything host specific |
The copied image ought to be bootable from qemu. Try it just to see maybe.
Simple command line qemu imagename.cqow2 or qemu -hda imagename.cqow2 There are a lot of posts that more deal with live state backups. The powered off image ought to be a disk image of the virtual computer. It could in some cases be converted. It may depend on exactly what the use of this is for. Complete recover of data or just redundancy. http://www.linux-kvm.org/wiki/images...LiveBackup.pdf http://pof.eslack.org/2010/12/23/bes...tual-machines/ |
All times are GMT -5. The time now is 01:21 PM. |