----- Original Message -----
From: "Eric Blake" <eblake(a)redhat.com>
To: "Adam King" <kinga(a)sghs.org.uk>, libvirt-users(a)redhat.com
Sent: Thursday, August 21, 2014 3:17:09 AM
Subject: Re: [libvirt-users] virsh snapshot
On 08/20/2014 06:34 PM, Adam King wrote:
Hi,
[Can you convince your mailer to wrap long lines?]
I had a 'domain' called APP03. I was performing auto snapshots each
night
using /usr/bin/virsh snapshot-create APP03 .
This creates an internal snapshot, where the state of the snapshot is
stored in the same qcow2 file as the current state.
I then wanted the domain to be called APP01 for clarity's sake,
so I
did virsh dumpxml APP03 > APP03.xml, edited the name to APP01 and
changed the ID. I then did virsh define APP03.xml to get APP01.
Yes, this achieves the goal of defining a new domain name that
inherits
from the old state.
I have now realised that the qcow2 images are huge (1.1TB image but
80G inside the
virtual machine), I am assuming this is the snapshots
tagged onto the virtual hard disk?
Most likely, yes. 'qemu-img info /path/to/file' will give you
a better
picture on all the snapshots stored in there.
How do I reduce the size of those back to something realistic? I've
removed old
snapshots from APP03 using virsh snapshot-delete APP03
'<snapshotidnumber>
If it were still in the old APP03 domain, then 'virsh
snapshot-delete
APP03 $name', where 'virsh snapshot-list APP03' will
show you the list
of names. But given that you renamed to APP01, libvirt probably is
unaware of the snapshots; so you'll have to do more legwork. You can
use qemu-img snapshot -d to delete the snapshots yourself, or you can
use 'virsh snapshot-create[-as] --redefine ...' to temporarily create a
snapshot with the right name so that you can then do 'virsh
snapshot-delete' (probably more effort than it's worth, so I'd stick
with raw qemu-img commands). Don't do this while the guest is running -
using qemu-img is only safe for an offline image.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org
Thanks for the response.
I'll look at the text wrap.
Before you responded I ran virsh snapshot-list APP01 to find no snapshots.
I then ran virsh snapshot-list APP03 to find one per day for 3 months...
APP03 was shutdown so I used awk to pull out the snapshot ID's.
I from a file I then ran
while read line
do
virsh snapshot-delete APP03 $line
done </file
Leaving just 1 snapshot
I have run qemu-img info on the file as you said, here's the output
qemu-img info /virtual/APP03-c.qcow2
image: /virtual/APP03-c.qcow2
file format: qcow2
virtual size: 80G (85899345920 bytes)
disk size: 987G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
�K��Q�w���q���U��eInh�ik�{K?�M�w
{����}���{�l6�z�Sa�ׂP��2ZZ
�e�j��~_��� ^.���=I��=n�ӱ��5��^F���*��v�6��Oc�JfH-[,~9�/̫��%O�cn�2��V䴘t
n��]m�UC2d�
2.4G 2096-06-18 11:54:302089366:21:24.846
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
0 1970-01-01 01:00:00 00:00:00.000
APP03 is down but APP01 needs to be up.
What exactly is the qemu-img command I need?
Thanks