LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 11-03-2012, 06:11 AM   #1
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
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,
 
Old 11-03-2012, 07:38 AM   #2
dyasny
Member
 
Registered: Dec 2007
Location: Canada
Distribution: RHEL,Fedora
Posts: 995

Rep: Reputation: 115Reputation: 115
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
 
Old 11-05-2012, 02:32 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
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/
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kvm-qemu-img: qcow2 disk image format changes to raw format in RHEL-KVM 5.6 rajivdp Linux - Virtualization and Cloud 2 09-19-2011 11:23 AM
KVM disk formats - difference between qcow2 and raw slacky Linux - Virtualization and Cloud 3 09-16-2011 01:27 PM
How to resize the qcow2 image in the KVM? rajivdp Linux - Virtualization and Cloud 1 03-23-2011 05:36 PM
How to resize the qcow2 image in the KVM? rajivdp Linux - Virtualization and Cloud 2 03-23-2011 12:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 08:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration