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

Maxim Perevedentsev mperevedentsev at virtuozzo.com
Tue Sep 15 15:04:08 UTC 2015



On 09/15/2015 05:37 PM, Richard W.M. Jones wrote:
> On Tue, Sep 15, 2015 at 05:17:16PM +0300, Maxim Perevedentsev wrote:
>> On 09/15/2015 04:57 PM, Richard W.M. Jones wrote:
>>>> 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?
>> As I understand, guestfs runs its own kernel-like daemon that can
>> run its own commands. It is used to run e.g. resize2fs or e2fsck
>> over loaded disk images. But those two utilities require the
>> partition not to be mounted, so they are run by daemon and do not
>> require anything to exists on partition.
>>
>> In API I found only the 'command' command which requires the
>> partition to be mounted and have kernel image on it. This cannot
>> operate on empty or non-mounted partition.
> You probably want to use the guestfs_debug API, ie:
>
>    char *cmd[] = { "resize2fs", "-P", ..., NULL };
>    char *ret = guestfs_debug (g, "sh", cmd);
Yeah! This is just what I was looking for. Thank you :-)
> It's better to add a new API however, and not difficult either:
>
>    http://libguestfs.org/guestfs.3.html#adding-a-new-api-action
>
> Rich.
I'll try to submit a patch when I'll have time.

-- 
Your sincerely,
Maxim Perevedentsev




More information about the Libguestfs mailing list