Difference between revisions of "stoney conductor: VM Backup"
From stoney cloud
[unchecked revision] | [unchecked revision] |
(→Idea) |
|||
Line 1: | Line 1: | ||
= Overview = | = Overview = | ||
This page describes how the VMs and VM-Templates are backed-up inside the [http://www.stoney-cloud.org stoney cloud]. | This page describes how the VMs and VM-Templates are backed-up inside the [http://www.stoney-cloud.org stoney cloud]. | ||
− | |||
− | |||
= Basic idea = | = Basic idea = | ||
+ | The main idea to backup a VM or a VM-Template is, to divide the task into three subtasks: | ||
+ | * Snapshot: Save the machines state (CPU, Memory and Disk) | ||
+ | * Merge: Merge the Disk-Snapshot with the live-image | ||
+ | * Retain: Export the snapshot files | ||
+ | A more detailed and technical description for these three sub-processes can be found in the following sub-chapters. | ||
+ | |||
+ | == Snapshot == | ||
+ | # Create a snapshot with state: | ||
+ | #* Save the VMs state: <code>virsh save my-vm my-vm.state</code> | ||
+ | #* Rename the actual disk image: <code>mv my-vm.qcow2 my-vm-backup.qcow2</code>. | ||
+ | #* Create the new disk image with the old as backing file: <code>qemu-img create -f qcow2 -b my-vm-backup.qcow2 my-vm.qcow2</code>. | ||
+ | #* Set correct ownership and permission to the newly created image: | ||
+ | #** <code>chown root:vm-storage my-vm.qcow2</code>. | ||
+ | #** <code>chmod 660 my-vm.qcow2</code>. | ||
+ | #* Restore the VMs state: <code>virsh restore my-vm.state</code>. | ||
+ | # Merge the disk images my-vm.qcow2 and my-vm-snap.qcow2 to a single image: <code>virsh qemu-monitor-command my-vm --hmp "block_stream drive-virtio-disk0"</code>. | ||
+ | # Move the files to the backup location: | ||
+ | #* Move the old disk image to the backup location and add the date as suffix to not overwrite older backups: <code>mv my-vm-backup.qcow2 /path/to/backup/my-vm-backup.qcow2.date</code> | ||
+ | #* Move the state file to the backup location and add the date as suffix to not overwrite older backups: <code>mv my-vm.state /path/to/backup/my-vm.state.date</code> | ||
+ | |||
+ | == Merge == | ||
+ | |||
+ | == Retain == | ||
+ | |||
+ | |||
+ | = State of the art = | ||
= Next steps = | = Next steps = | ||
[[Category: stoney conductor]] | [[Category: stoney conductor]] |
Revision as of 13:29, 22 October 2013
Overview
This page describes how the VMs and VM-Templates are backed-up inside the stoney cloud.
Basic idea
The main idea to backup a VM or a VM-Template is, to divide the task into three subtasks:
- Snapshot: Save the machines state (CPU, Memory and Disk)
- Merge: Merge the Disk-Snapshot with the live-image
- Retain: Export the snapshot files
A more detailed and technical description for these three sub-processes can be found in the following sub-chapters.
Snapshot
- Create a snapshot with state:
- Save the VMs state:
virsh save my-vm my-vm.state
- Rename the actual disk image:
mv my-vm.qcow2 my-vm-backup.qcow2
. - Create the new disk image with the old as backing file:
qemu-img create -f qcow2 -b my-vm-backup.qcow2 my-vm.qcow2
. - Set correct ownership and permission to the newly created image:
-
chown root:vm-storage my-vm.qcow2
. -
chmod 660 my-vm.qcow2
.
-
- Restore the VMs state:
virsh restore my-vm.state
.
- Save the VMs state:
- Merge the disk images my-vm.qcow2 and my-vm-snap.qcow2 to a single image:
virsh qemu-monitor-command my-vm --hmp "block_stream drive-virtio-disk0"
. - Move the files to the backup location:
- Move the old disk image to the backup location and add the date as suffix to not overwrite older backups:
mv my-vm-backup.qcow2 /path/to/backup/my-vm-backup.qcow2.date
- Move the state file to the backup location and add the date as suffix to not overwrite older backups:
mv my-vm.state /path/to/backup/my-vm.state.date
- Move the old disk image to the backup location and add the date as suffix to not overwrite older backups: