[fedora-virt] Change format of backing file?

Eric Blake eblake at redhat.com
Wed Aug 13 02:58:44 UTC 2014


On 08/12/2014 08:57 PM, Eric Blake wrote:
> On 08/12/2014 05:59 PM, Tom Horsley wrote:
>> Just curious here. Say I have a qcow2 image named outer.qcow2
>> and it has a raw format backing_file named inner.img.
>>
>> If I do something like
>>
>> qemu-img convert -f raw -O qcow2 inner.img new-inner.img
>> rm -f inner.img
>> mv new-inner.img inner.img
>>
>> (in other words convert the backing file from raw to
>> qcow2)
>>
>> What are the odds that outer.qcow2 will still be usable?
> 
> If you stop there, 0%.  The outer file is still trying to open the inner
> file as raw, which sees completely different data than if it opened the
> inner file as qcow2.
> 
> But if you follow that up with:
> 
> qemu-img rebase -u -b inner.img -F qcow2 -f qcow2 outer.qcow2
> 
> then it is 100% safe.  That is, as long as you rewrite the outer file to
> track the new format of the inner file, then the guest-visible data is
> identical.

Oh, and there's a caveat.  This must be done while no guest is actively
using the image.  If any guest is actively using outer.qcow2, then
you've almost guaranteed total corruption of your guest.

-- 
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://lists.fedoraproject.org/pipermail/virt/attachments/20140812/daf25c65/attachment.sig>


More information about the virt mailing list