The VM build described in this article is intended to be used for SQL Server 2012 application compatibility testing. This article describes the high-level steps necessary in order to build the VM.
Table of Contents
Prerequisites for build machine (for creating VMs on)
- Hyper-V role enabled in Windows Server 2008 R2 64-bit
- 4GB RAM available to allocate to running VMs (allow headroom for host OS)
- 200 GB free space suggested for VM building, installation media, snapshots, extra room to work in
Prerequisites for host machine (for running VMs on)
- Same as build machine, but allow for about 100GB of free drive space, preferably running on separate spindle from the host OS drive for performance reasons.
Software requirements for guest VMs (to install on VMs)
- Windows Server 2008 R2 Enterprise with SP1 (64-bit)
- SQL Server 2008 R2 + SP1 [use whatever base version you want to use for testing]
- Distributed Replay Controller & Client [install from SQL Server 2012]
IMPORTANT CONSIDERATIONS (READ BEFORE BUILDING)
- Minimize dependencies on internet connectivity if feasible for your scenario (feedback/customer experience programs, automatic updates)
- Evaluate whether or not you want to run Windows Update BEFORE you build or use a base VM. For some scenarios, software installed with Windows Update can lead to unforeseen consequences for testing or the evaluation of pre-release software. If you are building this VM for someone else, it would be wise to explicitly ask them this question!
- Some aspects of setup and configuration can be error prone, so take SNAPSHOTS as you build
Build Steps
- Create new VM, configure 4GB RAM, 2 CPUs, 120 GB dynamically expanding disk
- Boot VM and proceed with default installation of Windows Server 2008 R2 Enterprise with SP1 (64-bit). Alternatively, use a clean base VM if you have one ready to go
- Add Desktop Experience feature
- Install SQL Server 2008 R2 + SP1
- Just install database engine, full management tools, books online (no AS, RS, or IS needed)
- Setup SQL login 'sa' account to have password 'Password;1'. This ensures easy access post-sysprep.
- Finish setup, test connectivity with SSMS and decline offers to send feedback, etc.
- Install Distributed Replay Controller & Client from SQL Server 2012 disk
- Setup.exe, add features to existing installation, also add in 'Documentation Components'
- Use defaults for setup
- To verify setup is working, check log files for client to see that it connects to controller (see \Program Files (x86)\Microsoft SQL Server\110\Tools\DReplayClient\Log\)
Add Content
- On Administrator desktop, add desired desktop links and content
- Suggestions (as of 2/10/12 timeframe):
- UAFS download
- SQL Server upgrade forums on MSDN
- Connect.microsoft.com/sqlserver
- SQL Server 2012 Early Adoption Cook Book
- SQL Server 2012 books online: configure to download to local and select all SQL 2012 books
- Place link to SQL 2008 and 2012 books on desktop
- Suggestions (as of 2/10/12 timeframe):
UAFS download
- Add desktop icons for Computer, User Files, Recycle Bin
- Select auto-arrange desktop icons
- Run disk cleanup on VM drive, delete any temporary installation files, etc.
- Clear browser history, etc.
- Ensure size of VHD is approprate (account for pagefile and additional demo material)
Sysprep
- Create unattend XML that will save desktop contents and keep IE ESC disabled:
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<CopyProfile>true</CopyProfile>
</component>
<component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<IEHardenAdmin>false</IEHardenAdmin>
</component>
</settings>
</unattend>
- Save XML as unattend.xml and copy to VM in \windows\system32\sysprep folder
- On VM, load command prompt window, change folder to \windows\system32\sysprep\
- execute "sysprep /generalize /oobe /shutdown /unattend:unattend.xml"
- Optional: create snapshot, boot VM and make sure everything worked as expected
Post Build Checklist
- Snapshot sysprepped VM that is shut down, then export VM (from snapshot so a merge VHD is produced)
- Double-check exported VM settings OR alternatively just package the VHD
- Mount VHD to host OS (use disk management tool), delete the following:
- c:\pagefile.sys
- c:\temp\*.*
- c:\$Recycle.Bin
- c:\windows\temp\*.*
- defrag VM drive TWICE
- Detach VHD from host OS
- Compact VHD with Hyper-V (use Edit Disk functionality...)
- If RARing for distribution/handoff, consider using self-extracting archive option (use -sfx option) and split into manageable sized volumes. In addition, consider using the -rr option to include recovery records in the archive so that data may be recovered in the event that some get corrupted
- If RARing, also perform a test extraction locally to make sure everything works as expected. If especially paranoid, also perform a test import of that test extraction -- sometimes strange things happen