See the example program here: https://github.com/libguestfs/libguestfs/blob/master/examples/mount_local.c ---------------------------------------------------------------------- $ ./run ./examples/mount_local /tmp/test.img This is the 'mount-local' demonstration program. Follow the instructions on screen. Creating and formatting the disk image, please wait a moment ... The _current directory_ is a FUSE filesystem backed by the disk image which is managed by libguestfs. Any files or directories you copy into here (up to 512 MB) will be saved into the disk image. You can also delete files, create certain special files and so on. When you have finished adding files, hit ^D or exit to exit the shell and return to the mount-local program. sh-4.2$ ls lost+found sh-4.2$ ls -l total 12 drwx------. 2 root root 12288 May 13 22:49 lost+found sh-4.2$ cp -r /usr/share/doc/libguestfs-devel-1.17.36 . sh-4.2$ exit Any files or directories that you copied in have been saved into the disk image called '/tmp/test.img'. Try opening the disk image with guestfish to see those files: guestfish -a /tmp/test.img -m /dev/sda1 $ guestfish -a /tmp/test.img -m /dev/sda1 Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell
<fs> ll / total 18 drwxr-xr-x 4 root root 1024 May 13 22:49 . drwxr-xr-x 23 1000 1000 4096 May 13 22:51 .. drwxr-xr-x 2 root root 1024 May 13 22:49 libguestfs-devel-1.17.36 drwx------ 2 root root 12288 May 13 22:49 lost+found
<fs>
Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v