by via JohnPapa.net on 5/7/2011 6:24:09 AM
I love the performance gains I get by using bootable VHDs. I’ve always enjoyed using VHDs but I generally had a host OS first, then installed a bunch of VHDs that I made bootable. Recently I’ve changed all of this on my laptop after a coworker took the time to show me a way with more flexibility (thanks Paul Stubbs!). The idea is simple: take a clean drive with no host OS and add or remove bootable VHDs as needed.
These steps describe steps that enable a few scenarios for me that allow me to:
To be very clear, these steps are for taking a brand new hard drive or wiping a hard drive clean, and then installing a series of OS’s on VHDs that will boot from disk. The advantage of this is there is no host OS, you can have as many bootable VHDs that fit on disk, and they can be copied on and off the disk at will. I also use create differencing disks (I’ll get into that in another post).
I like this technique so I don’t have to rely on a base OS. This allows me to copy VHDs on my hard disk, add them to the boot record and run. Or I can install a new OS to a brand new VHD from a DVD, USB or network install. It’s very flexible and since the VHDs boot from the metal they are run very fast!
This creates a VHD on the metal, on you hard drive without needing a host OS.
NOTE: This post contains a lot of command line operations that are if typed incorrectly can wipe a hard drive, lose its data, and make it unrecoverable. Use these steps at your own risk, I am not responsible for the outcome. I am simply sharing what works for me.
I recommend using an SSD if you can. I have found that the performance differences of running off a traditional drive vs. a SSD are tremendous. They are pricey, but I’ve been able to upgrade to an SSD and give my laptop new life.
This cleans my hard drive and sets it up for my 1st VHD that will boot off the metal. These steps only need to be done once to clean the drive fresh. In fact, I don’t ever want to do this again to the drive because it wipes it completely clean (have I repeated that enough times yet? Can you tell I am very careful?)
DISKPART
list disk
select disk 0
clean
create part primaryformat fs=ntfs label="256 GB SSD" quickactiveassign letter=c
If I followed the previous steps, I am still in DISKPART. If not, I would follow steps 1-3 in the section above first.
I repeat these steps whenever I need to install a new fresh OS. I can have as many as my drives fits.
create vdisk file=c:\win7.vhd maximum=50000, type=expandable
select vdisk file=c:\win7.vhdattach vdisk create part primaryformat fs=ntfs label="Win7" quick
Sometimes I have an existing VHD that is ready to go and I want to copy it to my computer and run it off the metal. Here are the steps I use to do that. For these steps, I’ll assume I have a Windows 7 VHD with some cool demos on it called Win7MIX11.vhd.
select vdisk file=c:\Win7Mix11.vhdattach vdiskexit
BCDBOOT x:\Windows
bcdedit /copy {current} /d "MIX11 Demos"
bcdedit /set {myguid} device vhd=[locate]\Win7Mix11.vhdbcdedit /set {myguid} osdevice vhd=[locate]\Win7Mix11.vhdbcdedit /set {myguid} detecthal on
Here is a screen capture of my Windows Explorer when I am booted into one of my Win7 VHDs. The D: drive is my physical hard drive, my SSD. Now that I see this I realize I should have made that the C drive letter. Oops. Not a big deal obviously.
The C: drive is the VHD I am booted into. The total size of my 256 GB SSD is actually 238 GB of usable space. The “Win7 Papa” VHD is booted and is expanded to 50GB. That file exists on the physical SSD. Any other VHDs are also on the SSD. here is the SSD in Windows Explorer. Notice that my file Win7Personal.vhd is expanded to 50GB … this is the VHD I am currently running (which is why its expanded). The other file, win7-01.vhd, is another VHD that I can boot into. It currently takes up 11GB, tho it will also expand to 50GB when I boot to it (and if I do boot to it, the other VHD will no longer be expanded).
Here is what the Disk Management window shows for my laptop. Notice the SSD and the currently booted VHD show up here too.
This has worked very well for me recently. In addition to Paul Stubb’s help, there are plenty of other resources on the web that I used to help me along, so I wanted to include some of them here too:
None of this is earth shattering, its all been done before. I was hesitant at first due to the nature of DISKPART and how a mistake can mean I wiped the drive clean. But recently I decided to upgrade to a new SSD and I had little risk because it was already a new drive. I f you intend on going this route, I recommend researching it first using some f the links I suggested above as well as my experience in this post. But also, make sure you only try this on a drive that is clean or you are OK with wiping clean.
Original Post: Installing a Fresh OS to a New Bootable VHD with No Host OS
The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.