[libvirt-users] virsh snapshot

Eric Blake eblake at redhat.com
Thu Aug 21 02:17:09 UTC 2014


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140820/f2ac7bf0/attachment.sig>


More information about the libvirt-users mailing list