On Tue, Sep 16, 2014 at 08:19:36AM +0100, Adam King wrote:
Morning,
I have a KVM guest running Win 2012 with MS SQL 2012.
In order to provide a quick method of restoring the service should the
live server die, we've decided to clone it to a preserved state.
Ideally, this clone should also be kept up to date and cloning should
be done on a regular basis.
Is there any reason not to do unattended cloning? As in, when I leave
on a Friday afternoon, start a script to clone the guest and auto
start the live guest?
I don't see why not. You can do live disk mirroring as below (untill you
issue a graceful abort) . Maybe something like below (Eric or others
will correct if I missed anything):
You can invoke a live disk backup as below, which keeps on mirroring the
disk content (untill you explicitly abort):
$ virsh blockcopy --domain f20vm vda \
/export/dst/copy1.qcow2 \
--wait --verbose \
When you want to end the mirroring above, you can issue a graceful
abort:
$ virsh blockjob --domain f20vm vda \
--abort
Then, script the `virsh` operations to create a libvirt XML and start
the new guest with the copy of the disk image (/export/dst/copy1.qcow2)
NOTE: You can also combine both the above (disk copy + abort) operations
in one command (by providing the "--finish" flag):
$ virsh blockcopy --domain f20vm vda \
/export/dst/copy1.qcow2 \
--wait --finish --verbose \
On a related note, if you want to take a live disk backup _and_ 'pivot'
your live QEMU to that copy, you can try:
$ virsh blockjob --domain f20vm vda \
/export/dst/copy1.qcow2 \
--wait --verbose --finish \
--pivot
Hope that helps a bit.
--
/kashyap