Question: running appliance commands over guest fs (resize2fs -P).
Hello everyone! I am working on resizing qcow2 images using virt-resize+liguestfs. 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)? 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. Thanks in advance! -- Your sincerely, Maxim Perevedentsev
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
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
On Tue, Sep 15, 2015 at 04:31:46PM +0300, Maxim Perevedentsev wrote: the image. And how would it help? If I shrink, a want a VM to occupy less maximum space. virt-sparsify (I guess you are talking about it) will reduce space taken by guest disk image by now, but won't tighten the upper
On 09/15/2015 04:57 PM, Richard W.M. Jones wrote: limit for guest. -- Your sincerely, Maxim Perevedentsev
On Tue, Sep 15, 2015 at 05:28:40PM +0300, Maxim Perevedentsev wrote:
On 09/15/2015 04:57 PM, Richard W.M. Jones 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
On Tue, Sep 15, 2015 at 04:31:46PM +0300, Maxim Perevedentsev wrote: the image. And how would it help? If I shrink, a want a VM to occupy less maximum space. virt-sparsify (I guess you are talking about it) will reduce space taken by guest disk image by now, but won't tighten the upper limit for guest.
I've come to think that sparsification is still better, but if you're sure what you really need is to reduce the virtual size of the container then of course you'll need to use resize2fs etc. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
participants (2)
-
Maxim Perevedentsev -
Richard W.M. Jones