[libvirt-users] re-create disk image file

Joe Linoff jlinoff at tabula.com
Mon Nov 5 21:19:28 UTC 2012

> [please don't top-post on technical lists]

Okay, sorry about that.

>> Thank you for your suggestions. Here is what happened when I tried
>> snapshot. I will try the dd a bit later.
>> virsh: 0.9.10
>> qemu: 2.0.12

> Huh?  The current upstream version of qemu is 1.2; I don't recognize
> 2.0.12 numbering.

Sorry about that. It was a typo. The version seems to be from

$ /usr/libexec/qemu-kvm --version
QEMU PC emulator version 0.12.1 (qemu-kvm-, Copyright (c)
2003-2008 Fabrice Bellard

>> DOM: webdev
>> $ ls -l /proc/13196/fd/9
>> lrwx------. 1 qemu qemu 64 Nov  5 11:57 /proc/13196/fd/9 -> 
>> /tools/vm/images/webdev.img (deleted)
>> $ cp /proc/13196/fd/9 /tools/vm/images/webdev.img
>> cp: cannot stat `/proc/13196/fd/9': Stale NFS file handle
>> $ virsh snapshot-create-as webdev \
>>     --no-metadata \
>>     --disk-only \
>>     --diskspec
>> /tools/vm/images/webdev.img,file=/tools/vm/images/webdev.img1
>> error: unsupported configuration: no disk named 
>> '/tools/vm/images/webdev.img'

> What does this say?
> virsh domblklist webdev

Target     Source
vda        /var/lib/libvirt/images/webdev.img
hdc        -

> That is the name of the disk where you are creating the snapshot.  
> The --diskspec line needs two pieces of information: a designation
> for the current file being snapshotted (either the absolute path
> you used in your xml, or the shorthand name like 'vda' - valid 
> names are found by the domblklist command); and the name of the
> new file to create the snapshot as.

> The fact that your error message complains about "no disk named
> '/tools/vm/images/webdev.img'" says that you probably didn't spell
> the file the same as it was named in the XML; seeing the domblklist
> command will make it clear what name you should be using instead.

I see. Thank you for the clear explanation. It appears that the file
name in the XML and the file name referenced by the fd are different:

/var/lib/libvirt/images/webdev.img (XML, link, domblklist)
/tools/vm/images/webdev.img        (filer, fd reference)

I modified the command to use /var/lib/libvirt/images/webdev.img but it
had a different problem:

# virsh snapshot-create-as webdev \
    --no-metadata \
    --disk-only \
error: operation failed: Failed to take snapshot: unknown command:

I don't understand what the message is trying to tell me. Why would
snapshot_blkdev not be available? Perhaps the version I have is too old?

>> # Pull the contents into the new file
>> virsh blockpull $dom /tmp/guest.img1 --wait --verbose

> For the blockpull command, the same usage applies - you name the disk
by its path (but 
> note that you just changed the path as a result of the
snapshot-create-as command; as
> another domblklist would prove) or by its > device name, such as vda.

I see.

BTW, I tried the dd option with another guest and it seemed to work.

Thank you,


Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

More information about the libvirt-users mailing list