[Libguestfs] Question: running appliance commands over guest fs (resize2fs -P).

Maxim Perevedentsev mperevedentsev at virtuozzo.com
Tue Sep 15 13:31:46 UTC 2015


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




More information about the Libguestfs mailing list