[Libguestfs] Extract VHD using guestfs

MUHAMMAD MOHSIN mohsinawan91 at gmail.com
Mon Feb 13 07:33:11 UTC 2017


Thanks a lot. I was trying to copy on local disk and  guestfs_download ()
solved my problem.
Now I am trying to modify source code of  guestfs_download () to extract
file in memory. Can you guide me what should i do to achieve that.

Mohsin

On Fri, Feb 10, 2017 at 2:13 AM, Richard W.M. Jones <rjones at redhat.com>
wrote:

> On Thu, Feb 09, 2017 at 03:24:53PM +0500, MUHAMMAD MOHSIN wrote:
> > * but it returns following error (error: copy_device_to_file: unknown
> > option 689330304 (this can happen if a program is compiled against a
> newer
> > version of libguestfs, then dynamically linked to an older version)).
> > Please see attached main.c for my sample code.
>
> I don't know about the above error, but the way you've used
> copy-device-to-file is clearly wrong:
>
> >        guestfs_mount (g, "/dev/sda1", "/");
> >
> >        //guestfs_mount_local (g, "/home/mohsin/VHD/");
> >        guestfs_ls(g, "/");
> >        guestfs_copy_device_to_file(g, "/dev/sda1/file-to extract.exe",
> "/abc.exe");
>
> It's actually not clear to me what you're trying to achieve here.
> Download the file to the local host?  If so use guestfs_download:
>
>   guestfs_download (g, "/file-to-extract.exe", "local-file.exe");
>
> BTW you should check for errors from C API calls.
>
>   http://libguestfs.org/guestfs.3.html#downloading
>   http://libguestfs.org/guestfs.3.html#error-handling
>
> Rich.
>
> --
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~
> rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> virt-builder quickly builds VMs from scratch
> http://libguestfs.org/virt-builder.1.html
>



-- 
MUHAMMAD MOSHIN
CIIT, ABBOTTABAD
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170213/5908fd2b/attachment.htm>


More information about the Libguestfs mailing list