CLI302 - How Windows Storage Is Changing: Everything's Going VHD!

1,587 views

Published on

Load Windows 7 or Windows Server 2008 R2 on a system, and you'll notice something sort of strange: there's no boot record or BCD folder. Look at other Windows 7/R2 systems, and you may notice something even stranger: there's only one file on the hard disk, and yet you can boot the system and run a normal Windows system. What's going on here? Simple: Windows 7 gets a lot of press for its faster-than-Vista performance and newer user interface, but there's a lot more to it also, including native support of VHD files (that's how a one-file system boots) as well as a new default disk structure, support of direct-to-disk ISO burning, and more. Whether you're going to Windows 7 sometime soon or five years from now, you'll want to be prepared for the changes that Windows 7 brings to storage -- and who better to prepare you than veteran Windows explainer Mark Minasi? Join Mark for this quick look at Windows 7/R2 storage and save yourself having to read a small mountain of whitepapers!

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,587
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
35
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

CLI302 - How Windows Storage Is Changing: Everything's Going VHD!

  1. 1. What&apos;s New in Windows Storage<br />Presented by Mark Minasi<br />contents copyright 2009 Mark Minasi<br />Do not redistribute<br />Session Code: CLI302<br />
  2. 2. Overview<br />Volumes as Seven likes &apos;em: The Case of the Unlettered Drive<br />VHDs<br />Win 7 native support<br />Storing OS volumes in VHDs<br />Booting from a VHD<br />What&apos;s new in Win 7 backup<br />Short Items<br />
  3. 3. How Win 7 Setup Arranges Disks<br />
  4. 4. Quick Review: BCD/BCDEDIT<br />Let&apos;s back up and review something about how Vista boots and how W7 adapts that<br />Vista doesn&apos;t use the NT boot loader that we&apos;ve had since 3.1; instead, it uses a new &quot;boot configuration database&quot; (BCD), a hidden/system folder containing the boot loader and boot instructions<br />It&apos;s why boot.ini&apos;s gone and bcdedit is essential<br />Download the (free) first chapter of my Vista Security book for background and examples of bcdedit (Administering Windows Vista Security: The Big Surprises)<br />
  5. 5. BCD in Win 7<br />If you install Win 7 on a system with a C: drive larger than about 24 GB in size, you&apos;ll end up with just one lettered (&quot;C:&quot;) drive… but you will not be able to find the BCD folder on that drive, even with &quot;dir c: /as&quot;<br />The reason: it&apos;s sitting on a separate partition that is not lettered<br />For example:<br />
  6. 6. This system is a simple laptop with a single 100 GB C: drive. I wiped the drives, told Win 7 to install to the one drive and did not tell it to chop the drive up… but here you see that it does that, creating an unlettered partition that contains the boot loader<br />
  7. 7. Now Compare Explorer<br />The Explorer view, in contrast, looks just like a Vista one-drive system – the unlettered volume doesn&apos;t appear at all<br />
  8. 8. Why Did Microsoft Do This?<br />Vista introduced the BitLocker drive encryption tool<br />It&apos;s useful, but it required you to boot from a separate 1.5 GB partition that contained nothing more than the BOOT folder<br />It was a pain to set up and didn&apos;t really need all that space, but MS put it in for compatibility<br />This 100 MB volume now does the job<br />
  9. 9. Why Do This?<br />Additionally, having a &quot;Drive S:&quot; (or whatever letter the little active partition eventually got) looked strange<br />Win 7&apos;s an improvement because<br />Separate partition&apos;s automatic, no after-the-fact fumbling with partitions to use BitLocker<br />Separate active partition supports booting from VHDs<br /> Win 7 active partition only uses 0.1 gig on your drive rather than 1.5 gigs<br />
  10. 10. No Unlettered Volume?no problem!<br />You probably don&apos;t have the unlettered volume, if you upgraded in place from Vista or Server 2008/3!<br />Upgrades won&apos;t rearrange the existing disk structure to create the unlettered volume<br />Upgrades won&apos;t &quot;un-letter&quot; an existing 1.5 GB system partition created for BitLocker under Vista<br />
  11. 11. It Can Go at the Front or Back<br />Must the 100 MB volume be the volume first physically placed on the hard drive? <br />No – I&apos;ve set it up both ways, and it works fine in both cases<br />
  12. 12. Native VHD Support in Windows 7<br />
  13. 13. Agenda<br />What VHDs do for Windows 7<br />Native VHD support in Win 7 intro<br />Creating VHDs step by step<br />Attaching VHDs (nope, it ain&apos;t &quot;mounting&quot;)<br />Boot from VHD (BFV)<br />Simple &quot;add a second image via VHD&quot; steps<br />Bcdedit in detail: BFV&apos;s screwdriver and wrench<br />Expert boot from VHD setup – boot your computer from one file<br />13<br />
  14. 14. Originally a Format for VM Disks<br />VHDs were (and still are) a useful format for storing virtual machines – when you power down a VM, basically it&apos;s nothing but a bunch of files<br />Virtual machines can have more than one imaginary hard disk, and each of those imaginary hard disks are stored in a file format with the quite sensible extension &quot;.vhd&quot;<br />
  15. 15. VHDs Store Structures and ACLs<br />A VHD-format file can be a handy way to package an entire drive into one file, incorporating the folder structure and its NTFS permissions – way more useful than a ZIP file!<br />Thus, they can provide &quot;non-virtual service&quot; replacing ZIP and CAB files<br />
  16. 16. Snapshots Assist Backups<br />Virtual machine managers support the notion of &quot;snapshots,&quot; a way to store the entire state of a VM that is both quick and that doesn&apos;t burn up a lot of hard disk space<br />(Consider how large VMs are and how quickly snapshots happen!)<br />VHDs, then, offer a useful format for backups and maintaining many incremental backups, as we see in Vista/Win 7&apos;s &quot;CompletePC Backup&quot;<br />
  17. 17. And the Most Interesting Part…<br />Windows 7 lets you package an entire bootable Windows system drive into a single large VHD<br />Place that VHD onto a system&apos;s otherwise-empty hard drive (with a BCD folder)<br />And then you can boot the system from that one big hard disk<br />Again, not a &quot;virtual&quot; application at all <br />
  18. 18. First, Some Pictures<br />There&apos;s a lot to learn here, but let me do a quick overview of one of the outcomes of native VHD support<br />Consider this the &quot;10,000 foot view&quot; of something that I will later explain step by step<br />It presents what is perhaps the simplest-to-see design (if not the simplest to create!)<br />
  19. 19. VHD Boot Setup: &quot;Big Picture&quot;<br />Start off with a clean hard disk, a WIM of the System Reserved Boot Partition and a VHD containing a Windows OS partition (you have to create those yourself, more info on that later)<br />Boot WinPE<br />Using DiskPart, chop it up<br />19<br />
  20. 20. VHD Boot Setup : &quot;Big Picture&quot;<br />100 MB<br />R:<br />Create two partitions: a 100 MB active partition, give it any drive letter (let&apos;s call it R:) <br />20<br />
  21. 21. &quot;R:?&quot;<br />Doesn&apos;t the drive letter matter?<br />No – as we&apos;ve seen, the system reserved boot partition won&apos;t have a drive letter eventually anyway<br />We just need a drive letter now so that ImageX can do the next step<br />
  22. 22. VHD Boot Setup : &quot;Big Picture&quot;<br />Get the boot manager code into the small partition with Setup or ImageX<br />100 MB<br />R:<br />SRBM.wim<br />SRBPM.wim<br />
  23. 23. VHD Boot Setup : &quot;Big Picture&quot;<br />100 MB<br />SRBP<br />Then, use the rest to create a partition, format it and call it drive S: (again, the letter doesn&apos;t matter, but I&apos;ll use S: in this example)<br />S:<br />
  24. 24. VHD Boot Setup : &quot;Big Picture&quot;<br />Create a folder on S: and copy an already-created Win 7 VHD which I&apos;ve called image.vhd (and that I&apos;ll explain how to create later) to the folder<br />100 MB<br />SRBP<br />S:<br />image.vhd<br />
  25. 25. Notice the &quot;Copy&quot;<br />If you&apos;ve already got an OS image inside a VHD, then &quot;deploying&quot; it is as simple as XCOPYing the VHD file… no Ghost, no ImageX<br />(Again, we&apos;ll see how to create a VHD with an OS image in it in a moment)<br />Note also:<br />We&apos;ve got a drive S: that contains the file s:vhdsimage.vhd that we want to boot from<br />Then we&apos;ll do some bcdedit (details later)<br />And reboot…<br />
  26. 26. After You Reboot: &quot;Big Picture&quot;<br />As before, the 100 MB partition has no letter<br />S: has been renamed to some other letter just above C:, like D: or E:, and has just one file in it<br />The attached VHD – which is just a VHD file sitting in a folder on &quot;E:&quot; – now shows up as a separate C: drive with the OS on it<br />100 MB<br />SRBP<br />E:<br />C:<br />image.vhd<br />
  27. 27. What it looks like when booted<br />So on to the details!<br />
  28. 28. Native VHD Supportwhat Win 7/R2 can do<br />Win 7 lets you create, from the CLI or (less completely) the GUI a brand-new VHD<br />You can then access it by &quot;attaching&quot; it, which fools Windows into thinking that you&apos;ve just added a new physical hard disk to the system<br />You can then partition it, format it, etc<br />From that point on, any other system that attaches that VHD sees its partitions, NTFS security and the like<br />
  29. 29. VHD Attachmentsimpler example that we can quickly see<br />Take a computer with one physical hard disk and just one volume on that disk (except the hidden partition)<br />We&apos;ll carve out a 1 GB fixed-size VHD file named &quot;image.vhd&quot; from C:<br />Then we&apos;ll partition it, format it and make it drive D: with a volume label of &quot;VHD Disk&quot; or the like<br />
  30. 30. Win 7 VHD Workflowwhat we&apos;ll do to create the &quot;extra&quot; drive<br />Initially create a VHD with logical disk manager (LDM), diskpart or, in some cases, start from an existing VHD<br />Following that, &quot;select&quot; the VHD<br />Then you &quot;attach&quot; the VHD<br />Once it&apos;s attached, it looks like a new hard drive<br />Now you treat it just like a regular drive – partition it, format it, etc<br />
  31. 31. Using Win 7&apos;s VHD Supportoverview (command line, all in diskpart)<br />Create VHDs from create vdisk file=…<br />Connect to a VHD file with select vdisk file=…<br />Then view it as if it were a physical with the attach vdiskcommand<br />Once it&apos;s attached, you can treat it like a physical disk – create/delete partitions and volumes, format the volumes, give them a letter<br />
  32. 32. VHD Creation from the CLI<br />
  33. 33. Three Kinds of VHDs<br />Fixed: when you create the VHD, you tell Windows how large it should be, and that space gets allocated immediately<br />Expandable: when created, you tell Windows the VHD&apos;s maximum size, but Windows only actually allocates the space as needed<br />Differencing: based on an existing &quot;parent&quot; VHD, this is a space-saving way to create several VHDs that are based on a &quot;baseline&quot; VHD<br />
  34. 34. Creating a VHD: CLI<br />From the CLI:<br />diskpart<br />create vdisk file=filename maximum=sizeinmegabytes [type=fixed|expandable] (we&apos;ll skip differencing for now)<br />ex: <br />create vdisk file=&quot;c:vhdsimage.vhd&quot; maximum=1000<br />&quot;Fixed&quot; is default, &quot;expandable&quot; can be much faster for big VHDs<br />
  35. 35. Selecting a VHD: CLI<br />Necessary intermediate step in using diskpart on a VHD<br />Also, it&apos;s the first step if you want to use a VHD that you got from somewhere else<br />Connect to a VHD file in diskpart with &quot;select vdisk file=filename&quot; – example:<br />select vdisk file=c:vhdsimage.vhd<br />No options<br />
  36. 36. Attaching a VHD: CLI<br />Next, a simple one:<br />attach vdisk<br />Attaches whatever disk you named in the last command<br />Can take &quot;readonly&quot; as an option, or create new in-the-vdisk permissions with the &quot;usefilesd&quot; or &quot;SD=&quot; options<br />Now it&apos;s like you have an extra hard drive on your system… partition it, give it drive letters<br />
  37. 37.
  38. 38.
  39. 39.
  40. 40. Disk Manager w/VHD drive<br />Really just a piece of C:<br />
  41. 41. Explorer w/VHD drive<br />Remember, this system in actuality has only one physical hard disk and only visible partition, no matter what it looks like<br />
  42. 42. Taking VHDs Further:using &quot;boot from VHD&quot;<br />
  43. 43. Boot From VHD: Basics<br />We&apos;ve seen that a VHD can &quot;become&quot; a disk<br />But what if that disk contained a bootable operating system image?<br />Then you could (with Windows 7 Ultimate or Enterprise) tell Windows at boot time to automatically attach the VHD, essentially &quot;unpacking it on the fly&quot; and booting from the OS inside that VHD<br />Better: you could have several VHDs for multi-boot, and deploying is basically XCOPYing<br />
  44. 44. First, We Need a VHD with a System Image<br />The VHDs that we&apos;ll deploy contain an operating system image, (although with some work you could probably use a a VHD from an existing VM) so let&apos;s see how to create that<br />Start from a WIM (create with ImageX, newsletter #60) and a VHD (which we just saw how to create)<br />Attach the WIM so it&apos;s got a drive letter<br />Use ImageX /apply to apply the WIM to the VHD<br />
  45. 45. Example: Creating a VHD with a System Image<br />Suppose I&apos;ve created &quot;image.vhd&quot; which is<br />at least 24 GB (it&apos;s got to hold a Win 7 image)<br />attached as drive G:, no data in it so far<br /> And I&apos;ve got a Win 7 image in &quot;system.wim&quot; as image number 1 (best if sysprepped, of course)<br />Then I just type<br />ImageX /apply system.wim 1 g: /verify<br />This can then be copied to a target system and booted from<br />
  46. 46. The Basic VHD Boot<br />We&apos;ll essentially employ just two steps to add a second bootable image to a computer using a VHD with a system image on it:<br />Copy the VHD to a local hard drive on the system (for example put &quot;image.vhd&quot; into C:VHDs)<br />Use BCDEDIT to create a new OS entry and point that entry at the VHD<br />
  47. 47. Installing a VHD image to boot from<br />Start from a system running R2 or Win 7 Enterprise/Ultimate with enough space on a drive (any drive&apos;s fine, I&apos;ll use C:) to store an extra OS image<br />Copy a VHD file containing a Win 7 system image onto that drive (in my example, I&apos;m copying image.vhd into C:VHDs)<br />And now, do a bit of relaxation breathing so we can tackle BCDEDIT<br />
  48. 48. Where BCDEDIT Fits In<br />Remember the 100 MB boot partition?<br />For the first few seconds, that is the only code running, and bcdedit is the main tool to tell it what to do<br />Windows Setup configured bcdedit to boot (usually) from c:windowssystem32winload.exe<br />But Win 7&apos;s boot partition can do the VHD stuff, if we tell it to<br />The only problem is that the syntax is pretty ugly… so here goes!<br />
  49. 49. Using BCDEDIT<br />First, start from an elevated command prompt and type &quot;bcdedit /v&quot; to see the current state of boot instructions; there will always be at least two – ignore the first, as it&apos;s a set of overall commands<br />We need the &quot;/v&quot; to get the long ugly GUID for the current OS entry<br />In this case, it turned out to be {f177696b-7ee6-11de-a72e-f4251c6d1ab0} but yours will be different<br />
  50. 50. BCDEDIT Output<br />Not this entry, <br />this entry<br />
  51. 51. BCDEDIT Setupour bcdedit tasks<br />Here, we will<br />Copy the one existing bootable OS entry<br />Give it a new name<br />Change its &quot;device&quot; and &quot;osdevice&quot; parameters (see previous screen shot for examples) to point to the VHD<br />Optionally, tell it to rescan for plug and play changes with a &quot;detecthal&quot; parameter<br />
  52. 52. BCDEDIT Setup<br />To copy the current OS entry, type<br />bcdedit /copy {GUID} /d &quot;Boot from VHD&quot;<br />(Don&apos;t type &quot;{GUID},&quot; type your actual GUID)<br />Now we need a new GUID, the one that Windows generated when we created this new OS entry<br />It&apos;ll be reported in the bcdedit output; we&apos;ll note it (actually, I copy it into the clipboard for easy typing later) for the next commands<br />
  53. 53. BCDEDIT Setup<br />In my case, it ran like this:<br />C:&gt;bcdedit /copy {f177696b-7ee6-11de-a72e-f4251c6d1ab0} /d &quot;Boot from VHD&quot;<br />The entry was successfully copied to {f1776970-7ee6-11de-a72e-f4251c6d1ab0}.<br />So I copy the {f1776970-7ee6-11de-a72e-f4251c6d1ab0} GUID to the clipboard<br />
  54. 54. BCDEDIT Setup<br />Next, tell it where the boot device is, which looks like<br />bcdedit /set {guid} device vhd=VHD-filespec<br />Unfortunately this, too, is a bit ugly, as the drive letters will be different after the reboot, meaning the C:VHDs ain&apos;tgonna be on C: any more<br />So surround the drive letter in brackets:<br />bcdedit /set {f1776970-7ee6-11de-a72e- f4251c6d1ab0} device vhd=[C:]VHDsimage.vhd<br />
  55. 55. Almost Done…<br />We next need the same command for a parameter named not &quot;device&quot; but &quot;osdevice:&quot;<br />bcdedit /set {f1776970-7ee6-11de-a72e-f4251c6d1ab0} device vhd=[C:]VHDsimage.vhd<br />Finally, set &quot;detecthal&quot; on:<br />bcdedit /set {f1776970-7ee6-11de-a72e-f4251c6d1ab0} detecthal on <br />You can see those commands in this screen shot<br />
  56. 56. Summary Run<br />
  57. 57. Can&apos;t Figure Out the [Drive]?<br />Sometimes typing in the current drive letter in the bcdedit /device/osdevice commands doesn&apos;t work so well<br />In that case, there&apos;s a neat alternative that lets you tell the computer, &quot;you go find the stupid VHD!&quot;<br />Instead of [C:] or [D:] or whatever, just type [locate], like<br />bcdedit /set {guid} device vhd=[locate]vhdsimage.vhd<br />
  58. 58. Booting an Existing VHDsummary<br />Copy the VHD (call it &quot;image.vhd&quot; in this example) – assume it&apos;s in c:VHDs<br />Create a new OS entry in bcdedit, copy from your current one with<br />bcdedit /copy {current} /d &quot;Boot Win7 VHD&quot;<br />That will result in a long GUID; copy that and do a bit of configuration:<br />bcdedit /set {GUID} device vhd=[locate]image.vhd<br />bcdedit /set {GUID} osdevicevhd=[locate]image.vhd<br />
  59. 59. Adding A Second VHD<br />So now we&apos;ve got a complete &quot;standard&quot; Win 7 install and a VHD-based Win 7, allowing a mult-boot situation<br />What if we want to add another VHD? No problem – just reproduce what we did here<br />Except for the bcdedit hassles (which aren&apos;t bad once you&apos;ve done them a few times and [locate] helps), this essentially allows &quot;xcopy deployment&quot; of extra images<br />
  60. 60. The Final Step: VHDs Only (1)<br />So we could imagine a system with, say, five images on it – one &quot;standard,&quot; the other four &quot;VHD&quot;<br />But what about a simpler arrangement:<br />100 MB partition<br />Big C: drive with just one file on it… image.vhd?<br />
  61. 61. Overview: Pure Boot From VHD<br />Run Win 7 Setup<br />Shift-F10 for a command prompt<br />Wipe the hard disk<br />Partition it with<br />100 MB partition, set active<br />the rest as one large partition; format<br />Create a VHDs folder on the large drive<br />Create, select, attach a 24+ GB VHD<br />Point Setup at the new &quot;drive&quot; now available<br />
  62. 62. Step by Steps<br />Start Win 7 Startup<br />Press shift-F10 to get a command prompt<br />Commands to create 100 MB partition:<br />diskpart<br />select disk 0<br />clean<br />create partition primary size=100<br />
  63. 63. Step by Steps <br />Create large drive (still in diskpart):<br />create partition primary<br />format fs=ntfs label=&quot;Cdrive&quot; quick<br />assign letter=s<br />exit<br />md s:VHDs<br />diskpart<br />
  64. 64. Step by Steps this should look sort of familiar by now<br />Create VHD, attach it and partition it<br />create vdisk file=&quot;s:vhdsimage.vhd&quot; type=expandable<br />select vdisk file=&quot;s:vhdsimage.vhd&quot;<br />attach vdisk<br />exit<br />exit<br />
  65. 65. Now for the trick<br />You&apos;re back in Setup<br />Run the install; where it asks, &quot;Where do you want to install Windows?,&quot; look at the new space you created (the size is the clue, it&apos;s probably the last one)<br />Setup will say &quot;Windows cannot be installed to this disk. (Show details)&quot;<br />Click it an Next anyway; it&apos;ll install<br />
  66. 66. What It Looks Like<br />Set up roughly as we just did, here are the Explorer and Disk Manager views<br />
  67. 67. Disk Manager View<br />Remember, there&apos;s really only one hard drive here; &quot;Windows 7 Image&quot; is really a VHD file in &quot;C Physical&quot;<br />
  68. 68. Explorer View: All Drives<br />
  69. 69. Explorer View: C:<br />
  70. 70. Explorer View: E:<br />This is the only folder on C:, containing just one VHD file<br />
  71. 71. All-VHD Gotchas: Insomnia<br />In my experience, running a system from VHD does have a couple of down-sides:<br />hibernate seems not to work<br />you can&apos;t put a system to sleep<br />
  72. 72. CompletePC Backup Changes in Windows 7/R2<br />
  73. 73. What&apos;s New<br />Nothing major – this is basically the Vista/2008 backup tool<br />Backup and Restore isn&apos;t in Accessories, it&apos;s in Control Panel / System and Security / Backup and Restore / Create an image backup<br />You can also &quot;Create a system repair disc,&quot; a WinRE CD/DVD from Control Panel (System and Security / Backup and Restore / Create a system repair disc&quot; <br />
  74. 74. Difference From Vista<br />If you use Win 7&apos;s backup to do &quot;bare metal&quot; backups from the &quot;wbadmin&quot; CLI then be sure to include the &quot;-allcritical&quot; switch to ensure that the unlettered volume gets backed up, as in this example<br />wbadmin start backup –backuptarget:m: -allcritical –include:e:<br />
  75. 75. What&apos;s New in Server Backup<br />System State Backup (on 2008 R2) uses VSS now and is five times faster than Server 2008; no corresponding changes in W7, as SSB isn&apos;t meaningful on a desktop OS<br />Particular file/folder backup (as Vista had but Server 2008 did not) is in Server 2008 R2<br />Still no tape or Exchange backup capability<br />
  76. 76. Short Storage Items…<br />Built-in support for burning ISOs to CD, DVD and Blu-Ray <br />Command-line tool in System32; syntax:<br />isoburn /q [burner drive letter:] [file to burn]<br />Example:<br />isoburn /q e: myimage.iso<br />Also there&apos;s shell support built-in<br />No native ability to mount ISOs, though, although it may yet appear in the final version?<br />
  77. 77. Short Storage Items…<br />DFS and FRS are, believe it or not, not just deprecated but gone from 2008 R2 apparently<br />Exception is if you&apos;re still using FRS for Sysvol<br />You can now do RAID 1 (mirroring) on the desktop OS, Windows 7<br />
  78. 78. Thank You!<br />I am at help@minasi.com<br />Find out about my free newsletter and online www.minasi.com<br />Please take a moment and do an evaluation<br />
  79. 79. Complete an evaluation on CommNet and enter to win an Xbox 360 Elite!<br />
  80. 80.
  81. 81. Required Slide<br />© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.<br />The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.<br />

×