Hyper-V virtualization in a flash, drive that is – Part 2
In part 1, we installed the Hyper-V server to our USB drive, and now in part 2 we’ll bring it to life.
Our ingredients for part 2:
- Hyper-V enabled USB Drive (completed in part 1)
- Hyper-V MMC Management Plugin used on our 2nd computer to manage the virtual machines we install on our Hyper-V computer. (select your appropriate Win7 or Vista download)
- Windows 7 (note this needs to be Win7 Ultimate, Professional, or Enterprise. MS was lame and won’t let Home Premium join the fun)
- Windows Vista
- MS Hyper-V team’s configuration tool HVRemote
To begin part 2, reboot your PC with the USB drive in it. When you reboot, adjust your BIOS settings to select the USB drive to be the first boot device. Each BIOS is different so you’ll have to browse around to find your specific settings. Once you have it selected as the first boot device, save the changes and reboot. On reboot the USB drive will initiate it’s first setup procedures. You’ll see a black screen for a bit and then the customary windows green bar doing it’s thing. (I apologize for the quality of these pics, only had a crappy iphone camera around at the time)
Hyper-V will begin to do it’s thing, starting services
Then it installs the devices
On to system settings
A reboot and splash screen later, and we’ve got action
Create an administrative password. The next screen you come to is the main Hyper-V Management console on the server. It’s comprised of 2 windows, the scconfig and cmd windows. Sconfig is the initial program that runs on startup to help configure Hyper-V, and CMD is the basic command line to do any configurations needed outside of sconfig.
There are a series of initial configuration options in sconfig, most of which are very basic. I know most people cringe when they see any sort of command line interaction, so I’m going to walk you through the initial configuration in as few of steps possible so you won’t have to deal with these screens ever again. I didn’t take screenshots for the first few steps as it’s just text entry for the most part.
Step 1 – Setup workgroup setting. Enter 1 in the screen and hit enter. Type W for workgroup, and enter again. Type the name of the workgroup you have setup in your environment, or if you don’t have one set up you can leave it as workgroup. It’ll give you a prompt saying you’re now joined.
Step 2 – Give your new Hyper-V server a name. Type 2 and enter. I’ll be original and call it Hyper-V. A restart may be needed here, if so continue at the next step when it’s back up.
Step 3 – Add a local administrator. In order to manage the Hyper-V server, we need to have the very same user ID on Hyper-V that we are going to use on our management computer. If on the management PC your user ID is John Doe, you need to have a John Doe ID setup in Hyper-V as well. Type 3 and enter. Notice the user ID I’m going to use has a space in it, so a hint for anyone with a space in their username to surround your ID in quotes, I entered “John Doe”. It then brings you to a screen to enter your password. There are strong password enforcement rules in place here so make sure you have an uppercase, lowercase, and numeric character along with at least 8 characters or it’ll throw an error. If it does, just start over with our step 3 here and re-do it. It’ll ask you to enter the password again, and then John Doe is ready to go on the Hyper-V server. I haven’t tried it where my management PC had a different password than the Hyper-V PC, so I’d change the password on your management PC to match if the initial password wasn’t up to snuff. And shame on you for using a weak password 😉
Step 4 – Enable remote desktop. This allows us to work on the sever without having to be at the console. Enter #7, enter e, select 2 as we most likely don’t have a means for network based authentication in our workgroup environment, and click enter. Don’t worry, even with 2 you’ll still need a username and password to connect. Now enter #8 for network settings to see what the IP address is. It should list the IP address and network card description under the available network adapters. Write down the IP, and head over to the management PC. Fire up the remote desktop client and enter the IP of the hyper-v server. Log in with the ID we created in Hyper-V, so I’m using John Doe. If you get a certificate pop-up for the RDP connection, click yes and you’ll be connected.
Step 5 – Run the HVRemote configuration script on your Hyper-V server. This tool automates the various configurations that have to be performed both on the Hyper-V server and on the management computer you’re going to use. If you want to see all of the steps that they automated in this script, feel free but trust me it’s much easier the HVRemote way. The reason for most of the configurations is that Hyper-V is really designed to run in an Active Directory environment, and since we’re going to run it in a workgroup environment the tool has to configure our remote access, security policies, etc behind the scenes. In order to get the script onto the server, you’ll need some sort of storage device to put the script on and connect to the Hyper-V server. Since we’re all about USB drives in this write-up, that’s what I used. Take any old USB drive, put the hvremote.wsf file on it and attach it to the Hyper-V server.
Now, that it’s connected, switch to our nice cmd window. I practice the great art of guess which drive letter the computer assigned the new USB drive, and by guessing several letters at the command line, it turns out mine was J: You can do this by just typing d: and then enter to check the d drive, and so on. A simple dir and then enter will list the contents of that drive. If you know a more elegant means to find the drive, more power to you! Once you find the drive that you put the hvremote.wsf file on, browse to the folder that has the file in it, or if it’s in the root of the drive you’re ready for the next step. Type the following command cscript hvremote.wsf /add:”John Doe” Replace John Doe with whatever user ID you created on the Hyper-V server and you don’t need to use quotes unless you have a space in your user ID. The script will work its magic, and you’ll end up back at a drive letter prompt.
Step 6 – Run the HVRemote configuration script on your management PC. Get to a command line on our management server, and browse in the command line to the directory where you have the hvremote.wsf file. Hint, you need to run an elevated command prompt, not a “regular” one, otherwise it won’t work. You can use the dir command to list the directories, and the cd command to browse in the sub-directories until you get to where you have the file. Once you’re there, we’re going to run 2 commands, the first being cscript hvremote.wsf /mmc:enable When that has completed it will take you back to the command prompt, and you need to run the next command cscript hvremote.wsf /anondcom:grant and you’re back to the command prompt again. Phew, enough with that command prompt for now.
Step 7 – Install the MMC Management plugin. Double click on the downloaded MMC update and install on the management computer. I’ll walk through on Windows 7, so if yours is Vista it may be a bit different. Once installed, go to start – control panel – programs and features. Click on the turn windows features on or off link in the upper left of the screen. A pop-up will show up, and look in the list for the Remote Server Administration tools. Open that drop-down, then open the role administration tools drop-down. In there is the Hyper-V tools checkbox. Select that one and click OK. It’ll do its thing and install. Once it’s done, go to the start menu, administrative tools, and you should see a Hyper-V Manager option there. If you don’t have your start menu configured to show administrative tools, you can get to it through the control panel as well.
You’ve entered the main management console for the Hyper-V environment. As you’ll see, you’re not connected to anything yet when it first opens. Click on the Connect to Server link in the upper right of the console. That should bring you to a Select Computer prompt. Change the radio button to another computer, and type in the HOSTNAME of our server that we’ve setup. Since I named mine Hyper-V, that’s what I entered. DO NOT enter the IP address of the server because for some reason Hyper-V needs to work off of hostname. If you get an error after connecting, something like below it’s ok we’ll deal with it in step 8.
Step 8 – Set up the hostname for Hyper-V on the management computer. I really don’t understand why we have to do this step, but for some reason MS didn’t make the hostname resolve very well in DNS on the Hyper-V servers. So, to fix that we’re going to add our own record to the hosts file to help resolve the hostname to an IP address. Open up an explorer window, and browse to C:\Windows\System32\drivers\etc\ and open the hosts file in notepad. Mine looked like below.
Add a row below the # commented out sections using the IP address for your Hyper-V server and the hostname you assigned. Save the hosts file, and you should be ready to rock and roll.
Step 9 (maybe) – Before we build our first virtual machine, notice we haven’t talked about any drivers yet for the hardware in the Hyper-V PC. How will you know if you need to do anything extra or not? Well, skip to step 10 and give it a shot. If a nic shows up and your hard drives are there, that’s all that’s needed to get started. If not, follow along in this section to get those other drivers installed. If you couldn’t find an IP address or network adapter listed when selecting option 8 from the Hyper-V command window before, that’s a good sign that the NIC driver wasn’t included. Or, when you go to setup a VM and there aren’t any hard drive locations available to select from during the VM setup wizard, or some of the hard drives are missing, that’s a good sign that the storage chipset drivers weren’t included.
Have no fear, there’s a way to get those pesky hardware devices installed that Server 2008 R2 doesn’t include by default. It follows a similar process to running the hvremote.wsf file on the Hyper-V server, only this time you’re going to take the driver files. If it’s your NIC or your storage drivers, you’ll need to download x64 capable windows drivers for your device. Then, extract the drivers into a folder making sure there’s a .inf file in there. That’s the file that windows is going to trigger off of to install the drivers. In one machine I built I was using a Supermicro AOC-SAT2-MV8 PCI-X SATA card. Windows didn’t detect it automatically, and I had to go in and install the drivers. I extracted the drivers to a folder and put them on the USB drive. Then I browsed to the folder in the command window on the server until I got to the directory with the extracted drivers and the .inf file. To install the drivers, I ran the following command pnputil –i –a *.inf That command looks for all .inf files in the directory, and installs the associated drivers. If you want you can call out explicitly the inf file’s name in place of the asterisk, but either way works. Then, after it successfully installs, a restart later and you’re ready to go.
Step 10 – Fire up the Hyper-V MMC, connect with the hostname, and we’re in a pretty GUI interface, hurray! No more of that command line junk from now on 🙂 So we’ve finally made it to the interface to create a test VM. If you don’t have a WHS license available, you can download the evaluation copy to work with.
In the MMC, the first thing we need to do is configure the network settings, so our VM can connect to a network. Click on the virtual network manager in the right hand corner of the screen. We’re going to add a new external virtual network so it can talk to other computers on our physical network. That’ll bring you to a screen where you can give the network a name, and select the external network adapter you want to connect to this network. We’re not going to get into management networks vs production networks in this write-up, so for the time being you can leave the allow management OS to share the connection checked. Finish that step and you have a network setup that you can connect VM’s to.
Step 11 – Create VM!. In the upper left of the screen, click on new, and then virtual machine. Give your VM a name, and decide where you want to store it, either in the default location or somewhere else depending on the hard drive structure in your PC.
Next, select how much ram you want assigned to the VM, also depends on how much you have available on the PC.
In the next screen, choose what network you want your VM to connect to, select the one you just created.
Now,create the VHD that the VM will run off of, since we don’t have any other VHD’s created we can make a new one, choose the size, and choose where to store it.
On the installation options screen, if you have a DVD drive attached to your Hyper-V PC, you can just put a WHS disk in there. If you have downloaded the ISO, you need to physically attach it to the Hyper-V server to browse to it. I use a portable HDD. In theory, you should be able to browse the network through that prompt and find your ISO on a file share somewhere, but regardless what you make your file share and NTFS permissions, it throws an error from my experience. If you can get it to work, more power to you but after much fuss I was repeatedly greeted with this screen.
Anyway, MS screwed up there by not including the feature to browse for an ISO from a share, so choose your ISO storage method that gets the file local, review, and finish.
Once the VM has been created, click the green start button on the right hand side of the screen to start your VM.
You can open a console view for the VM by clicking connect. From here on out it should be no different from installing an OS on a regular machine.
The only difference is once it’s installed, you need to install the “integration services” to make the VM work better.
Step 12 – Enjoy! Well there you have it, a running test WHS on a baremetal Hyper-V Server 2008 R2 all from a USB drive. Could MS improve a few steps in this process to make it easier?…they sure could, but we got there anyway. Keep in mind there are other configuration options out there to tune your VM’s, hardware, etc but this will get you the basics.
Stay tuned for more write-ups on how to do this comparable process for ESXi 4.0, as well as the simpler host-based virtualization options too. Auf Wiedersehn!