THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Merrill Aldrich

Small-Footprint Laptop Lab

Champagne Dev VMs on a Beer Budget

Others have posted on this very topic, but I rebuild my home/dev VM lab this past weekend, and it went so well I thought I’d share the steps I went through, in case it helps someone else to get started. I got my start doing this a while back with a very helpful post by Jonathan Kehayias on Virtualbox, but I have evolved my home lab since.

As I see it, today you have two choices for this sort of work

  1. A cloud service like Azure or Amazon, etc.
  2. A small, local VM farm on your laptop with your own storage and hypervisor.

There are advantages and disadvantages to each, obviously. Using the cloud you can have zero footprint on your own hardware, and not worry too much about disks and so on. On the other hand, you are tied to an internet connection, which can cramp your style when doing presentations.

The cloud frees you from a lot of setup tasks. Setup can be, depending on your perspective, dull work you need to plow through or a learning experience. I personally still like going through the process because I learn so much each time. Building servers and performing installation is still part of my job, at least for the foreseeable future. With the cloud you typically click through a selection from a catalog and your VM comes pre-built.

Just for the experience, I did both in the past few days.

Azure VM

Azure is quite straightforward. Here’s a screenshot showing an RDP session to my remote Azure VM, which came with SQL Server 2014 CTP preinstalled:

AzureRDP

This is a VM with SQL Server installed – not the Azure PaaS SQL Server offering – so I have the whole OS to fool with here. Creating this was super simple. I have the advantage of an MSDN subscription, which provides credits on Azure for dev/test work. I activated that, and then just followed the instructions on the web site to provision a VM from a catalog image of a Windows 2012 / SQL 2014 CTP virtual machine. Literally click New > Virtual Machine > From Gallery and choose from the catalog.

You end up with the machine, RDP access, and also a nice portal dashboard with stats about the VM:

AzureDB

A few things commend this approach:

  1. Super easy
  2. Nothing on your machine
  3. Not permanent – the VM can be deleted easily when you are done
  4. This is what the future looks like, truly. It’s useful to learn about it and mitigate what Grant Fritchey has aptly called Buggy Whip Weaving.

Old-School VMs

ExtSSDIt’s still feasible, of course, to install VMs locally, and these days it doesn’t cost much. I do this with 16 GB RAM in my laptop and a modest USB 3 external disk enclosure with a Crucial SSD inside. This setup works well for demo and learning VMs. I did have to purchase a USB 3 express card, my laptop lacking built-in USB 3, and the only downside is that the express card itself has proven dodgy*. It does not like fancy stunts like “Sleep” or “Restart” or “Eject” and so on. But I blame the card, not the solution architecture.

Hosting the VMs takes some hypervisor. In my case I have tried several but settled on Windows 8’s built-in Hyper-V. It’s free with the OS, all the basics work, and it has good PowerShell support, which I appreciate.

The main challenges with Hyper-V I experienced:

  1. No easy clipboard support to copy and past into and out of VMs with the console
  2. It just flat will not work to share my wifi in the laptop with the VMs. In order to connect the VMs to the Internet, which I only do intermittently for stuff like patching, I have to plug in to a physical network. I believe this is by design, but I don’t exactly understand the reasoning behind it. I spent a fair amount of time trying to fight this one but gave up.

Steps

For this generation of my home lab I followed this basic outline:

  1. Download Windows Server 2012 Datacenter Evaluation from Microsoft as a VHD. This is a pre-built virtual hard drive with the OS “installed” on it, ready to complete setup and use.
  2. Download SQL Server 2012 Enterprise Evaluation Edition as an ISO. I went this way because I do want to go through the setup steps.
  3. Extract the delivered VHD download to my external SSD disk and rename it.

For the setup I wanted, I need a domain controller and three or four SQL Servers. SSDs are fast, but capacity is expensive, so I found I could save a lot of space by using Hyper-V’s differencing disks. This basically allows you to make a “parent” hard drive image file, and then derive multiple virtual hard drives from it, storing only the differences. Other hypervisors also have this feature. By using this technique I am able to store four servers’ hard disks in about 28 GB of space on disk. The trick is the install order, and what will maximize the shared disk space.

Four VMs’ hard drives with Differencing:

HyperVDifferencingDisks

I got good results with these steps:

Make a parent virtual hard drive for the OS

  1. In Hyper-V manager, make a virtual machine, and choose the downloaded Windows 2012 VHD file from Microsoft as the hard drive.
  2. I use two virtual switches in my Hyper-V setup, one for internal communication and one to connect out to the Internet. I set the VM up with a virtual network adapter for each.
  3. Start the VM and go through the setup process. This process will make the "parent” hard drive in the differencing disks,  storing the bulk of the bits for the OS, but I want to embed the things that all the servers will share. So:
  4. Patch the machine by configuring Windows Update while connected to the Internet.
  5. Install .NET Framework 3.5 in Server Manager > Features while connected to the internet. This is important because SQL Server requires this, but it’s not on the VHD from Microsoft, and feature setup has to download it using Windows Update.
  6. This provides a working server hard drive that will allow us to derive the others without needing as much space as a full copy of the VHD.
  7. Sysprep this server by running sysprep.exe with the “generalize” option, so we can make clones.

Make a domain controller

  1. The first real machine is the DC. Shut down the “parent” vm above.
  2. In Hyper-V Manager, edit the properties of the virtual machine (or make a new one and specify that you’ll “attach a virtual hard disk later.”)
  3. Set the hard drive to be a new VHD file, using the differencing option. This file will use snapshot technology to retain only the blocks on the disk that are different from the shared parent disk, in a sense de-duplicating most of the hard drive content.
  4. Choose the virtual hard drive from above as the parent for the differencing disk.
  5. Boot the VM and go through the configuration tasks.
  6. The DC will want to have a static IP address. Visit Settings > Control Panel > Network and Internet > Network and Sharing Center > Change adapter settings. Right-click the network adapter and choose properties. Locate Internet Protocol Version 4. Click Properties and set the adapter to a static IP address. To keep things simple I usually use 10.10.10.1, then 10.10.10.2, then 3, 4, as I add virtual machines to the lab.
  7. From Server Manager, add roles and features, add the AD domain controller role, and follow the wizard there to set this up as the DC for the lab. I just use a domain called “arch.lab.”
  8. That gets us a little domain controller.

Make a parent virtual hard drive for SQL Servers

  1. Create a new VM in Hyper-V Manager, using the same technique: choose the option to “assign a virtual hard drive later,” then add a new virtual hard drive using the Differencing option, and the OS parent hard drive from the first section above.
  2. Boot this new VM, and run through the OS setup
  3. Install SQL Server on this vm, by mounting the SQL Server ISO file as a DVD in the virtual “dvd drive” provided by Hyper-V.
  4. Sysprep this VM, so it, too, can be cloned.
  5. Shut this VM down. This virtual hard drive will become the parent for all the SQL servers, basically de-duplicating the SQL Server product bits, and again saving space.

Make the actual SQL Servers

  1. Create three or four more virtual machines in Hyper-V manager, and for each make a new virtual hard drive of the differecing type, where the parent SQL Server VHD from the preceding section is the parent. Each of these machines will act like SQL Server is “preinstalled,” because of the previous steps, and the redundant bits will be stored only once in the parent VHD file.
  2. Start these and run through the configuration steps to set them up.
  3. Set a unique static IP address for these machines like the DC.
  4. Use Server Manager > Local Server > Computer Name to add each machine to the lab domain.

Conclusion

This was fun and educational for me, and now I have a fresh lab for talks I am giving this fall. You can, I hope, see the appeal of Azure, though. Even though I made only one Azure VM, it took a few clicks and most of the installation pain is just not there. Making the same four VMs as on my local lab, I can tell, would be fairly simple.

Update 20 Sept 2013: I found the Express card problem (Huzzah!). It was the defaults for PCI power saving in my laptop BIOS.

Published Tuesday, September 17, 2013 12:05 PM by merrillaldrich
Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Matt Finnigan said:

I was able to share my Wifi on my Win2k8 R2 server with Hyper-V role guests, using RRAS. You have to go into Features (i think) and explicitly enable a wireless service that is disabled on Windows Server. 2012 may be different, of course.

September 17, 2013 2:42 PM
 

John Pertell said:

Thanks for the walk throughs, especially for Azure. That's something I haven't done yet. I also use my Hyper-V on my laptop. I was able to use WiFi on my virtual machines by bridging my WiFi adapter with a virtual one.

September 18, 2013 10:58 AM
 

merrillaldrich said:

I guess I ought to try that wireless thing again. When I got Win8 I tried to bridge a virt switch to wifi but got nowhere. Probably B.U.F. (Biological Unit Failure)

September 18, 2013 7:13 PM
 

JasonA said:

I'll try to remember to check tonight, but I set up Win8 Hyper-V and shared my WiFi with no problems.  The only thing I had to do "odd" was to put two NICs in each VM, one attached to the virtual switch on the cabled NIC and one to the WiFi NIC.

September 19, 2013 8:59 AM
 

Dustin Jones said:

Can you share the full hardware specs for your laptop and any recommendations? I'm in the market looking to get a new laptop for this purpose.

January 20, 2014 9:12 AM
 

merrillaldrich said:

Hi Dustin - my laptop still works but it's aging at this point, so the specs (Lenovo x220 tablet / Intel Core i7-2640M + 16 Gb RAM) might not be that relevant today. I would start with these questions:

1. Do you need the lab to be portable or would it work at home? Do you take the lab to do presentations? See also http://www.newegg.com/Barebone-Mini-Computers/Category/ID-3

2. If you want it to be portable does the storage need to be all internal or can you save some money and size/weight, as I did, by storing the VM HDs on an external SSD? It works because I use the VMs only intermittently and I don't always carry that extra disk around. If you need the lab constantly then a machine with more SSD capacity internally would be better.

3. There are big, powerful, heavy laptops out there that are as powerful as a small server, and then there are very capable small ones. The trade-off is capability and display size vs. light weight and portability. For me, smaller - within reason - was better for travel and work.

4. Does touch matter at all to you? I like it but it's not a priority for everyone. What about display size? If touch doesn't matter a MacBook Pro is a very good choice - wonderful hardware.

Then check out some folks who know more than I do about portable hardware - Allan Hirt @sqlha, Glenn Berry and other SQLSkills folks, etc.

I think at minimum 16 GB RAM and SSD would be worthwhile - memory and drive speed seem to be the most important factors for VMs.

January 20, 2014 10:44 AM
 

Dustin Jones said:

Wow thanks for the quick response!

1. Yes needs to be portable and yes I do presentations at the local users group.

2.I think an external SSD would work great, don't always need the VMs.

3. Size/weight doesn't bother me to much, I don't travel to much.

4.Touch does not matter.

thank!

January 20, 2014 3:06 PM

Leave a Comment

(required) 
(required) 
Submit

This Blog

Syndication

Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement