As far as I know the only way to get a *fully consistent* backup of a xen VM is shutting down the virtual machine, creating an LVM snapshot and starting the VM again. Unfortunately the downtime is non-trivial and you need to shutdown the machine (which may not be a desired behaviour). Another alternative is saving the machine state, creating an LVM snapshot and restoring the machine. You can get a fully consistent backup saving the machine state (basically the ram dump) alongside with the disk image. Saving and restoring the vm takes a while, but if you use ramfs to store the dump you can get nearly-zero down time. Unfortunately this kind of backup is far from perfect because you will still need to restore the machine to get a consistent state and it may be non-trivial if you have to do it in another machine (for example because of a dom0 failure). I thought a third, better way which has the benefits of both previous options: - save the machine state in ramfs - create a read/*write* LVM snapshot - restore the machine state from ramfs - you have a copy of the machine state in ramfs and a vm snapshot thanks to LVM, so you can strip attached networks from the config in the head of the state dump, change the vm name and point the vm disk to the read/*write* LVM snapshot - xm restore the backup using the machine state you just edited (you can run the backup alongside with the original machine because you changed the name, stripped the networks and pointed the disk to the read/*write* snapshot) - shutdown the backup VM - do a fully consistent backup from the lvm snapshot - remove the lvm snapshot What do you think about it? Is it feasible? Cheers, Niccolò -- http://www.linuxsystems.it
On Thu, Apr 18, 2013 at 10:06:29PM +0200, Niccolò Belli wrote:> What do you think about it? Is it feasible?What is the reason to even try this stunt? Normal backup solution uses provided interfaces. For databases you want some sort of replication for backup and availability purposes and you can always shut down a replica. For application server the only things that may get lost are logs. Bastian -- You canna change the laws of physics, Captain; I've got to have thirty minutes! _______________________________________________ Xen-users mailing list Xen-users@lists.xen.org http://lists.xen.org/xen-users
Il 19/04/2013 17:24, Bastian Blank ha scritto:> What is the reason to even try this stunt? > > Normal backup solution uses provided interfaces. For databases you want > some sort of replication for backup and availability purposes and you > can always shut down a replica. For application server the only things > that may get lost are logs.Because I don't have database replication and I need a simple solution to backup every kind of vm. Except creating and shutting down a replica vm this is a widely used backup method, so why not? Niccolò -- http://www.linuxsystems.it _______________________________________________ Xen-users mailing list Xen-users@lists.xen.org http://lists.xen.org/xen-users
What about backing up os inside vm ? I use number of servers 2012 and the backup included works great I backup to samba share and I had to restore backups on few ocassions and had no problems. It was nice to boot vm from cd and restore the data. On Fri, Apr 19, 2013 at 5:53 PM, Niccolò Belli <darkbasic@linuxsystems.it>wrote:> Il 19/04/2013 17:24, Bastian Blank ha scritto: > > What is the reason to even try this stunt? >> >> Normal backup solution uses provided interfaces. For databases you want >> some sort of replication for backup and availability purposes and you >> can always shut down a replica. For application server the only things >> that may get lost are logs. >> > > Because I don''t have database replication and I need a simple solution to > backup every kind of vm. Except creating and shutting down a replica vm > this is a widely used backup method, so why not? > > Niccolò > > -- > http://www.linuxsystems.it > > > ______________________________**_________________ > Xen-users mailing list > Xen-users@lists.xen.org > http://lists.xen.org/xen-users >_______________________________________________ Xen-users mailing list Xen-users@lists.xen.org http://lists.xen.org/xen-users
Il 20/04/2013 16:16, jacek burghardt ha scritto:> What about backing up os inside vm ?You can''t backup a running database, if you don''t have database replication you need the trick I mentioned. -- http://www.linuxsystems.it
Hi, I made some tests and everything works flawlessly except the editing part. I started with the original vm shutted down, editing just the "(uname file:/srv/xen/test.img)" directive in the state file. Unfortunately if I edit such line to "(uname file:/usb1/backup/test.img)" the vm doesn''t restore anymore. # xm restore test_modified.save Error: Restore failed Usage: xm restore <CheckpointFile> [-p] Restore a domain from a saved state. -p, --paused Do not unpause domain after restoring it If I edit the state file again and I change back the path to the original one everything works flawlessly. The checksum of the state file now even matches the original one, so I didn''t make any mistake while editing the file. # md5sum test.save test_modified.save 8d3efc6b8c239d80522af3757721020c test.save 8d3efc6b8c239d80522af3757721020c test_modified.save I edit the state file such a way: head -1 test.save > test.save_firstline vi test.save_firstline head -1 test.save_firstline > test_modified.save; sed ''1d'' test.save >> test_modified.save Why does changing the path breaks the restore? Am I trying to do something unfeasible? Cheers, Niccolò -- http://www.linuxsystems.it