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