[Libguestfs] python-guestfs

徐展聪 xuzhancong at cloudkc.net
Wed Sep 4 02:31:08 UTC 2013


I use python-guestfs to mount windows image it have some problems .Here is my code:

[root at mfsdata1 ~]# python
Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> sheepfs_dir="/tmp/sheepfs"
>>> os.system("umount " + sheepfs_dir)
0
>>> os.system("sheepfs -n " + sheepfs_dir)
0
>>> vdi_name = "vm1935028.nbregion.ec2.cloudkc.cn"
>>> os.system("echo " + vdi_name + ">" + sheepfs_dir + "/vdi/mount")
0
>>> import guestfs
>>> g=guestfs.GuestFS()
>>> imgfile=sheepfs_dir + "/volume/" + vdi_name
>>> g.add_drive_opts(imgfile, format="raw", readonly=0)
>>> g.launch()
>>> root = g.inspect_os()
>>> print root
[]
>>> g.list_filesystems()
[('/dev/vda1', 'ntfs'), ('/dev/vda2', 'ntfs')]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20130904/c07c1ddc/attachment.htm>


More information about the Libguestfs mailing list