Changes

Jump to: navigation, search

stoney conductor: VM Backup

224 bytes added, 13:09, 22 October 2013
/* Snapshot */
#* '''Please note:''' The retain directory (<code>/path/to/retain/</code>) '''has to be''' on the same partition as the images directory (<code>/path/to/images/</code>). This will make the <code>mv</code> operation very fast (only renaming the inode). So the downtime (remember the VM <code>vm-001</code> is shut down) is as short as possible.
# Create the new (empty) disk image with the old as backing store file: <syntaxhighlight lang="bash">qemu-img create -f qcow2 -b /path/to/retain/vm-001.qcow2 /path/to/images/vm-001.qcow2</syntaxhighlight>
#* <syntaxhighlight lang="bash">chmod 660 /path/to/images/vm-001.qcow2</syntaxhighlight>
# Set correct ownership and permission to the newly created image:
#* <syntaxhighlight lang="bash">chown root:vm-storage /path/to/images/vm-001.qcow2</syntaxhighlight>
# Save the VMs XML description#* Save the current XML description of VM <code>vm-001</code> to a file at the retain location: <syntaxhighlight lang="bash">chmod 660 virsh dumpxml vm-001 > /path/to/imagesretain/vm-001.qcow2xml</syntaxhighlight>
# Restore the VMs <code>vm-001</code> from its saved state (this will also start the VM): <syntaxhighlight lang="bash">virsh restore /path/to/ram-disk/vm-001.state</syntaxhighlight>
#* '''Please note:''' After this operation the VM <code>vm-001</code> is running again (continues where we stopped it), and we have a consistent backup for the VM <code>vm-001</code>:
486
edits