{"id":128,"date":"2009-07-11T02:08:28","date_gmt":"2009-07-11T06:08:28","guid":{"rendered":"http:\/\/www.cchsu.com\/art-en\/?p=128"},"modified":"2009-07-11T02:08:28","modified_gmt":"2009-07-11T06:08:28","slug":"playing-with-vhds-under-windows-7-2","status":"publish","type":"post","link":"http:\/\/www.cchsu.com\/art-en\/2009\/07\/11\/128\/","title":{"rendered":"Playing with VHDs under Windows 7 (2)"},"content":{"rendered":"<p>We&#8217;ve already talked about how do make a VHD, install Windows 7 on it, and boot from the VHD.  The next step is to do snapshotting.  Again, you&#8217;ll need to boot from Windows 7 DVD, and press Shift-F10 for Command Prompt.  We are going to create a differential VHD.  Unfortunately drive letters change when we reboot into Windows 7 setup, so you&#8217;ll need to find out where the original VHD is located.  In our example, it&#8217;s D drive.  Here are the commands to create a differential VHD:<\/p>\n<blockquote><p>\ndiskpart<br \/>\ncreate vdisk file=d:\\win7-diff.vhd parent=d:\\win7.vhd<br \/>\nexit\n<\/p><\/blockquote>\n<p>Now we&#8217;ll need to use bcdedit to point the booting device to the newly created win7-diff.vhd:<\/p>\n<blockquote><p>\nbcdedit \/set {default} device vhd=[locate]\\win7-diff.vhd<br \/>\nbcdedit \/set {default} osdevice vhd=[locate]\\win7-diff.vhd\n<\/p><\/blockquote>\n<p>After these commands, all new changes will be written into win7-diff.vhd and leave the original win7.vhd untouched.  This is very useful when your system is damaged by malware and you need to revert it back to a working condition in, hmm, 5 minutes \ud83d\ude42  When bad things happen, all you need to do is to boot via Windows 7 DVD, delete the win7-diff.vhd, and repeat the commands above.  You do need to redo the bcdedit part because the GUID inside the VHD changes and the boot loader will fail to recognize your new diff VHD, if bcdedit were not run again.<\/p>\n<p>Chances are we might need to merge changes for a new snapshot (e.g. installing of important system updates, like Windows 7 SP1).  In that case, you can use the commands:<\/p>\n<blockquote><p>\ndiskpart<br \/>\nselect vdisk file=d:\\win7-diff.vhd<br \/>\nmerge vdisk depth=1<br \/>\nexit\n<\/p><\/blockquote>\n<p>All contents within win7-diff.vhd will be merged into win7.vhd.  You can now safely delete win7-diff.vhd, and repeat the steps w.r.t. diff VHD creation and bcdedit to start from a fresh snapshot.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve already talked about how do make a VHD, install Windows 7 on it, and boot from the VHD. The next step is to do snapshotting. Again, you&#8217;ll need to boot from Windows 7 DVD, and press Shift-F10 for Command Prompt. We are going to create a differential VHD. Unfortunately drive letters change when we [&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\/128"}],"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=128"}],"version-history":[{"count":1,"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/posts\/128\/revisions"}],"predecessor-version":[{"id":129,"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/posts\/128\/revisions\/129"}],"wp:attachment":[{"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/media?parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/categories?post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cchsu.com\/art-en\/wp-json\/wp\/v2\/tags?post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}