{"id":636,"date":"2014-12-23T03:09:45","date_gmt":"2014-12-23T03:09:45","guid":{"rendered":"http:\/\/www.selinuxplus.com\/?p=636"},"modified":"2014-12-23T03:14:10","modified_gmt":"2014-12-23T03:14:10","slug":"rhel7-0%ef%bc%88libguestfs%ef%bc%89-%e6%8c%82%e8%bd%bdwindows%e8%99%9a%e6%9c%ba%e9%95%9c%e5%83%8f","status":"publish","type":"post","link":"http:\/\/www.selinuxplus.com\/?p=636","title":{"rendered":"rhel7.0\uff08libguestfs\uff09 \u6302\u8f7dwindows\u865a\u673a\u955c\u50cf"},"content":{"rendered":"<h2>1 rhel7 \u6302\u8f7dwindows\u865a\u673a\u955c\u50cf<\/h2>\n<p>\u5728rhel 7.0 \u5185\u6302\u8f7dwindows\u865a\u62df\u955c\u50cf\uff0c\u9700\u8981ntfs-3g\u7684\u8f6f\u4ef6\u5305\u3002\u5f53\u4f60\u5b89\u88c5\u8be5\u8f6f\u4ef6\u5305\u540e\uff0c\u6302\u8f7dwindows\u865a\u62df\u673a\u955c\u50cf\u65f6\uff0c\u4ecd\u7136\u51fa\u73b0\u4e0b\u9762\u95ee\u9898\uff1a<\/p>\n<pre class=\"lang:default decode:true\">[root@selinuxplus.com]# mount \/opt\/windowsxp_32.img  \/mnt\r\nmount: \/dev\/loop0 is write-protected, mounting read-only\r\nmount: unknown filesystem type '(null)'<\/pre>\n<p>\u6216\u8005\u4f7f\u7528mount.ntfs-3g\u8fdb\u884c\u6302\u8f7d\u3002<\/p>\n<pre class=\"lang:default decode:true\">[root@selinuxplus.com]# mount.ntfs-3g \/opt\/windowsxp_32.img  \/mnt -o loop\r\nNTFS signature is missing.\r\nFailed to mount '\/opt\/windowsxp_32.img': Invalid argument\r\nThe device '\/opt\/windowsxp_32.img' doesn't seem to have a valid NTFS.\r\nMaybe the wrong device is used? Or the whole disk instead of a\r\npartition (e.g. \/dev\/sda, not \/dev\/sda1)? Or the other way around?<\/pre>\n<p>\u95ee\u9898\u662f\u65e0\u6cd5\u6302\u8f7d\u5206\u533a\uff0c\u8be6\u7ec6\u4fe1\u606f\u89c1\u4e0a\u9762\u7684\u62a5\u9519\u4fe1\u606f\u3002<br \/>\n\u4e3b\u8981\u662f\u56e0\u4e3awindowsxp_32.img\u955c\u50cf\u7684\u8d77\u59cb\u5206\u533a\u662f1\uff0c\u56e0\u4e3a\u78c1\u76d8\u7684\u7b2c\u4e00\u4e2a\u5b57\u8282\u5305\u542b\u4e3b\u5f15\u5bfc\u8bb0\u5f55\u548c\u4e00\u4e9b\u78c1\u76d8\u7ed3\u6784\uff0c\u5982MS-DOS\u7ed3\u6784\u3002\u5982\u679c\u4f60\u4f7f\u75280\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u5206\u533a\u7684\u8d77\u59cb\uff0c\u6211\u4eec\u4f7f\u7528parted\u67e5\u770b\u8be5\u5206\u533a\u7ed3\u6784\uff0clibparted\u4f1a\u8df3\u8fc7\u5f00\u59cb\u7684\u51e0\u4e2a\u5b57\u8282\u7684\u4fe1\u606f\u5141\u8bb8\u67e5\u770b\u5206\u533a\u7ed3\u6784\u3002<\/p>\n<pre class=\"lang:default decode:true\">[root@localhost ~]# parted  \/opt\/windowsxp_32.img  unit b print\r\nModel:  (file)\r\nDisk \/opt\/windowsxp_32.img: 10737418240B\r\nSector size (logical\/physical): 512B\/512B\r\nPartition Table: msdos\r\nDisk Flags: \r\n\r\nNumber  Start   End           Size          Type     File system  Flags\r\n 1      32256B  10725765119B  10725732864B  primary  ntfs         boot<\/pre>\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u8d77\u59cb\u7684\u4f4d\u7f6e\u4e3a32kB\u7684\u5730\u65b9\uff0c\u6211\u4eec\u5229\u7528offset\u8bbe\u7f6e32kB\u7684\u5206\u533a\u504f\u79fb\u91cf\u300232kB\u7684\u8d77\u59cb\uff0c\u56e0\u4e3a\u4f7f\u7528\u7684\u5de5\u5177\u592a\u65e7\u4e86\u3002\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f512\u5b57\u8282\u7684\u6247\u533a\uff0c\u5b9e\u9645\u7684\u5206\u533a\u504f\u79fb\u53ef\u80fd\u662f32256\u5bf9\u5e94\u768463Sector\uff08\u78c1\u533a\uff09\u3002<br \/>\n\u6211\u4eec\u5c1d\u8bd5\u4f7f\u7528offset\u8fdb\u884c\u5206\u533a\u6302\u8f7d\uff1a<\/p>\n<pre class=\"lang:default decode:true\">[root@selinuxplus.com opt]# mount -o loop,ro,offset=32256 windowsxp_32.img  \/mnt\r\n[root@selinuxplus.com opt]# cd \/mnt\r\n[root@selinuxplus.com mnt]# ls\r\nbootfont.bin            ntldr\r\nboot.ini                pagefile.sys\r\nCONFIG.SYS              Program Files\r\nDocuments and Settings  RECYCLER\r\nhiberfil.sys            System Volume Information\r\nIO.SYS                  temp\r\nJava                    virtio-win-0.1-74\r\nMSDOS.SYS               WINDOWS<\/pre>\n<h2>2 libguestfs \u6302\u8f7dwindows\u865a\u673a\u955c\u50cf<\/h2>\n<p>\u5f53\u4f7f\u7528libguestfs\u6302\u8f7dwindows\u865a\u673a\u955c\u50cf\u65f6\uff0c\u4e5f\u51fa\u73b0\u4e86\u8fd9\u4e2a\u95ee\u9898.<\/p>\n<pre class=\"lang:default decode:true\">[root@selinuxplus.com opt]# guestfish -a windowsxp_32.img \r\n\r\nWelcome to guestfish, the guest filesystem shell for\r\nediting virtual machine filesystems and disk images.\r\n\r\nType: 'help' for help on commands\r\n      'man' to read the manual\r\n      'quit' to quit the shell\r\n\r\n&gt;&lt;fs&gt; run\r\n 100% \r\n&gt;&lt;fs&gt; list-filesystems\r\n\/dev\/sda1: ntfs\r\n&gt;&lt;fs&gt; mount \/dev\/sda1 \/\r\nlibguestfs: error: mount: \/dev\/sda1 on \/ (options: ''): mount: unknown filesystem type 'ntfs'<\/pre>\n<p>\u9700\u8981\u5b89\u88c5libguestfs-winsupport<\/p>\n<pre class=\"lang:default decode:true\">&gt;&lt;fs&gt; mount \/dev\/sda1 \/\r\n&gt;&lt;fs&gt; ll \/\r\ntotal 2097129\r\ndrwxrwxrwx  1 root root       4096 Dec 22 21:46 .\r\ndrwxr-xr-x 23 root root       4096 Dec 22 21:54 ..\r\n-rwxrwxrwx  1 root root          0 Jan  8  2014 AUTOEXEC.BAT\r\n-rwxrwxrwx  1 root root          0 Jan  8  2014 CONFIG.SYS\r\ndrwxrwxrwx  1 root root       4096 Mar 10  2014 Documents and Settings\r\n-rwxrwxrwx  1 root root          0 Jan  8  2014 IO.SYS<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1 rhel7 \u6302\u8f7dwindows\u865a\u673a\u955c\u50cf \u5728rh&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,74],"tags":[124,147,148,149],"_links":{"self":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/636"}],"collection":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=636"}],"version-history":[{"count":4,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/636\/revisions"}],"predecessor-version":[{"id":640,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=\/wp\/v2\/posts\/636\/revisions\/640"}],"wp:attachment":[{"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=636"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=636"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.selinuxplus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}