
The last post about virtualization was acronym galore. Double that, add a side of long-windedness, and here we go.
Primarily, some failing hardware prompted me to build the new server that I detailed in my
previous post. Check that out for a list of the components I chose and why. I built it as a VMware ESXi 4.0 whitebox with an end-goal of virtualizing my various needs for a home server environment. VMware ESXi was initially my hypervisor of choice because it's the most popular and by most accounts it's the most advanced. It would also have been more helpful to learn for my job. Everything worked great, but when I started looking into SATA storage cards to support all of my hard drives currently residing in a native Windows Home Server install, things got touchy. Finding supported storage cards for ESXi can be both difficult and expensive. I later on decided to abort and go with Microsoft's free
Hyper-V Server 2008 R2. This post deals with why that was needed in my particular situation, as well as some of my experiences installing and configuring Hyper-V Server.
As I said before, I have an existing native hardware
home server. It's been almost 2 years ago to the day that I built it. I installed
Windows Home Server (WHS) on it and all was well with the world. WHS makes for a perfect home server operating system in my eyes, even for the less than technical. It handles backups, file storage, and network sharing in a manner that's easy for everyone. For the casual user, you can buy a prebuilt, preinstalled box like the HP Media Smart series and just let the magic happen. But, what about the more technical and demanding user? WHS is designed to be headless and only accessed from the network, offering other services by installing 3rd party Add-Ins. It seems a waste that an always on and very capable machine can't (actually it can, but shouldn't) be used for running advanced services that aren't specifically written to be used as a WHS Add-In. Some common uses I had;
SABnzbd for grabbing binaries from usenet,
VirtualBox for running virtual machines (VM) and testing,
Copssh for an SSH tunnel, any many others. You can do whatever you want with WHS, as I did, but these aren't supported use cases and could potentially cause problems if you aren't careful. since then it's been extremely reliable and useful.
Since I'm already running WHS in an unsupported fashion, and I'm needing all these services as well as the occasional testing environment, I figured, why not run WHS as a
virtual machine(VM)? Then I could just have a separate VM that ran my unsupported services, as well as be able to rapidly deploy a test environment to really gimp up with no worries. This is why I built the new server and decided to virtualize WHS using ESXi.
OK, so best laid plans don't always work out just as you envision. I wanted the ability to yank out one of the Windows Home Server data pool drives and plug it into a PC to recover data if the need ever arose. This would require that the VM be able to write directly to the drive instead of writing inside virtual hard drive container files such as VMDK or VHD. After further research into ESXi in regards to my unique storage needs for WHS, I learned that you can't do what is called Raw Device Mapping (RDM) on local storage. The storage either has to be SAN based, or you have to use VMDirectPath if you want a VM to have full control and direct access to the hard drives. OK, fine. I'll just use
VMDirectPath on my
VT-d compatible motherboard to pass on the two storage cards directly to my Windows Home Server virtual machine. The only problem is that I just could not get VMDirectPath to work with this card, even though I had it working fine for a USB controller. I guess that is why they say most any PCI device SHOULD work, not that it will. I'm not going to go on record and say that there's no way to get it working, because there's tons of beeps and boops you can tweak, but it's definitely very obscure and hard to troubleshoot because information is almost non-existent.
My decision to call an audible and go with Hyper-V went something like this. "What's this? You say Hyper-V will allow me to map a local disk directly to a VM? Sweet! You also say that you can use Windows Server drivers for hardware support? Double sweet!" As a side note, Hyper-V also allows direct passthrough of USB devices to a VM. ESXi does not allow this.
I found the Supermicro AOC-SASLP-MV8 storage card, which is a PCI-e x4 card that is relatively cheap at around $100. It gives you 8 SATA ports to do with what you will. I bought two. Add these 16 SATA ports to the 8 existing on my motherboard and I have 24 total SATA ports. That matches up quite nicely to the maximum 23 SATA ports that I could possibly need on my new Norco 4020 case (20, hot swap, 2 internal bays, and 1 slim dvd drive). In addition to these, I had to pick up some SFF-8087 breakout cables to turn a single port on the storage controller into 4 SATA ports. I bought four
3Ware CBL-SFF8087OCF-10M for about $50 total on eBay. This will connect all the SATA ports to the backplane of the Norco 4020 and I'll be ready to pop a drive in whenever I'm ready.

The Supermicro AOC-SASLP-MV8 storage card.

Here's what the final build looks like, all wired up. Do note, I bought one meter length SFF-8087 cables. The 0.5 meter cables would have been more than sufficient. I would suggest those to help with wiring clutter.
Now it's time to finally install and configuring Hyper-V Server, but first, a list of requirements. For managing Hyper-V, you'll need either a Professional, Enterprise, or Ultimate version of Windows 7, or any version of Windows Vista. The management software for Windows 7 is
here, and the two pieces you'll need for Vista are
here and
here. You'll also need the install image of Hyper-V Server 2008 R2 located
here, and a very helpful script called HVRemote
here. A small USB thumb drive will be required for getting the script onto the server. Or I guess a floppy would work if that's an option for you.
Installing is the easy part and I'll gloss over that quickly. The first step is to download, burn, and boot from the free Hyper-V Server 2008 R2 install image
. You'll get a standard Microsoft wizard based install interface. Choose your language, accept the license, pick the install drive, etc. After a reboot, you'll be asked to create an Administrative password. After doing so, you should be greeted with two screens. One is a standard black windows command line, and the other is called SCONFIG.

Logged into the Hyper-V console, viewing SCONFIG and CMD.
SCONFIG helps you with some of the initial settings of the Hyper-V machine itself such at network, computer name, and user accounts. There's only a few steps you'll need to take here to get up and going, and it's actually a little easier if you'll be joining a domain. I'll be configuring mine for a workgroup.
Follow these steps to configure everything you should need in SCONFIG.
Step 1 - Select 1 and then W to choose Workgroup.
Step 2 - Select 2 and then type in the server name you want. I chose to be creative and name mine Hyper-V.
Step 3 - To manage the server, you'll need to create an account with the same name and password that you use to login to the PC on which you plan to manage the server. For instance, on my primary PC, that I'll be using to manage Hyper-V, I log in as Joe. On the Hyper-V server, I create a username Joe with my same password. If the username and password doesn't match, you won't be able to connect later on with the Microsoft Management Console (MMC) Snap-In. Be sure to pay attention to the case sensitivity. Also, if your username has a space, be sure to enclose your username in quotes. So, select option 3, type your username and then give it a password.
Step 4 - Select option 7 and E to enable remote desktop. Then select option 2 to allow any version of remote desktop to connect. This still requires a username and password, so it's still secure.
Step 5 - If you want your server to get an IP address via DHCP, you can skip this step. Otherwise, select 8 to get into network settings. Choose the number that correlates to your NIC and then give it an IP address with option 1 and a DNS server with option 2. At this point, you should actually be able to remote desktop to your server's IP address and finish configuration from there. It's up to you.
Now it's time to run the extremely handy HVRemote script created by John Howard, a senior program manager at Microsoft. This script will save you a ton of time while setting up all of the security policies needed to do remote management in a workgroup. Hyper-V is designed for a domain and Active Directory, and in that case all of the security policies would already be in place. Setting everything up for a workgroup can be done manually but wow it takes forever. Dive into the nitty gritty details if you like. Otherwise, download the script and put it on a USB thumb drive. Plug it into your server and pull up the CMD window.
Try to figure out which drive letter the thumb drive is and change to it. Mine was F:\ but yours is probably different. Once you're there, run the script by typing "cscript hvremote.wsf /add:Joe". Replacing Joe with your username of course. After a moment you'll be back at the command prompt and ready to move to the PC you intend on using for management.
You'll need to run a couple of commands using HVRemote on the management PC as well. First, open a CMD window with elevated privileges. This can be done by going to "Start > All Programs > Accessories". Right click on "Command Prompt" and choose "Run as administrator". Then find the directory where you have hvremote.swf and run these commands. "cscript hvremote.wsf /mmc:enable" and then run "cscript hvremote.wsf /anondcom:grant". Once you've done that, you should finally be done with all of the CMD windows.
Install the MMC Add-In software that I mentioned in the requirements for the OS you're using. Once the software is installed, you'll have to go to the Control Panel to turn the feature on (weird, right?). Go to "Control Panel > Programs and Features" and click on "Turn Windows features on or off". In this window, go to "Remote Server Administration Tools > Role Administration Tools" and check the "Hyper-V Tools" box and hit OK. Hyper-V Manager should now be listed under Administrative Tools on your Start Menu. You may have to enable the System Administrative Tools under the Start Menu properties if you don't see it, or just run it from the Control Panel.

Hyper-V Manager running.
Now that Hyper-V Manger is installed and running, it's time to really start playing. Click on "Connect to Server" and then enter your server's hostname and OK. If you have a problem connecting, you may have to create an entry in the HOSTS file (C:\Windows\System32\drivers\etc\) that points the server's hostname to it's IP address. I'm not exactly sure why this is an issue for some, but it didn't take me long to figure out that others were having the same problem. It's obviously some type of DNS resolution problem.
Hooray! We can now start making VM's willy nilly. Or can we? Depending on your situation, you may need to install some NIC or storage drivers or something. If you're network card isn't working, I'm sure you know this by now. Later on you may also discover that all of your storage devices aren't showing up. I had to manually install the drivers for the Supermicro AOC-SASLP-MV8 cards. It's a little unorthodox, but not really that hard. Take the x64 drivers (got mine from the driver CD) and copy them to a thumb drive. Basically you're looking for an inf file and it's associated files. Plug the thumb drive into the server and pull up the CMD window (either locally at the server or via RDP). Browse to the folder where the drivers are and install the driver by running "pnputil -i -a *.inf". This will install any inf drivers in the folder. After rebooting you should be good to go on the driver front.
Now, back to the Hyper-V Manager to create our Windows Home Server virtual machine. First, click on "Virtual Network Manager" on the right-hand side to set up, oddly enough, our virtual network. Choose "External" and then click "Add". I named mine the once again very creative "Home Network". Choose your NIC in the drop down and then click OK. Now at the top right of Hyper-V Manager click "New > Virtual Machine..." and you'll start the VM creation wizard. I named mine "WHS", gave it 4gb of RAM (overkill, but can be changed later), told it to connect to "Home Network", and then I created a 70GB hard virtual hard disk (VHD). You can create whatever size VHD you'd like, but 70GB seems to be right about the minimum for WHS. I want the WHS system drive to be as small as possible since it's virtual. Later, I'll add raw disks to the VM to add to the data pool.
For the actual install, you can go directly from a disc, or copy over an ISO file from which to install. I chose ISO since I figured it to be faster, but for some reason, I could never get an install to work from an ISO hosted on a network share. To get around this, I created a network share on the server so I could copy the ISO over to the server's local storage. Thanks goes to my friend and co-worker Darren (thanks Darren!) for telling me how to use Computer Management to connect to a remote PC. On the management PC, right click "Computer" and then "Manage". At the top left, right click "Computer Management (Local)" and then "Connect to another computer...". Yeah, it seems simple now but I didn't know you could do that. Enter the server's IP and click OK. Then, open up "System Tools > Shared Folders > Shares". Right click in the window on the right side and then "New Share...". You can then browse for or create a folder to share on the network. Select or create the folder you want, click OK, and then hit Next. Give the share a name and then Next. I chose the third option "Administrators have full access; other users have no access" and clicked Finish. Now you should be able to copy an ISO over to your server by going to "\\Hyper-V" (or whatever you named your server) and then into the share.

Connected to Hyper-V with Computer Management.

Browsing the share I created on Hyper-V for copying over ISO images.
Once you've got the disc in the drive, or the ISO is on local storage, choose the appropriate setting under "Installation Options" in the VM wizard. After you click finish, you should be back at the main Hyper-V Manager window. Select the VM you create at the top middle and then click the Start button near the bottom right. This obviously starts up the VM. Click Connect to open a console view of the VM. Now, just follow the standard Windows Home Server install process. Keep in mind, the install will be SLOOOOOOWWWWW. Microsoft hasn't optimized the install environment as well as VMware. After the OS installs though, everything is quite peppy. Especially after installing the Integration Services. Speaking of which, that's probably the first thing you should do after the install completes.
WHS should now be fully up and running. The last step is to connect all of the data drives to the WHS VM. If you plan on having WHS write to raw hard drives like I do, first you have to go into the CMD window on the server and offline the disk using Diskpart. Type in "diskpart" and hit enter. Now, type "list disk" to view all of the disks in the server. Decide which one it is that you want to present to WHS natively, and type "select disk 1" or whatever number yours is. Type "offline disk" and enter and the disk will now be offline and available to be presented as a raw disk.

All of my disks offlined except Disk 0 and 1 that I used for virtualization needs.
In Hyper-V Manager, select WHS and click on "Settings". On the left, click "SCSI Controller". Select "Hard Drive" and click Add. Choose "Physical hard disk:" and then select the actual drive you want to be associated directly to WHS. Click OK and that should be it. The drive will show up under WHS as a drive not added to the pool No rebooting required. Add this drive to the pool in WHS as you normally would and it will start using that drive just as if it were native. Wash, rinse, and repeat as necessary. WHS is now fully running and configured!

Connected to WHS through the Hyper-V console view. All of the disks are showing up as native except the virtual system disk.
One last thing I wanted to mention. For my build, I had a single 1TB drive on bay 1 of my server. This would house the Hyper-V system and all of the VMs, and I would back up the VMs to a second drive in bay 2. I initially planned on using the top 4 bays for VMs and VM backups, and the bottom 16 bays would be used for drives connecting directly to WHS. After evaluating various backup strategies for Hyper-V, none of them seem adequate to me. I believe host level backup on Hyper-V Server is still a work in progress unless you want to spend money on an enterprise solution of some sort. My solution was to enable software RAID1 on the C: drive. That way if the drive in bay 1 dies, everything is mirrored over to the drive in bay 2 and I haven't lost anything, and I don't even have to reinstall. I just yank out the dead drive, replace it and rebuild the mirror. Yes, I know it's not a true backup since it's off site, but it keeps the hard drive from being a single point of failure. As for the other 16 bays, WHS will take care of the duplication for all of that data.
Here's how to enable a software RAID1 volume in Hyper-V Server. For my example, "Disk 0" is the disk, and "Volume 0" is the partition where Hyper-V is installed. "Volume 1" is the 100MB volume that is created by default by Hyper-V (and Windows 7). "Disk 1" is the empty and formatted drive to which I want to mirror everything. You'll need to substitute the correct numbers for your specific setup.
First, go to the CMD window on the server and run "diskpart". Before we can mirror anything, we have to convert the disks to dynamic. Type "select disk 0" and then "convert dynamic". Do the same for "disk 1". Now, "select volume 0" and then "add disk=1". This starts the mirroring process. Do the same for "volume 1". It can take a few hours for it to build the mirror. During the build process, if you type "list volume" in diskpart, it will show "Mirror" as the type, and it will say "Rebuild" under the Status. After the build is complete, the Status will change to "Healthy".

Showing the disks and volumes after everything is configured how I like. Disk 0 is fully mirrored over to Disk 1, and the rest of the disks are offline so they can be tied directly to the WHS virtual machine.
It took us a while to get there but I'd say it wasn't all that difficult. As you can see in one of the screen shots above I've already created a few other VMs for various purposes and services. I now run WHS as it was intended, besides the fact that it's virtualized. There's less chance that I'll install something I'm not supposed to and mess everything up. I can easily roll out a VM for testing some new software and then just blow it away when I'm done. I have a linux VM set up for SSH tunneling. I even have a PowerUser VM created that is the only "user" in the household with write access to the shares on WHS (except for the Public share). That way I can point iTunes or something to the Music folder share without worrying about it totally messing up my organization structure or creating a ton of thumbs.db files. PowerUser also runs a TeamSpeak server, FTP server, SqueezeBox software, and a couple of other services that aren't supposed to be installed on WHS. Everything is much more flexible and functional. I've been very pleased.