The 27/06/13, Edoardo Comar wrote:
Apologies as this is is not a specific libvirt question.
Is qemu-img convert compatible with thin-provisioned LVs as targets ?
I wanted to convert a file-based image to a LV image
where the file-based image has a capacity much larger than the actual data
it contains, so it has a small footprint on disk
(either a qcow2 or a raw, but sparse, image).
If I use qemu-img convert -O raw ... with a target LV sized to the full
capacity of the file-image, all is fine.
But if I try use an LV whose virtual size equals the capacity, but its
size is smaller (although more than enough for the data)
the LV is invariably corrupt.
If I try use a thin-provisioned LV pool, and a LV backed by that pool,
the LV resulting from qemu-img convert is not corrupt but it uses as much
space as the file-image capacity it came from.
This on both RHEL64 and Fedora18.
I think a good way to get that is to shrink the filesystem of the
original disk, shrink the disk itself and convert the file-based image
to the LV like you do.
Once done, you can extend the LV and the filesystem back to what it was
before the process if needed.
Other than that, I don't know a way to get what you want with the
current tools.
Regards,
--
Nicolas Sebrecht