On Tue, Sep 15, 2015 at 04:31:46PM +0300, Maxim Perevedentsev wrote:
Hello everyone!
I am working on resizing qcow2 images using virt-resize+liguestfs.
If you're shrinking, I believe a better way to do this is to sparsify the image.
E.g. I when shrinking a partition, I have to resize filesystem using resize2fs-size. The problem is that I cannot find out minimal partition size (aka resize2fs -P). The only way is calling "resize2fs-size 1K", wait for resize2fs to claim "resize2fs: New size smaller than minimum (510050)" and parse this output.
It is known that resize2fs carries out complex calculations (no always correct) to get minimal size, so statvfs/tune2fs-l cannot help.
The questions are: 1) How to get minimal partition size (equal to resize2fs -P)?
There's no binding for that, but it would be a worthwhile addition to the API.
2) More general, how to execute commands from appliance but make them run over image (which may not have anything but filesystem) - I saw something like that in source.
Not sure I understand the question? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v