On 12/09/2013 09:03 PM, lyz_pro(a)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