[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] Extract VHD using guestfs



Hi,

I have tried to extract .vhd file using guestfs library. I am able to list all files inside my archive using guestfs_ls also guestfs_list_filesystems() retruns right File system information. I am trying to extract files from inside archive using guestfs_copy_device_to_file()  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.


Regards
MUHAMMAD MOSHIN

#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <guestfs.h>

 int main (int argc, char *argv[])
 {
	 guestfs_h *g;
	 size_t i;
	 g = guestfs_create();


	 if (g == NULL) {
		 perror ("failed to create libguestfs handle");
		 exit (EXIT_FAILURE);
	 }
	 /* Set the trace flag so that we can see each libguestfs call.*/
	 guestfs_set_trace (g, 1);

	 guestfs_add_drive (g, "source-file-name");

	 guestfs_launch (g);

	 char **filesystems = guestfs_list_filesystems (g);


	 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");
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]