Friday, October 25, 2013

Virtual Machines as Primary Workstation

NOTE:  This idea does not work; the diff files from the linked clone rapidly grow to the full capacity of the original drive.  But I will leave this post so you can follow my crazed mental state...

Imagine, if you will, the following scenario:  A hapless computer tech/geek/programmer has spent several weeks or months working furiously on his desktop computer.  He flees out the door early one morning to hop on an airplane, and very carefully totes his precious laptop with him so he can continue to work on it.  The total travel time is a laborious 30 hours, but no worry, he will get some work done on the laptop.  While stuffed into a seat somewhat narrower than a conservative politicians mind at 30,000 feet, he opens his laptop, cracks his knuckles (generating some furious shushes and a stern glance from the lead flight attendant that he, of course, assumes is a flirty wink)  and prepares to be productive.  He’s got Dropbox, so he has all his latest files and code, so he is set!

But wait.  Over the weeks (or months) that he has focused his work on his desktop he has applied numerous patches, tweaked his development t environment , installed utilities and, worst of all, he discovers that the version of SQL Server/Visual Studio/Favorite App was upgraded on his workstation, but he forgot to upgrade it on his laptop and now he can to little or even no productive work!  If he’s lucky, he has his ISO files on a small HD with him and he can spend the next several hours installing the latest software (if he remembered to sync his portable drive), and trying to remember all the tweaks he applied over the past months, etc.  If he is unlucky, he does not have his ISO’s and other needed files and will have to wait until he gets somewhere with decent Internet access to start getting his laptop into a fit state to be used.

So, while this never, ever happened to me on a trip to Australia, I have adopted the habit of doing my development work primarily on virtual machines.  This has several advantages.  First, as virtual machines are completely portable (even from Mac to PC via Fusion and Workstation), my development machine on my laptop is always the same as my development machine on my desktop – I simply use the same VM files on either one.  Another benefit is that when I upgrade my physical computer (desktop, laptop or both), called the host, I don’t need to waste any time installing all the apps, patches, services, etc. before I can get productive again.  Nor do I need to try to remember all the favorite tweaks I have accumulated over the past.  I simply need to install VMWare Workstation or Fusion onto a clean OS, and I can start running my development virtual machine immediately.  And the snapshoting features of Workstation are very, very cool.

However, it starts to get to be a problem when you VM(s) are getting to be 60 to 80GB and more (It’s not even that much fun when they are just 40 GB).  Why?  The most common way you are likely to transfer your VMs from machine to machine is over USB or LAN.  It will start taking 10+ minutes over gigabit Ethernet (or USB3), and 30+ minutes over USB to copy those files when file sizes are over 60GB.

So how to get my large VM to run on multiple different computers without always having to copy the files back and forth?  I decided to use linked clones.  I created my base VM, took a snapshot called, cleverly, “BASE” and set the VM as a template (Virtual Machine Settings à Options à Advanced).  I further set the template directory to read only.  This base template VM, which by itself (in my case) is about 40GB, will be copied to all the machines I am likely to use, and will live on a USB3 thumb drive as well.  Next, I created a linked clone to the template VM, and coped those files as well to the USB3 drive.  After a few boots, configuration tweaks, etc. this VM is about 2GB on size.  Once the base VM exists on my various workstations, all I have to do is copy my linked cone (I find it runs poorly from a USB3 Flash Drive) to whichever machine I will be working on.  By keeping the paths to the parent (base) VM the same on all my machines, I won’t have any trouble.  If the path differs, I will be prompted to point the VM to a parent VM, which is quick and painless.

I can use SyncToy to make the linked clone copies even more efficient, as only the 2GB disk extents that have been modified will be coped.  So later on, as even my linked clone grows to tens of GB, I may still only be transferring a few GB to sync it up.

Friday, October 18, 2013

Broken Administrative Tools Links

So today I noticed that many of the Administrative Tools in my control panel were showing as generic shortcut icons.  The did not work, and even the properties of the icon did not allow me to try to reconnect the shortcut to the actual program...   Curioser and curiouser...


As a sane & rational IT person, I dropped everything, including my martini, and focused intently on this problem.  Not a day would go by that I would sleep, nor a night be squandered gaming until this was resolved!

Although I am uncertain why this happened, I did discover that simply copying the shortcuts from another system worked fine.  The folder, which is hidden by default, is located at:

  • C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
And I had to alter the permissions so I could modify the folder.  I then unaltered them after I was finished.



Monday, October 7, 2013

Visual Studio 2012 and SQL Server Data Tools

OR: Are you Fucking Kidding Me?


So, let's ignore the fact that Microsoft insists on on installing a previous version of Visual Studio so you can work with your current version of SQL Server, or that as part of the installation of SQL Server, you are given the option to install something called "SQL Server Data Tools". Which is, of course, a completely different product from what Microsoft aptly calls "SQL Server Data Tools". I swear to God. Instead let's focus on the fact that when you download the SQL Server Data Tools (not the SQL Server Data Tools that you just installed, but the other SQL Server... uh... never mind), it simply will not install. Why? Because of a certificate error ("A required certificate is not within its validity period"). There is little other assistance available with this error, and one is left to wander the web searching to root certificate updates or binary chickens to sacrifice.

The answer, of course, is to set your system clock back to late 2012. Are you fucking kidding me?

I also learned, after many hours and many false starts and after reading many pages which indicate the install order does not matter that it does, indeed, matter during the preparation of a sysprep image.  You will be unable to install SQL2012 in sysprep mode if another installation (Data Tools?) installs SQL components in a non-sysprep supported mode.

Steps to install a sysprepped image with VS2012, SQL2012, SSDT + SSDTBI

  1. Install OS, boot to audit mode, update
  2. Install tools, vmware tools, common utilities, Office, etc.
  3. Install SQL Server 2012 in sysprep mode
  4. Install Visual Studio 2012
At this point, you cannot proceed with any more image preparation.  Installing SSMS, Data Tools, etc. seems to put SQL Server Image Prep into an unsupported state, and any attempt to complete the SQL Server installation will end with an error.  So, pull set the system/virtual machine to boot into OOBE, and pull the image or save the VM as a template.  After configuring the system as a usable workstation, you can proceed to the final steps:
  1. Install SSMS
  2. Install SQL Server Data Tools Business Intelligence
  3. Set system date/time back to Nov. 2012
  4. Install SQL Server Data Tools

There is an excellent blog on SSDT and the miasma of confusion surrounding it here:

http://blog.nwcadence.com/sql-server-data-tools-clearing-up-the-confusion/



Cheers,
Kurt