lost and found ( for me ? )

Ubuntu 14.04 KVM : create snapshots

Reference

Here are examples of how to take snapshots on KVM.

KVM host : Ubuntu 14.04
VM : Ubuntu 14.04

list snapshots of the VM
virsh # snapshot-list ubuntu1404-vm8
Name                 Creation Time             State
------------------------------------------------------------

virsh #

create a snapshot.
error, KVM does not support taking snapshots with raw format.
I need to convert the VM image format to qcow2 from raw.
virsh # snapshot-create-as ubuntu1404-vm8 ss01
error: unsupported configuration: internal snapshot for disk vda unsupported for storage type raw

shutdown the VM and covert the format type to qcow2.
virsh # shutdown ubuntu1404-vm8

# qemu-img convert -f raw -O qcow2 ubuntu1404-vm8.img ubunt
u1404-vm8.qcow2

start the VM
# file ubuntu1404-vm8.qcow2
ubuntu1404-vm8.qcow2: QEMU QCOW Image (unknown version)

# mv ubuntu1404-vm8.qcow2 ubuntu1404-vm8.img

edit the XML file of that VM to use qcow2 image.
# virsh edit ubuntu1404-vm8

from
<driver name='qemu' type='raw'/>

to
<driver name='qemu' type='qcow2'/>

start the VM
virsh # start ubuntu1404-vm8
Domain ubuntu1404-vm8 started

create a snapshot.
The VM is paused while creating a snapshot.
virsh # snapshot-create-as ubuntu1404-vm8 ss01

virsh # snapshot-create-as ubuntu1404-vm8 ss02

virsh # snapshot-list ubuntu1404-vm8
Name                 Creation Time             State
------------------------------------------------------------
ss01                 2015-01-04 13:04:13 +0900 running


virsh # snapshot-create-as ubuntu1404-vm8 ss02
Domain snapshot ss02 created
virsh #
virsh # snapshot-list ubuntu1404-vm8
Name                 Creation Time             State
------------------------------------------------------------
ss01                 2015-01-04 13:04:13 +0900 running
ss02                 2015-01-04 13:06:13 +0900 running

virsh #
virsh # snapshot-info --current ubuntu1404-vm8
Name:           ss02
Domain:         ubuntu1404-vm8
Current:        yes
State:          running
Location:       internal
Parent:         ss01
Children:       0
Descendants:    0
Metadata:       yes

virsh #

Go to the snapshot “ss01”
virsh # snapshot-revert ubuntu1404-vm8 ss01

virsh #

delete a snapshot.
virsh # snapshot-delete ubuntu1404-vm8 ss02
Domain snapshot ss02 deleted

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.