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. -------------------------------------------------- regards, Edoardo Comar WebSphere Application Service Platform for Networks (ASPN) ecomar@uk.ibm.com +44 (0)1962 81 5576 IBM UK Ltd, Hursley Park, SO21 2JN Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
Nicolas Sebrecht
2013-Jun-28 10:32 UTC
[libvirt-users] Re: qemu-img convert to "sparse" LV
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
> > 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. >Thanks Nicholas, the above seems to have worked. Quite a few steps, though - so prone to error ... When you say 'tools' I think you mean that qemu-img cannot at the moment support conversion to thin LVs. Edoardo Comar Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU