lyz_pro@163.com
2013-Dec-10 04:03 UTC
[libvirt-users] virsh attach makes qcow2 format disk to raw format
Hi all I have a problem when I use `virsh attach` to attach a qcow2 disk to vm without argument --subdirver=qcow2 and this makes the qcow2 disk become a raw format disk, and the data in this disk is missing in guest os and also I have used guestmout to confirm this, the same result. Is there any way to let me find back the data in this disk ? the version of libvirt and kvm is : Compiled against library: libvir 0.9.8 Using library: libvir 0.9.8 Using API: QEMU 0.9.8 Running hypervisor: QEMU 1.0.0 Best Regards Li Yuezhou
Eric Blake
2013-Dec-12 22:25 UTC
Re: [libvirt-users] virsh attach makes qcow2 format disk to raw format
On 12/09/2013 09:03 PM, lyz_pro@163.com wrote:> Hi all > > I have a problem when I use `virsh attach` to attach a qcow2 disk to vm without argument --subdirver=qcow2 > and this makes the qcow2 disk become a raw format disk, and the data in this disk is missing in guest os > and also I have used guestmout to confirm this, the same result.The format of a file is important. By default, libvirt refuses to probe a file for its format, because any raw file can contain contents that look like any other format, making libvirt and/or qemu misbehave if the guest abused the raw contents to intentionally resemble a different format (this is a known CVE in the past). You can flip an option in /etc/libvirt/qemu.conf to request libvirt to probe image formats, at which point you can then omit the format but the guest will still get the data from the qcow2 format instead of abusing the file as raw; but this is a security risk if you do not trust any guest that has ever run on the image file.> > Is there any way to let me find back the data in this disk ?If the guest wrote to the disk, then I hope you had a good backup. If the guest merely read from the disk but didn't write any data, then unplugging the disk and replugging with the correct qcow2 format will fix things. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
李跃洲
2013-Dec-13 01:40 UTC
Re: [libvirt-users] virsh attach makes qcow2 format disk to raw format
Hi Eric Thanks for you answer, help me a lot At 2013-12-13 06:25:44,"Eric Blake" <eblake@redhat.com> wrote:>On 12/09/2013 09:03 PM, lyz_pro@163.com wrote: >> Hi all >> >> I have a problem when I use `virsh attach` to attach a qcow2 disk to vm without argument --subdirver=qcow2 >> and this makes the qcow2 disk become a raw format disk, and the data in this disk is missing in guest os >> and also I have used guestmout to confirm this, the same result. > >The format of a file is important. By default, libvirt refuses to probe >a file for its format, because any raw file can contain contents that >look like any other format, making libvirt and/or qemu misbehave if the >guest abused the raw contents to intentionally resemble a different >format (this is a known CVE in the past). You can flip an option in >/etc/libvirt/qemu.conf to request libvirt to probe image formats, at >which point you can then omit the format but the guest will still get >the data from the qcow2 format instead of abusing the file as raw; but >this is a security risk if you do not trust any guest that has ever run >on the image file. > >> >> Is there any way to let me find back the data in this disk ? > >If the guest wrote to the disk, then I hope you had a good backup. If >the guest merely read from the disk but didn't write any data, then >unplugging the disk and replugging with the correct qcow2 format will >fix things. > >-- >Eric Blake eblake redhat com +1-919-301-3266 >Libvirt virtualization library http://libvirt.org >
Seemingly Similar Threads
- virsh attach makes qcow2 format disk to raw format
- can I undo the snapshot apply of a qcow2 image
- I want to know how the xen 4.1.2 read an qcow2/raw image that is used as a vdi
- virsh Attach-disk function
- virsh attach-device : Bus 'pci.0' does not support hotplugging.