{"id":126,"date":"2009-07-09T04:35:14","date_gmt":"2009-07-09T08:35:14","guid":{"rendered":"http:\/\/www.cchsu.com\/art-en\/?p=126"},"modified":"2009-07-09T04:35:14","modified_gmt":"2009-07-09T08:35:14","slug":"playing-with-vhds-under-windows-7","status":"publish","type":"post","link":"http:\/\/www.cchsu.com\/art-en\/2009\/07\/09\/126\/","title":{"rendered":"Playing with VHDs under Windows 7"},"content":{"rendered":"<p>Windows 7 supports booting from VHD, which opens a new world to play with.  There are quite a few good sites talking about this, for example, <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/dd799282(WS.10).aspx\">Microsoft Technet<\/a>, or <a href=\"http:\/\/blogs.technet.com\/aviraj\/default.aspx\">Aviraj Ajgekar&#8217;s Blog<\/a>.  Here I just want to note down my experiments so that I can dig it myself later.<\/p>\n<p>My purpose is very simple: I want to take snapshots of my installation, and I want it easy revertible so that I don&#8217;t need to wait for Ghost to image back my stuff.  This will be pretty useful when the machine is exposed in hazardous area (e.g. users with bad browsing habits!).  How to do this?  Boot the machine with Windows 7 DVD, and press Shift-F10.  A Command Prompt will show up.  My planning is:<\/p>\n<p>B drive: 200MB for bootloader<br \/>\nC drive: 100GB for VHD<br \/>\nP drive: all remaining available for shared data<br \/>\nIt&#8217;s better to have higher capacity for C because the page swap and other stuff will be placed within the same drive where the VHD files resides.<\/p>\n<p>I completely wiped out my hard drive, since it&#8217;s brand new:<\/p>\n<blockquote><p>\ndiskpart<br \/>\nsel disk 0<br \/>\nclean\n<\/p><\/blockquote>\n<p>Then create the B, C, and P drive:<\/p>\n<blockquote><p>\ncreate partition primary size=200<br \/>\nformat quick fs=ntfs<br \/>\nassign letter=b<br \/>\nactive<br \/>\ncreate partition primary size=102400<br \/>\nformat quick fs=ntfs<br \/>\nassign letter=c<br \/>\ncreate partition primary<br \/>\nformat quick fs=exfat<br \/>\nassign letter=p\n<\/p><\/blockquote>\n<p>Now we can create the VHD file we want to install Windows 7:<\/p>\n<blockquote><p>\ncreate vdisk file=c:\\win7.vhd maximum=40960 type=expandable<br \/>\nselect vdisk file=c:\\win7.vhd<br \/>\nattach vdisk<br \/>\ncreate partition primary<br \/>\nactive<br \/>\nexit\n<\/p><\/blockquote>\n<p>After these commands done, we can close the Command Prompt and proceed to Windows 7 installation.  Select &#8220;Custom Install&#8221;, and install Windows to Disk 1.  Windows Setup will complain that it can&#8217;t be installed on Disk 1, just ignore it.  If VHD type is expandable, you need to make sure the VHD&#8217;s maximum size does not exceed the real size of its residual partition, otherwise a BSOD will be what you get after reboot.<\/p>\n<p>Windows will take care of the proper configuration of boot loader, so just enjoy it.  I&#8217;ll detail how to snapshot it in next article.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows 7 supports booting from VHD, which opens a new world to play with. There are quite a few good sites talking about this, for example, Microsoft Technet, or Aviraj Ajgekar&#8217;s Blog. Here I just want to note down my experiments so that I can dig it myself later. My purpose is very simple: I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,6],"tags":[],"_links":{"self":[{"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/posts\/126"}],"collection":[{"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/comments?post=126"}],"version-history":[{"count":1,"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/posts\/126\/revisions"}],"predecessor-version":[{"id":127,"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/posts\/126\/revisions\/127"}],"wp:attachment":[{"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/media?parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/categories?post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/tags?post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}