From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Izv05-0005KN-3J for qemu-devel@nongnu.org; Wed, 05 Dec 2007 09:13:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Izv02-0005I6-DN for qemu-devel@nongnu.org; Wed, 05 Dec 2007 09:13:20 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Izv02-0005Hy-0i for qemu-devel@nongnu.org; Wed, 05 Dec 2007 09:13:18 -0500 Received: from trinity.develer.com ([89.97.188.34]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Izv01-0005i5-EV for qemu-devel@nongnu.org; Wed, 05 Dec 2007 09:13:17 -0500 Message-ID: <4756B1DD.4040009@develer.com> Date: Wed, 05 Dec 2007 15:12:45 +0100 From: Lorenzo Mancini MIME-Version: 1.0 Subject: Re: [Qemu-devel] Online image backup References: 47436778.4060806@bellard.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org > Matteo Bertini wrote: >> Hello everyone, >> >> is there any support for an online image backup? Or some direction to >> have it? >> >> Imagine I have an emulated server. How can I make an online backup of >> the server state? >> >> If I'm right in the actual design this is very hard. >> >> Or there are some image internals update rules that permit a consistent >> copy possible? > > It should not be difficult provided the VM is using the QEMU qcow2 image > format (doing a backup can be seen as a kind of snapshot). Fabrice, that's just part of the problem. A full automated remote backup service for qemu VMs should work like this: 1. send a "savevm state" command to qemu; 2. wait for savevm completion; 3. perform an *online* copy (cp, rsync, whatever) of the .qcow2 image, while it's still running in qemu; 4. ...repeat for all running VMs. Now suppose you lose the host machine and must revert to backup. A recovery scenario would be: 1. copy the .qcow2 image on the new host machine; 2. start qemu with the "-loadvm state" commandline switch. The weak spot of this configuration is the third step of backup: if you perform an online copy (and that's your only real choice, since you don't want to powerdown the VMs every night just to backup them), you are copying a file while it's always modifying, and chances are high that the copy will be corrupted (i.e. different from any state the original went through), since you can't perform the copy with a single read. However, if the .qcow2 file format is designed in such a way that even while copying it online, the resulting copy will certainly be corrupted but at least the states inside of it will be loadvm-able, that saves the day. If that's not the case, one could fallback to perform the online copy between a couple of "stop" and "cont" commands, so you're sure that the underlying .qcow2 image is frozen while you're reading it (...is it?), but again that's suboptimal since you force the VMs to be down for some time. Thanks in advance! -- Lorenzo Mancini