virtualization tips
TRANSCRIPT
Virtualization Tips and Techniques
Michael Otey
Technical Director
Windows IT Pro Magazine
What this session covers• General Performance Tips
• Virtual PC Tips
• VMware Workstation Tips
• Microsoft Virtual Server Tips
• ESX Server Tips
General Performance Tips
Server and Desktop Performance• Add RAM to the host
– RAM is the #1 limiting factor– Reserve 512 MB for the host– RAM per guest + 32MB
• Add CPUs– One thread per VM– Multiple threads can be spread across CPUs
• Use a fast disk subsystem– 7200 RPM, 10,000 better, 15,000 better– Multiple drives enable separation of host OS and VHDs– SAN for server consolidation
• Multipath I/O
• Add NICs– Spreads network traffic across NICs
Laptop Hardware Performance• Add RAM
– Up to the max – look for laptops supporting 4MB
• Hard drive considerations– Fastest possible
• Not 4500• 5400rpm, 7200rpm better
– Multiple spindles• Separate host OS and VHDs
• One to two active VMs at the most
VM Memory Performance Tips• Reserve adequate RAM for the host
– 512 MB• Reserve adequate RAM for guests
– 256 is the minimum• Exclude VMs from AV scanning• Run VMs in full screen mode
– Slight better performance in VMware – Noticeably better for VPC
• Disable Windows Paging of Executive Components– HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \
Session Manager \ Memory Management \ DisablePagingExecutive – Change from 0 to 1
VM Disk Performance• Make sure the host maintains at least 20GB of
free space• Create VHDs on a different disk than the host
OS• Use virtual SCSI hard disks
– 20% faster than virtual IDE• For better performance use fixed sized virtual
hard disks– No expansion
VM Performance Tips• Install Virtual Machine Additions /
VMware Tools– Enables moving more of the guest OS into the
kernel– Host drag-and-drop (Desktop products)– Host time synchronization– Higher performance drivers
• SVGA, Mouse
VM Disk Defragmentation• Multi-level Defragmentation
– Guest• Contained in VHD• Stores guest OS and file system• Regular maintenance• Third party defragmentation tools provide better results
– Raxco, Diskeeper, Winternals• Make sure multiple guest don’t schedule this for the same time
– VM• Compacts VHD – reclaims unused space• Guest must be powered of• VMWare
– VM Settings > Tools > Defragment• VPC
– VPC SP1 – Virtual Disk Precompacter– Connect Virtual Disk Precompactor.iso
%ProgramFiles%\Microsoft Virtual PC\Virtual Machine Additions\ – Run Precompact
– Host• Stores all VM VHDs• Regular maintenance• Third party defragmentation tools provide better results
Windows Guest OS Performance• Maximize hardware acceleration
– Desktop Properties (Right-click Desktop, choose properties) – Settings > Advanced > Troubleshoot– Hardware Acceleration to Full
• Turn off visual effects– Desktop Properties (Right-click Desktop, choose properties)– Appearance > Effects– Disable Use the following transition effect for menus and tooltips– Disable Show window contents when dragging– Disable Show Shadows under menus
• Set menu delay– My Computer\HKEY_CURRENT_USER\Control Panel\Desktop– MenuShowDelay 400
• Disable unnecessary pointer options– Mouse Control Panel– Disable Pointer trails, Shadow cursors
Don’t Virtualize Everything• Not all hardware implementation are good
candidates for virtualization– USB Devices
• Not all workloads are good candidates for virtualization– Heavy disk I/O– Low latencies are always needed
Microsoft Virtual PC 2004
Differencing Disks• Shared base VHD
image• Saves disk space• Do not change the
parent (read–only)
VPC VM Files• .vhd – Virtual hard disk & Differencing disk
• .vmc – VM configuration file
• .vud – Undi disk
• .vsv - Save state file
Differencing Disks• File > Virtual Hard
Disk Wizard• Create a new virtual
disk > Virtual Hard Disk
• Select the location• Select Differencing
Cloning VMs• Copy VM files directly
– Edit the .vmc revove MAC address– Duplicate server name and SID
Cloning VMs• Sysprep -\XP\SupportTools
Deploy.cab • Create a new VM and install
Windows• Run setupmgr.exe
– Answer wizard settings (automate installation, generate system name, administrative password, network settings)
– Creates sysprep.inf• Run sysprep.exe
– Select Reseal– Generate SIDs
• Remove original .VM• Copy VHD• Add new VM selecting VHD
Virtual PC 2007• Currently in beta
http://www.microsoft.com/windows/virtualpc/default.mspx
• Will remain free• 32-bit only
– Can run on 64-bit as a 32-bit application
• Supports Intel-VT and AMD-V• Support for Vista and the AERO UI• Virtual PC Express
– Vista Enterprise, Vista Ultimate– Supports a single VM
VMware Workstation 5.0
VMware Workstation Files• .vmdk - Virtual Hard Disk• .vmx – VM configuration files• .vmx.bak - Backup configuration file• .vmsd – Snapshot metadata• .vmsn – Snapshot state file• .vmss – Suspended state file• .nram – Store the VM state• .log - Records VM activity• .vmtm – VM team configuration file
Cloning a VM• VM > Clone…
– Must be powered off
• Select VM state– Current or snapshot
• Select Clone type– Linked or full
Creating a Clone Template
• VM > Settings > Options > Advanced
• Accessed by users with VM write permissions
Creating a VM Team• Teams can span Linux,
UNIX and Windows• Defines VM realtionships
– VM start together, optional delay
– Private LAN connections
• Home > New Team– Team Name, location– Add VMs
Linux and Windows File Sharing• Create a Linux VM
• Use SAMBA to access the Windows files system– Part of most distributions (www.samba.org)
• Windows System Message Block (SMB) protocol – Firewall ports
• 137,138, 139, 445
Microsoft Virtual Server 2005 R2
VS2005 Files• vhd – Virtual hard
disk & Differencing disk
• .vmc – VM configuration file
• .vud – Undo disk• .vsv - Save state file
Accessing Virtual Server 2005• Web URL
http://localhost:1024/VirtualServer/VSWebApp.exe?view=1
• Firewall– Port 1024 Administrative Interface– Port 5900 VM Remote Control
Setting up a VM Cluster• Windows Server 2003 EE• 2-Node Cluster Only• VMs must be on single host or use iSCSI• VMs must use SCSI virtual disks• Virtual disk must be fixed
– Undo feature must be disabled
• Two virtual NICs– Heartbeat– public
AutoStart Virtual Machines• Edit Configuration
Automatically Shutdown Guest OS
• Edit Configuration– General Properties
• Action when server stops
• Shut down guest OS
Script to Backup VMs
Option ExplicitOn Error Resume Next
Dim objFSO, objVirtualServer, objVM, objSaveTask, objVHD'Connect to file system object.set objFSO=CreateObject("Scripting.FileSystemObject") 'Connect to Virtual Server.set objVirtualServer = CreateObject("VirtualServer.Application")'Get virtual machine from command-line parameter.set objVM = objVirtualServer.FindVirtualMachine(WScript.Arguments(0))
'Save state of the virtual machine.set objSaveTask = objVM.Save
'Loop waiting for task completionwhile not objSaveTask.isComplete WScript.Sleep 1000wend
• Saves state and backs up:– virtual hard disks, undo disks, state, config
Script to Backup VMs'Copy virtual hard disks and undo disks.for each objVHD in objVM.HardDiskConnections If objFSO.FileExists(objVHD.HardDisk.file) Then 'Wscript.Echo objVHD.HardDisk.file & " " & WScript.Arguments(1) objFSO.CopyFile objVHD.HardDisk.file, WScript.Arguments(1) End If If objFSO.FileExists(objVHD.undoHardDisk.file) Then 'Wscript.Echo objVHD.undoHardDisk.file & " " & WScript.Arguments(1) objFSO.CopyFile objVHD.undoHardDisk.file, WScript.Arguments(1) End IfNext
'Copy .vmc and .vsv files.objFSO.CopyFile objVM.File, WScript.Arguments(1)objFSO.CopyFile objVM.SavedStateFilePath, WScript.Arguments(1)
'Start the virtual machine.objVM.Startup
VM Resource Allocation
VS2005 Hardware Virtualization• Virtual Server 2005 R2 SP1 beta2• Processor must support virtualization• Enable Virtualization in the BIOS• Enable Virtualization in the VM
– General Properties
• Verify in Perfmon– Virtual Processors Object– HVM-VP counter = 1
VMware Virtual Server 1.01
VM Files• C:\Virtual Machines\<VM Name>• .vmdk - Virtual Hard Disk• .vmx – VM configuration files• .vmx.bak - Backup configuration file• .vmsd – Snapshot metadata• .vmsn – Snapshot state file• .vmss – Suspended state file• .nram – Store the VM state• .log - Records VM activity• .vmtm – VM team configuration file
Accessing Virtual Server• Web URL
http://localhost:8333/vmware/en
• Firewall– Management Interface
• Port 8333 (8222 if SSL is disabled)
– Virtual Server Console• Port 902
Auto Start and Shutdown VMs• Right Click VM >
Settings• Options
– Startup/Shutdown
• Must specify user account or Local System
Install Guest OS from ISO• Fast diskless install• Right click VM• Settings• CD-ROM• Use ISO• Start VM
Silent Install for VM Tools• Connect CD to windows.iso
– %Program Files%\VMware\VMware GSX Server
– msiexec -i "D:\VMware Tools.msi" ADDLOCAL=ALL /qn
Configuring Virtual SMP Support• New Virtual Machine
wizard• Custom• Select Guest (guest must
have SMP capabilities)• Name the VM• Set Access Rights• Startup/Shutdown options• Processor options
Migrating Virtual Machines
Migrating Physical Machines• Microsoft Virtual Server Migration Toolkit
http://www.microsoft.com/windowsserversystem/virtualserver/evaluation/vsmt.mspx – Requires ADS (Automated Deployment Services– P2V no V2P Migration
• VMware Importer– Built-in to Workstation and Server– P2V no V2P – Imports VPC and VS2005 imageshttp://www.vmware.com/download/vmimporter/
• VMware Converter (beta)– P2V & V2P– Two way conversion
• Microsoft, Symantec BackpP Exec, Norton Ghost, VMware– Sector based– X86 and x64 supporthttp://www.vmware.com/products/beta/converter/
Other Migration Strategies• PlateSpin
– Mass migrations– Standalone Mmigration server– Oriented towared
• DIY Migration– Backup and Restore
• NTBackup• Ghost
Application Virtualization
Altris• Automatically Start
Application Layers– File > Start Layer
Automatically
• Reset Layer– File > Reset Layer
Application Virtualization• Don’t use this for AntiVirus or AntiSpyware
– Not intend for any product that uses a file system driver
• Don’t attempt to use this for VM products– This actually can work but its backward
VM Best Practises• Build your VMs seprate from the host OS
• Size you VHDs big enough
• Used fixed VHds for better performance
• Don’t put VMs on encrypted or compressed drives
• Eliminate VMs from host AV scanning
Virtualization in Vista• Virtual PC 2007 Express
• Vista Enterprise Edition
• Vista Ultimate Edition
• One Active Instance
Virtual Server 2005 on Vista• Must run IE as Administrator
• Out-of-box link fails
• Create desktop shortcut"C:\Program Files\Internet Explorer\iexplore.exe"
"http://localhost/VirtualServer/vswebapp.exe?view=1"
– Run As Administrator
VM Management Products• VMware
– VMware Infrastructure 3• ESX Server• VirtualCenter, VMotion
– http://www.vmware.com/products/vi/– Does not need AD
• Microsoft– System Center Virtual Machine Manager– http://www.microsoft.com/systemcenter/scvmm/default.mspx– Requires Active Directory
• Security– Based on PowerShell
• Scriptable
Cool Free Tools• VirtuaIQ 525
– 5 CPUs or 25 VMs– Web based– http://www.toutvirtual.com/solutions/viq_525.php
• Virtual Floppy Drive– http://chitchat.at.infoseek.co.jp/vmware/vfd.html
• Flexomizer Defrag– http://www.flexomizer.com/PermaLink,guid,ce99367e-158c-
487a-879d-b32145cc1957.aspx
VM Products• PlateSpin – PV2 & V2P
– www.platespin.com
• Leostream – P2V, Disk Synchronization– www.leatstream.com
• Acronis True Image– www.acronis.com/enterprise/products/choose-trueimage
• Microsoftr iSCSI Software iniator– http://www.microsoft.com/downloads/details.aspx?FamilyID=12c
b3c1a-15d6-4585-b385-befd1319f825&DisplayLang=en
• Microsoft Virtual Machine Additions for Vista– http://connect.microsoft.com
Additional Resources• VMware Workstation Benchmarking
Guidelines– http://www.vmware.com/pdf/WS55_Benchmar
king_Guidelines.pdf
• Virtual PC Guy’s Weblog– http://blogs.msdn.com/virtual_pc_guy/archive/
tags/Virtual+PC+_2F00_+Server+Tips+_2700_n_2700_+Tricks/default.aspx
Windows IT Pro Articles• Troubleshooter: Deciding Whether to Use a Virtual Machine with Exchange
– InstantDoc 26205• Reader’s Choice Virtualization Software
– InstantDoc 47336• Back up a virtual instance running in Microsoft Virtual Server 2005
– InstantDoc 49656• What you need to know about the virtualization formats
– InstantDoc 92862• Running SQL Server in a VM
– InstantDoc 46018• Virtual Server 2005 Cluster Setup Kit
– InstantDoc 45901• VMware Clsutering Recipe
– InstantDoc 37599
Windows IT Pro Product Reviews• VMware Workstation 4.5
– InstantDoc 42271• VMware GSX Server 2.5
– InstantDoc 39182• VMware VirtualCenter 1.1
– InstantDoc 44976• VMware ESX Server 2.0
– InstantDoc 48409• Virtual Server Face Off
– InstantDoc 45253