WIN388WIN388Using Virtual PC 2004:Using Virtual PC 2004:Tips and TricksTips and Tricks
Ronald BeekelaarRonald BeekelaarBeekelaar ConsultancyBeekelaar Consultancy
2
About the speakerAbout the speaker
Consultant and trainer from The NetherlandsConsultant and trainer from The NetherlandsMVP - Virtual PCMVP - Virtual PC
Using Microsoft Virtual PC 2004Using Microsoft Virtual PC 2004For demos, presentations and coursewareFor demos, presentations and courseware
For hands-on labs at conferencesFor hands-on labs at conferencesSeveral security labs / XP SP2 labsSeveral security labs / XP SP2 labs
For classes, studying and testingFor classes, studying and testing
Contact:Contact:E-mail: [email protected]: [email protected]
3
AgendaAgendaTopicsTopics
How does Virtual PC workHow does Virtual PC workArchitectureArchitecture
NetworkingNetworking
DisksDisks
Hands-on labs at TechEd 2004 AmsterdamHands-on labs at TechEd 2004 Amsterdam
TipsTipsTips to optimize disk spaceTips to optimize disk space
Tips to optimize performanceTips to optimize performance
Tips for building VMsTips for building VMs
Tips for deploying VMsTips for deploying VMs
4
AgendaAgendaNot so topicsNot so topics
Not in presentationNot in presentationMicrosoft Virtual Server 2005Microsoft Virtual Server 2005
Comparison with other productsComparison with other productsSuch as: VMware WorkstationSuch as: VMware Workstation
Upgrading from Virtual PC 5.2Upgrading from Virtual PC 5.2
5
AgendaAgendaPresentation disclaimerPresentation disclaimer
DisclaimerDisclaimerMany tips are undocumented or unsupportedMany tips are undocumented or unsupported
Many examples are unsupportedMany examples are unsupportedby Microsoft Product Support Services (PSS)by Microsoft Product Support Services (PSS)
Such as: running Win2003 in Virtual PCSuch as: running Win2003 in Virtual PC
Not necessarily "best" practicesNot necessarily "best" practicesMostly things I use myselfMostly things I use myself
EULAEULAAlways need to follow product activation rulesAlways need to follow product activation rules
Always need to adhere to product licensing ruleAlways need to adhere to product licensing rule
6
About virtual machines (VM)About virtual machines (VM)
Software running on Windows (Software running on Windows (hosthost))to create virtual computersto create virtual computers
Allows multiple operating systems and their Allows multiple operating systems and their applications to run in transportable virtual applications to run in transportable virtual machinesmachines
Each virtual machine (Each virtual machine (guestguest))is equivalent to a PC andis equivalent to a PC anda list of hardware devicesa list of hardware devices
Terms used:Terms used:vmvm = = virtual pcvirtual pc = = imageimage
7
How does Virtual PC workHow does Virtual PC workOverviewOverview
PC hardware emulation in a windowPC hardware emulation in a windowChange configuration through GUIChange configuration through GUI
Configuration stored in .vmc file (XML)Configuration stored in .vmc file (XML)and options.xml fileand options.xml file
Guest OS doesn't "know"Guest OS doesn't "know"Only need to install VM Additions in guestOnly need to install VM Additions in guest
<hardware> <memory> <ram_size type="integer">256</ram_size> </memory> ... <pci_bus> <ethernet_adapter> <controller_count type="integer">2</controller_count> </ethernet_adapter> </pci_bus></hardware>
8
How does Virtual PC workHow does Virtual PC workHardware componentsHardware components
BIOSBIOSAMI (plus APM 1.2 and ACPI)AMI (plus APM 1.2 and ACPI)
Network adapterNetwork adapterDEC / Intel 21140 Based PCI Faster EthernetDEC / Intel 21140 Based PCI Faster Ethernet
Supported by the RIS rbfg.exe diskSupported by the RIS rbfg.exe disk
SoundSoundCreative Labs Sound Blaster 16Creative Labs Sound Blaster 16
MemoryMemoryMax 3.6 GBMax 3.6 GB
CPUCPUSees only one processorSees only one processor
9
How does Virtual PC workHow does Virtual PC workArchitectureArchitecture
VirtualVirtualVirtual PC application on top of host OSVirtual PC application on top of host OS
AccessAccessCPU and memory directlyCPU and memory directly
Rest through host OS driversRest through host OS driversVM portVM port host port host port
VM SB16VM SB16 host sound driver host sound driver
......
VM disketteVM diskette host diskette host diskette or .vfd file on hostor .vfd file on host (1.44 (1.44 MB)MB)
VM CD-romVM CD-rom host CD-rom host CD-rom or .iso file on hostor .iso file on host
VM diskVM disk .vhd file on host.vhd file on host
VM networkVM network host network or between VMs host network or between VMs
10
How does Virtual PC work How does Virtual PC work ArchitectureArchitecture
config invmc-file
CPU0 CPU1
Sound
Diskette
CD/DVD
Ports USB
Network
Virtual PC
hostdriver
CPU Mem Disk
Diskfile
VPC hostdriver
hostdriver
hostdriverVPC
.iso
Software
Hardware
.vfd
VMM
11
How does Virtual PC workHow does Virtual PC workVirtual Machine AdditionsVirtual Machine Additions
Provides:Provides:Performance improvementsPerformance improvements
CPU - at 96-97% of hostCPU - at 96-97% of host
Network - at 70-90% of hostNetwork - at 70-90% of host
Disk - at 40-70% of hostDisk - at 40-70% of host
Arbitrary screen resizingArbitrary screen resizing
"Back-doors""Back-doors"Time syncTime sync
Clipboard syncClipboard sync
Shared foldersShared folders
Drag-n-dropDrag-n-drop
12
How does Virtual PC work How does Virtual PC work "Back doors""Back doors"
Virtual PCSoftware
Hardware
Virtual pc.exe
VM Additions
Z:
D:\dataTimesync
Clipboard
%temp% Drag& drop
13
How does Virtual PC workHow does Virtual PC workVirtual Machine AdditionsVirtual Machine Additions
When is VM Additions workingWhen is VM Additions workingAt startup, look at iconAt startup, look at icon
Start (or restart) service if neededStart (or restart) service if needed
Look atLook atAction/Properties/AdvancedAction/Properties/Advanced
14
How does Virtual PC workHow does Virtual PC workSpecial keysSpecial keys
Host-key + Host-key + anyanyDefault host-key is Default host-key is <right>Alt<right>Alt
<right>Alt-<right>Alt-DelDel = Send Ctrl-Alt-Del= Send Ctrl-Alt-Del
<right>Alt-<right>Alt-EnterEnter = Full screen= Full screen
<right>Alt-<right>Alt- = Prev / next VM= Prev / next VM
<right>Alt key<right>Alt key = Uncapture mouse= Uncapture mouse
Tip: After using <right>Alt-Enter (full-screen) Tip: After using <right>Alt-Enter (full-screen) multiple times, the keyboard may no longer multiple times, the keyboard may no longer respondrespond
To resolve: press Ctrl key twiceTo resolve: press Ctrl key twice
15
NetworkingNetworkingOverviewOverview
Uses a virtual switchUses a virtual switchand virtual network adapters (max 4)and virtual network adapters (max 4)and virtual "virtual machines"and virtual "virtual machines"
Three configurations (per adapter)Three configurations (per adapter)Shared Networking (NAT)Shared Networking (NAT)
Connect to host adapterConnect to host adapter
Local onlyLocal only
16
NetworkingNetworkingThree configurationsThree configurations
.1-.253.1-.253
C:\> ipconfig /all
IP Configuration MAC Address : 00-03-FF-... IP Address : 192.168.131.65 Subnet Mask : 255.255.255.0 Gateway : 192.168.131.254 DHCP Server : 192.168.131.254 DNS Server : 10.6.180.53 Lease : 17 yr, 4 day
Sharednetworking
(NAT)
Connect toadapter
10.1.2.4 10.1.2.4.4
C:\> ipconfig /all
IP Configuration MAC Address : 00-03-FF-... IP Address : 10.1.2.7 Subnet Mask : 255.255.255.0 Gateway : 10.1.2.1 DHCP Server : 10.1.2.30 DNS Server : 10.6.180.53 Lease : 7 days
Virtual PC.exe
10.1.2.710.1.2.7
10.1.2.6.6
10.1.2.610.1.2.6
10.1.2.7.7
Other VMlocallocal
10.1.2.4externalexternal
hosthost
DHCP/NAT
.254.254
Localonly
10.1.2.4.4
C:\> ipconfig /all
IP Configuration MAC Address : 00-03-FF-... IP Address : 10.4.1.1 Subnet Mask : 255.255.255.0 Gateway : - DHCP Server : - DNS Server : - Lease : -
10.4.1.110.4.1.1
10.4.1.210.4.1.2
Other VMlocallocal
17
NetworkingNetworkingAdditional informationAdditional information
Shared networking (NAT)Shared networking (NAT)DNS address is copied from host computerDNS address is copied from host computer
Default gateway is 192.168.131.254Default gateway is 192.168.131.254
Multiple VMs using NAT on some host computer cannot Multiple VMs using NAT on some host computer cannot communicatecommunicate
To create seperate networks with multiple To create seperate networks with multiple VMs:VMs:
11 Install Microsoft Loopback Adapter(s) Install Microsoft Loopback Adapter(s)
22 Ensure Virtual Machine Network Services is enabled Ensure Virtual Machine Network Services is enabled
33 Connect VM to Loopback adapter Connect VM to Loopback adapter
18
DisksDisksOverviewOverview
Hard disksHard disksIDE (max 3x) - no SCSI IDE (max 3x) - no SCSI
TypesTypesVirtual disk (dynamically expanding)Virtual disk (dynamically expanding)
Stored in Stored in .vhd.vhd file on host file on host
Fixed size diskFixed size disk
Differencing diskDifferencing diskStores Stores changeschanges from .vhd from .vhd
Linked to hard diskLinked to hard disk
19
Virtual DisksVirtual DisksDisk filesDisk files
VM disks stored in files on hostVM disks stored in files on host"Normal" disk"Normal" disk .vhd.vhd
Differencing diskDifferencing disk .vhd.vhd ( (.vhdd.vhdd))
Undo diskUndo disk .vud.vud
Saved state fileSaved state file .vsv.vsv
Note: I added custom elements,Note: I added custom elements,which are not in Virtual PCwhich are not in Virtual PC
Pie chart icons are customPie chart icons are custom
.vhdd extension is custom.vhdd extension is custom
20
Virtual DisksVirtual DisksFile locationsFile locations
.vhd disk file.vhd disk fileIn folder you specifyIn folder you specifyin in settingssettings
.vhdd disk file.vhdd disk fileIn folder you specifyIn folder you specifyin in settingssettings
.vud disk file.vud disk fileIn vmc-file folderIn vmc-file folder
.vsv disk file.vsv disk fileIn vmc-file folderIn vmc-file folder
21
DisksDisksTopicsTopics
Undo disksUndo disks
Three disk modesThree disk modesPersistent / undo-ask / undo-alwaysPersistent / undo-ask / undo-always
Saved stateSaved state
Differencing disksDifferencing disksSeveral uses:Several uses:
Save disk space / Quick testing /Save disk space / Quick testing /Phased distribution / Sequential delta VMsPhased distribution / Sequential delta VMs
Repeatable RestoreRepeatable RestoreAt Tech-Ed 2004 Amsterdam hands-on labsAt Tech-Ed 2004 Amsterdam hands-on labs
22
DisksDisksUndo disksUndo disks
Disks images can be made undoableDisks images can be made undoableSpecify folder to store undoable file per VMSpecify folder to store undoable file per VM
Stored in Stored in .vuh.vuh files ( ) files ( )
All "writes" are done to All "writes" are done to .vuh.vuh file, not to file, not to .vhd.vhd file file
Setting for all disks in a VMSetting for all disks in a VM
23
DisksDisksThree disk modesThree disk modes
Persistent
Undo-Ask
Undo-Always
Start up Running Close Running
= .vhd file
= .vud file
VM
host
Start up
3-Turn off and delete
2-Turn off and save/Commit
2-Turn off and save
1-Save state
= .vsv file
24
DisksDisksCommit hard drive changesCommit hard drive changes
CommitCommit means: means:Merge Merge vuhvuh undo file with undo file with vhdvhd file file
25
DisksDisksSaved stateSaved state
Store current "state" of running VM in a file, Store current "state" of running VM in a file, and close VM windowand close VM window
Goal: to continue later at this exact spotGoal: to continue later at this exact spot
Stored in Stored in .vsv.vsv files ( ) files ( )
Contains current memory and window Contains current memory and window settingssettings Saved
Memory contents
Window settings
Running Restore (= Start up)
26
DisksDisksDifferencing disksDifferencing disks
Write changes Write changes notnot to main to main vhdvhd disk, disk,but to other disk filebut to other disk file
Create a new difference diskCreate a new difference disk in Virtual Disk Wizard in Virtual Disk Wizard
Plus point to parent Plus point to parent vhdvhd disk disk
Stored in Stored in .vhdd.vhdd files ( ) files ( )
Is actually the same as an Is actually the same as an .vuh.vuh undo disk undo disk
Creates delta VMsCreates delta VMsDelta VMs is not an official term,Delta VMs is not an official term,I made it upI made it up
27
DisksDisksHow differencing disks worksHow differencing disks works
Read
File-a.doc
1 2 3 4
File-b.doc
1 2 4
Create
File-c.doc
1 2 3 4Grow
File-d.doc
Read only
Virtual PC
3
Write
3
3 1 2 3 4
Delete
File-d.doc
1 2 3 4
28
Differencing DisksDifferencing DisksTipsTips
Never change the parent Never change the parent vhdvhd disk. disk.It will break all delta VMs!It will break all delta VMs!
Make the parent Make the parent vhdvhd disk read-only disk read-only
When creating multiple delta VMs,When creating multiple delta VMs,make sure they are "unique"make sure they are "unique"
Computer name (rename)Computer name (rename)
Computer SID (Sysprep or other SID tool)Computer SID (Sysprep or other SID tool)
IP address (DHCP)IP address (DHCP)
MAC address (automatic)MAC address (automatic)
29
The case for differencing disks The case for differencing disks OverviewOverview
Differencing disks have many purposesDifferencing disks have many purposes11 Smaller size on host Smaller size on host
Miami.vhdd.zip: Miami.vhdd.zip: 12 MB12 MB
22 Quick testing Quick testing
33 Phased distribution Phased distributionOnly offer delta VM for downloadOnly offer delta VM for download
44 Sequential delta VMs Sequential delta VMsFool proof demo or lab modulesFool proof demo or lab modules
30
The case for differencing disksThe case for differencing disks1- Smaller size on host1- Smaller size on host
Use less space on hostUse less space on hostMiami.vhdd: Miami.vhdd: 410 MB410 MB
Works well withWorks well withNTFS compression: NTFS compression: 26 MB26 MB
Works excellent withWorks excellent withZIP: ZIP: 12 MB12 MB
31
The case for differencing disks The case for differencing disks 2 - Quick testing2 - Quick testing
Quickly create temporary VMsQuickly create temporary VMs
StepsSteps11 Create difference disk for existing Create difference disk for existing vhdvhd file file
22 Start up VM using the new Start up VM using the new vhddvhdd file file
33 (Test, test, test...) (Test, test, test...)
44 Shut down VM Shut down VMKeep Keep vhddvhdd file for later, or delete now file for later, or delete now
Costs less mental concentrationCosts less mental concentrationthan using than using Undo-AskUndo-Ask
32
The case for differencing disks The case for differencing disks 3 - Phased distribution3 - Phased distribution
Only offer delta VMs for downloadOnly offer delta VMs for download
StepsSteps11 Provide one or more "perfect" Windows XP or Provide one or more "perfect" Windows XP or
Windows Server 2003 Windows Server 2003 mastermaster VMs VMs
22 Offer delta VMs for download Offer delta VMs for downloadthat use the master VMsthat use the master VMs
33 'Relink' the delta VMs 'Relink' the delta VMsto the parent (master) VMto the parent (master) VM
33
The case for differencing disks The case for differencing disks 4 - Sequential delta VMs4 - Sequential delta VMs
Fool proof demo or lab modulesFool proof demo or lab modules
Use a separate (growing) delta VM to startUse a separate (growing) delta VM to starteach demo or lab moduleeach demo or lab module
DemoDemoUse for series of 'fool proof' demo stepsUse for series of 'fool proof' demo steps
LabLabUse to continue course at any labUse to continue course at any lab
Use for 'student proof' lab configurationUse for 'student proof' lab configuration
34
The case for differencing disks The case for differencing disks 4 - Sequential delta VMs4 - Sequential delta VMs
StepsSteps11 Create difference disk Create difference disk
22 Start up on VM Start up on VM
33 Do Do nextnext demo or lab demo or lab
44 Shut down VM Shut down VM
55 Copy and rename difference disk Copy and rename difference disk
66 Go to step Go to step 22
77 For each diffence disk, create a separate VM For each diffence disk, create a separate VM
Demo or lab can now be started fromDemo or lab can now be started fromany module, or completed sequentiallyany module, or completed sequentially
Lab module 1
Lab module 2a
Lab module 2b
Lab module 3
Lab module 4
Lab module 5
35
Tech-Ed 2004 Amsterdam Tech-Ed 2004 Amsterdam Self-paced hands-on labs - SetupSelf-paced hands-on labs - Setup
Host computersHost computers2 GB memory2 GB memory
171 labs on 270 host computers171 labs on 270 host computers
Two user accounts:Two user accounts:AdminAdmin - full administrative access - full administrative access
HOL UserHOL User - locked down user - locked down userWindows XP SP2 and Virtual PC 2004 lock downWindows XP SP2 and Virtual PC 2004 lock down
Set upSet upUse Use AdminAdmin account to deploy VMs for account to deploy VMs for HOL UserHOL User
Register VMsRegister VMs
Set options in Options.xmlSet options in Options.xml
36
Tech-Ed 2004 Amsterdam Tech-Ed 2004 Amsterdam Self-paced hands-on labs - Lab MenuSelf-paced hands-on labs - Lab Menu
Lab MenuLab MenuList each labList each labon host computeron host computer
Start multiple VMsStart multiple VMs- in order- in order- with delays in between- with delays in between
Use Repeatable RestoreUse Repeatable RestoreTo avoid long VM boot timesTo avoid long VM boot times
To avoid password confusionTo avoid password confusion
37
Repeatable Restore Repeatable Restore GeneralGeneral
Always restore at same point (saved state)Always restore at same point (saved state)Not a feature of Virtual PC 2004Not a feature of Virtual PC 2004
But can be done:But can be done:Copy the same initial save state files before each Copy the same initial save state files before each startupstartup
Virtual PC deletes save state files are startupVirtual PC deletes save state files are startup
38
Repeatable Restore Repeatable Restore SetupSetup
SetupSetup11 Enable Undo disk Enable Undo disk
22 Start VM Start VM
33 Configure desired state (log on, etc) Configure desired state (log on, etc)
44 Close VM and Save State Close VM and Save State
55 Disable Close dialog box Disable Close dialog box
39
Repeatable Restore Repeatable Restore UseUse
UseUse11 Start VM by using script Start VM by using script
Make copy of initial save state filesMake copy of initial save state files
Start VMStart VMBrings up VM in a few seconds Brings up VM in a few seconds
Which removes one copy of save state filesWhich removes one copy of save state files
22 Use started VM Use started VM
33 Close VM Close VMNo Close dialog box displayedNo Close dialog box displayed
40
TipsTipsTopicsTopics
Tips to optimize disk spaceTips to optimize disk space
Tips to optimize performanceTips to optimize performance
Tips for building VMsTips for building VMs
Tips for deploying VMsTips for deploying VMs
Tips for troubleshooting Tips for troubleshooting
41
Tips to optimize disk spaceTips to optimize disk spaceOverviewOverview
Best tip: Understand disksBest tip: Understand disks
Four relevant sizes:Four relevant sizes:a.a. In VM: maximum disk In VM: maximum disk capacitycapacity
Not so relevant to optimizing disk spaceNot so relevant to optimizing disk space
b.b. In VM: In VM: usedused disk size disk sizeStored in vhd-fileStored in vhd-file
c.c. On host: current size of On host: current size of vhd-filevhd-fileContains Contains b.b. + contains deleted files + contains deleted files
d.d. On network: size of On network: size of zippedzipped vhd-file vhd-fileBased on "patterns" in vhd-fileBased on "patterns" in vhd-file
42
Tips to optimize disk spaceTips to optimize disk spacea. In VM: maximum disk capacitya. In VM: maximum disk capacity
You cannot enlarge the maximum disk You cannot enlarge the maximum disk capacity of a vhd-filecapacity of a vhd-file
Just pick a large size up to 16 GBJust pick a large size up to 16 GBI always pick 4000 MBI always pick 4000 MB
43
Tips to optimize disk spaceTips to optimize disk spaceb. In VM: used disk sizeb. In VM: used disk size
Delete files that are not used:Delete files that are not used:Files left over from installationFiles left over from installation
Files only needed during installationFiles only needed during installation
Files that are always created anew at startup Files that are always created anew at startup or when neededor when needed
Files that are "cache" representationsFiles that are "cache" representations
Files that are backup copiesFiles that are backup copies
Files that are not applicable in the VM Files that are not applicable in the VM
44
Tips to optimize disk spaceTips to optimize disk spaceDelete files and foldersDelete files and folders
Not neededNot neededEmpty dllcache folder (-400 MB)Empty dllcache folder (-400 MB)
run run sfc.exe /cachesize=1sfc.exe /cachesize=1
restart guest (if needed)restart guest (if needed)
run run sfc.exe /purgecachesfc.exe /purgecache
Empty ServicePackFiles\i386 folderEmpty ServicePackFiles\i386 folderand $NtServicePackUninstall$ folderand $NtServicePackUninstall$ folder
from windows (-280 / - 250 MB)from windows (-280 / - 250 MB)
Delete drivers.cab / SPx.cabDelete drivers.cab / SPx.cabfrom windows\Driver Cache\i386 (-60 MB)from windows\Driver Cache\i386 (-60 MB)
45
Tips to optimize disk spaceTips to optimize disk spaceDelete files and foldersDelete files and folders
Left over from installationLeft over from installationVirtual Machine additionsVirtual Machine additions
del windows\installer\nnnnn.msi (-14 MB)del windows\installer\nnnnn.msi (-14 MB)
Ensure you delete the correct msi-fileEnsure you delete the correct msi-file
Exchange 2003Exchange 2003rd /s %temp%\SITnnn folder 3x (-53 MB)rd /s %temp%\SITnnn folder 3x (-53 MB)
del c:\Exchange Server Progress Log (-2 MB)del c:\Exchange Server Progress Log (-2 MB)
NewSID 4.03NewSID 4.03rd /s windows\system32\config\Newsid Backuprd /s windows\system32\config\Newsid Backup(-13 MB)(-13 MB)
46
Tips to optimize disk spaceTips to optimize disk spaceDelete files and foldersDelete files and folders
Rebuilt when neededRebuilt when neededrd /s windows\system32\wbem\AutoRecoverrd /s windows\system32\wbem\AutoRecover(-7 MB)(-7 MB)
del windows\inf\*.pnf (-25 MB)del windows\inf\*.pnf (-25 MB)del windows\inf\infcache.1 (-1 MB)del windows\inf\infcache.1 (-1 MB)
del windows\prefetch\*.* (-5 MB)del windows\prefetch\*.* (-5 MB)
Note - why not to do this:Note - why not to do this:This may cost performanceThis may cost performance
These files may be stored in each difference disk, These files may be stored in each difference disk, when deleted from parent diskwhen deleted from parent disk
47
Tips to optimize disk spaceTips to optimize disk spacec. On host: current size of vhd-filec. On host: current size of vhd-file
Sparse-fileSparse-fileStarts with size "0"Starts with size "0"
Writes in 2 MB blocksWrites in 2 MB blocks
Zero-filled files do Zero-filled files do notnot use space use spaceExamplesExamples
res1.dat, res2.dat (10 MB each)res1.dat, res2.dat (10 MB each)
pagefile.sys (hundreds MB)pagefile.sys (hundreds MB)
So don't worry about a large paging fileSo don't worry about a large paging file
48
Tips to optimize disk spaceTips to optimize disk spaceWriting zero-filled filesWriting zero-filled files
Write
File-a.doc
1 2 3 4
1 2 3 4
Pagefile.sys
Write
1000000000000
2 4000000000000
3000000000000
5...
1 4
Read
000000000000
11000000000000
12
Virtual PC
49
Tips to optimize disk spaceTips to optimize disk spaceHow to create an empty paging fileHow to create an empty paging file
11 Use Control Panel/System to configure no Use Control Panel/System to configure no paging filepaging file
22 Restart the VM Restart the VMExisting pagefile.sys is deletedExisting pagefile.sys is deleted
33 Use Control Panel/System to configure a Use Control Panel/System to configure a "normal" paging file"normal" paging file
New pagefile.sys is completely empty (almost)New pagefile.sys is completely empty (almost)
Tip:Tip: develop VM with high RAM setting develop VM with high RAM setting(512 MB+) to minimize pagefile.sys usage(512 MB+) to minimize pagefile.sys usage
50
Tips to optimize disk spaceTips to optimize disk spacec. On host: current size of vhd-filec. On host: current size of vhd-file
Deleted files do still use spaceDeleted files do still use spaceTo solve:To solve:
Create and delete a zero-filled file that overwrites Create and delete a zero-filled file that overwrites all the previously deleted space ("clean-up")all the previously deleted space ("clean-up")
Move all the non-zero blocks ("compact")Move all the non-zero blocks ("compact")
Can use the Precompact.iso toolCan use the Precompact.iso tool
51
Tips to optimize disk spaceTips to optimize disk spaceSteps - clean up and compactSteps - clean up and compact
11 Start up without Undo disks Start up without Undo disks
In VM - In VM - clean upclean up::22 Defragment disk Defragment disk
Possibly defragment twicePossibly defragment twice
33 Zero-fill all unallocated sectors Zero-fill all unallocated sectorsUse Precompact.isoUse Precompact.iso
With Virtual PC 2004 SP1With Virtual PC 2004 SP1
44 Shut down VM Shut down VM
52
Tips to optimize disk spaceTips to optimize disk spaceSteps - clean up and compactSteps - clean up and compact
On host - On host - compactcompact:: 55 Use Virtual Disk Wizard to compact Use Virtual Disk Wizard to compact
the disk image filethe disk image file
Check disk size andCheck disk size andNTFS compressedNTFS compresseddisk size to estimatedisk size to estimate"space" in vhd-file"space" in vhd-file
53
Tips to optimize disk spaceTips to optimize disk spaced. On network: size of zipped vhd-filed. On network: size of zipped vhd-file
Delete files that are "compressed"Delete files that are "compressed"intro.wmv, title.wmaintro.wmv, title.wma
from windows\system32\oobe\images (-4 MB)from windows\system32\oobe\images (-4 MB)
msgr3en.dll, nls302en.lexmsgr3en.dll, nls302en.lexfrom windows\srchasst (-8 MB)from windows\srchasst (-8 MB)
XP: music.wmaXP: music.wmafrom Documents and Settings\All Usersfrom Documents and Settings\All Users\Documents\My Music (-4 MB)\Documents\My Music (-4 MB)
XP: windows\help\tour folder (-27 MB)XP: windows\help\tour folder (-27 MB)Will give Windows File Protection (WFP) messageWill give Windows File Protection (WFP) message
54
Tips to optimize disk spaceTips to optimize disk spaced. On network: size of zipped vhd-filed. On network: size of zipped vhd-file
Do not do:Do not do:zip files inside VM !zip files inside VM !
This makes the vhd-file 25% smaller,This makes the vhd-file 25% smaller,but the resulting zipped vhd-file (zip of zip) is but the resulting zipped vhd-file (zip of zip) is much largermuch larger
55
Tips to optimize disk spaceTips to optimize disk spaceGeneral tipsGeneral tips
RememberRememberIn a sparse In a sparse vhdvhd file, every "write" to a new location file, every "write" to a new location costs 2 MBcosts 2 MB
Files with only zeros are "free"Files with only zeros are "free"
TipsTipsDevelop VM with lots of RAM to keepDevelop VM with lots of RAM to keeppagefile.syspagefile.sys unused (is only zeros) unused (is only zeros)
Do not use or disable "smart" disk activitiesDo not use or disable "smart" disk activitiesDynamic disks (Win2000+)Dynamic disks (Win2000+)
System Restore (Win XP)System Restore (Win XP)
Shadow Copies (Win2003)Shadow Copies (Win2003)
56
Tips to optimize disk spaceTips to optimize disk spaceExample - steps at guestExample - steps at guest
After installation OS+SPsAfter installation OS+SPs 1408 MB1408 MBExample is Win2000 ServerExample is Win2000 Server
Empty dllcache folderEmpty dllcache folder -250 MB-250 MBrun run sfc.exe /cachesize=1sfc.exe /cachesize=1
restart guest (if needed)restart guest (if needed)
run run sfc.exe /purgecachesfc.exe /purgecache
Empty ServicePackFiles folderEmpty ServicePackFiles folder -196 MB-196 MBfrom %windir%from %windir%
Delete drivers.cab / SPx.cabDelete drivers.cab / SPx.cab -55 MB-55 MBfrom %windir%\Driver Cache\i386from %windir%\Driver Cache\i386
Empty %temp% folderEmpty %temp% folder -14 MB-14 MB
57
Tips to optimize disk spaceTips to optimize disk spaceExample - steps at guestExample - steps at guest
Turn off XP System RestoreTurn off XP System Restore -150 MB-150 MBControl Panel/System/System RestoreControl Panel/System/System Restore
Especially important to prevent disk growth later Especially important to prevent disk growth later (!)(!)In hidden, forbidden \System Volume Information folderIn hidden, forbidden \System Volume Information folder
Defragment disk (in guest)Defragment disk (in guest) (prepare)(prepare)Allows much better shrinking in next stepAllows much better shrinking in next step
Compact disk (on host)Compact disk (on host) (reclaim)(reclaim)Use Virtual Disk WizardUse Virtual Disk Wizard
Reclaims zero spaceReclaims zero space - 10 % - 10 %
Subtotal (after Subtotal (after guestguest steps) steps) 473 MB473 MB
58
Tips to optimize disk spaceTips to optimize disk spaceExample - steps at hostExample - steps at host
Subtotal (after guest steps)Subtotal (after guest steps) 473 MB473 MB
At hostAt hostNTFS compress NTFS compress vhdvhd file file - 43 %- 43 %
No performance hit at guest measuredNo performance hit at guest measured
Total (after Total (after hosthost steps) steps) 269 MB269 MBOriginal footprint wasOriginal footprint was 1408 MB1408 MB
59
Tips to optimize disk spaceTips to optimize disk spaceOffline storage of VM disksOffline storage of VM disks
Zip Zip vhdvhd file for storage file for storage - 60%- 60%Subtotal (after guest steps)Subtotal (after guest steps) 473 MB473 MB
Total (zip-file size)Total (zip-file size) 185 MB185 MB
On one CD-ROM:On one CD-ROM:Easily fits multiple zipped VMsEasily fits multiple zipped VMs
Especially if delta VMs are used Especially if delta VMs are used
60
Tips to optimize performanceTips to optimize performanceNumber 1 tipNumber 1 tip
Number 1 tip: Install Virtual Machine AdditionsNumber 1 tip: Install Virtual Machine Additions
Another number 1 tip:Another number 1 tip:Run on a fast host disk - greatest bottleneckRun on a fast host disk - greatest bottleneck
Do not run from networkDo not run from networkor redirected My Documentsor redirected My Documents
And another number 1 tip:And another number 1 tip:Enable run at maximum speedEnable run at maximum speed
61
Tips to optimize performanceTips to optimize performanceOther tips on hostOther tips on host
Defragment host diskDefragment host disk
Assign lots of memory to VMAssign lots of memory to VM
On notebook: NTFS compress disk filesOn notebook: NTFS compress disk filesCPU is "faster" than disk accessCPU is "faster" than disk access
Exempt from anti-virus checkingExempt from anti-virus checkingVirtual PC.exe or vhd (vhdd)/vud/vsv extensionsVirtual PC.exe or vhd (vhdd)/vud/vsv extensions
62
Tips to optimize performanceTips to optimize performanceWindows Server 2003 guestsWindows Server 2003 guests
Set display hardware acceleration to Set display hardware acceleration to FullFull ! !Default is lower settingDefault is lower setting
Causes slow mouse and displayCauses slow mouse and display
At Control Panel/Display/At Control Panel/Display/Settings tab/Advanced/Settings tab/Advanced/TroubleshootingTroubleshooting
Note: Leave the Visual Effects enabledNote: Leave the Visual Effects enabledThey hardly effect overall performanceThey hardly effect overall performance
63
Tips to optimize performanceTips to optimize performanceWindows Server 2003 guestsWindows Server 2003 guests
Set DVD ATAPI device to Set DVD ATAPI device to PIO OnlyPIO Only mode modeInitial DMA mode causes 10 second delay when Initial DMA mode causes 10 second delay when opening My Computeropening My Computer
Switches to PIO Only mode automatically after 6x Switches to PIO Only mode automatically after 6x delay, but use of Undo disks may prevent thisdelay, but use of Undo disks may prevent this
See Microsoft KB 817472See Microsoft KB 817472
At Device Manager/At Device Manager/IDE ATA-ATAPI controllers/IDE ATA-ATAPI controllers/Secondary IDE Channel/Secondary IDE Channel/Advanced Settings/Device 0Advanced Settings/Device 0
64
Tips for building VMsTips for building VMsGeneral tipsGeneral tips
Always configure Virtual PC to run at Always configure Virtual PC to run at maximum speedmaximum speed
Install OS in 40 minutes, versus 8 hoursInstall OS in 40 minutes, versus 8 hours
Use bootable ISO CD-image to install OSUse bootable ISO CD-image to install OS11 Start VM Start VM
22 Use Action/Pause to pause VM Use Action/Pause to pause VM
33 Use CD/Capture ISO image to use ISO file Use CD/Capture ISO image to use ISO file
44 Use Action/Reset to boot from CD Use Action/Reset to boot from CD
Always install Virtual Machine Additions after Always install Virtual Machine Additions after installation of OSinstallation of OS
65
Tips for building VMsTips for building VMsCustomize environmentCustomize environment
Add verbs to .vmc extensionAdd verbs to .vmc extensionEdit - Notepad.exe "%1"Edit - Notepad.exe "%1"
Register - Virtual PC.exe -registervm "%1"Register - Virtual PC.exe -registervm "%1"Open (Virtual PC.exe -startvm "%1") already existsOpen (Virtual PC.exe -startvm "%1") already exists
Add shortcutAdd shortcutNotepad.exe options.xmlNotepad.exe options.xml
66
Tips for building VMsTips for building VMsInstall sound in Win2003 VMInstall sound in Win2003 VM
Virtual PC Virtual PC Sound Blaster 16Sound Blaster 16 is not supported by is not supported by Windows Server 2003 anymoreWindows Server 2003 anymore11 Copy Copy wdma_ctl.infwdma_ctl.inf and and ctlsb16.sysctlsb16.sys
from Windows XP to a folderfrom Windows XP to a folder
22 In device manager, In device manager,select Sound Blaster 16select Sound Blaster 16and click Update Driverand click Update Driver
33 Browse to the folder, Browse to the folder,and install driverand install driver
67
Tips for building VMsTips for building VMsCopy files to VMsCopy files to VMs
Several methods:Several methods:Use Shared Folders (drag folder to icon)Use Shared Folders (drag folder to icon)
Files at z:\ in VM Files at z:\ in VM - I only use this- I only use this
Use drag-n-drop from host to VMUse drag-n-drop from host to VMFiles at desktop or folder in VMFiles at desktop or folder in VM
Burn quick ISO image (drag iso-file to icon)Burn quick ISO image (drag iso-file to icon)Files at d:\ (CD-ROM) in VMFiles at d:\ (CD-ROM) in VM
Use networking (drive mapping)Use networking (drive mapping)Need network configurationNeed network configuration
Cannot use Local Only networkingCannot use Local Only networking
68
Tips for building VMsTips for building VMsSecuritySecurity
Use Local Only networking to avoid any contact Use Local Only networking to avoid any contact with outside networkwith outside network
Patch VMs as if they are real machines on the Patch VMs as if they are real machines on the networknetwork
ICF / Windows Firewall does not protectICF / Windows Firewall does not protect
Use NAT to haveUse NAT to haveprotected accessprotected access
ICFICF
Connect toadapter
10.1.2.4.4
10.1.2.710.1.2.7
10.1.2.6.6
10.1.2.610.1.2.6
10.1.2.7.7
Other VMlocallocal
10.1.2.4externalexternal
hosthost
69
Tips for building VMsTips for building VMsMultiple VMs - difference disksMultiple VMs - difference disks
Unique per VMUnique per VMComputer nameComputer name : rename computer: rename computer
Computer SIDComputer SID : run Sysprep or SID : run Sysprep or SID changerschangers
I use Sysinternal's Newsid v4.03I use Sysinternal's Newsid v4.03
IP addressIP address : manually or use DHCP: manually or use DHCP
MAC addressMAC address : automatically different: automatically different
70
Tips for building VMsTips for building VMsMultiple VMs - undo disksMultiple VMs - undo disks
Careful with product activationCareful with product activation
Disable computer domain password changeDisable computer domain password changeAt VM - DCAt VM - DC
or at VM - member computeror at VM - member computer
Active Directory replicationActive Directory replicationif if multiple DCsmultiple DCs and and undoableundoable,,do not shut down and start up only onedo not shut down and start up only one
Restart VM is okay - does not "undo" changesRestart VM is okay - does not "undo" changes
# Key: hklm\s\ccs\s\Netlogon\Parameters RefusePasswordChange = 1 (reg_dword) # DC never accepts pw change
# Key: hklm\s\ccs\s\Netlogon\Parameters DisablePasswordChange = 1 (reg_dword) # Computer never changes pw
71
Tips for building VMsTips for building VMsMultiple VMs - time syncMultiple VMs - time sync
VPC Additions syncs time with hostVPC Additions syncs time with hostDoes NOT take the time zone in accountDoes NOT take the time zone in account
Only syncs the "system tray" timeOnly syncs the "system tray" time
Ensure that all VMs use the sameEnsure that all VMs use the sametime zone in a domain scenariotime zone in a domain scenario
72
Tips for building VMsTips for building VMsMultiple VMs - avoid confusionMultiple VMs - avoid confusion
For labFor labUse background colorsUse background colors
Use topology graphicsUse topology graphics
Always use Always use Undo-AlwaysUndo-Always
73
Tips for building VMsTips for building VMsCleanupCleanup
Do not use Start/Run, but use cmd.exe to Do not use Start/Run, but use cmd.exe to start other programs while buildingstart other programs while building
Keeps Run dialog list emptyKeeps Run dialog list empty
Empty Recycle BinEmpty Recycle BinMay even remove from desktopMay even remove from desktop
Clean up Start MenuClean up Start Menu
Disable screen saverDisable screen saver
74
Tips for deploying VMsTips for deploying VMsInstalling VMsInstalling VMs
Installing Virtual PC interrupts network connection Installing Virtual PC interrupts network connection to hostto host
Unattended install possible (see online help)Unattended install possible (see online help)
Register VMs by creating shortcuts to vmc-filesRegister VMs by creating shortcuts to vmc-filesIn folderIn folderC:\Documents and Settings\C:\Documents and Settings\<user><user>\Application Data\\Application Data\Microsoft\Virtual PC\Virtual MachinesMicrosoft\Virtual PC\Virtual Machines
For other user as wellFor other user as well
Shortcuts are case-sensitive (!)Shortcuts are case-sensitive (!).vmc-extension has to be lowercase ?.vmc-extension has to be lowercase ?
Note: Options.xml file is atNote: Options.xml file is atC:\Documents and Settings\C:\Documents and Settings\<user><user>\Application Data\\Application Data\Microsoft\Virtual PC\Options.xmlMicrosoft\Virtual PC\Options.xml
75
Tips for deploying VMsTips for deploying VMsConfigure VMsConfigure VMs
Options.xmlOptions.xml"Hide" Virtual PC console by moving off-screen"Hide" Virtual PC console by moving off-screen
Closing Virtual PC console, closes all running VMsClosing Virtual PC console, closes all running VMs
file.vmc (per VM)file.vmc (per VM)Disable VM window Close buttonDisable VM window Close button
Use Action/Close to close VM window insteadUse Action/Close to close VM window instead
# Options.xml/preferences/window/console/left_position = 4000
# Sydney.vmc/preferences/command_line/override/disable_close = true
76
Tips for deploying VMsTips for deploying VMsHow to restrict useHow to restrict use
Restrict use for lab usersRestrict use for lab usersSet VM BIOS passwordSet VM BIOS password
At startup, press At startup, press DelDel to enter AMI BIOS to enter AMI BIOS
Set permissions on files and foldersSet permissions on files and folders
Disable parts of user interfaceDisable parts of user interface
# Registryhklm\Software\Microsoft\Virtual PC\5.0\Security\Locks = 0x02B (dword)
77
Tips for deploying VMsTips for deploying VMsMultiple VMs - start upMultiple VMs - start up
When using a script to start multiple VMs:When using a script to start multiple VMs:Use delays in between to avoid too much Use delays in between to avoid too much concurrent host disk activityconcurrent host disk activity
HostHost
VMVM
VMVM
HostHost
VMVM
VMVM
78
Useful linksUseful links
DriversDriversDOS network adapter driver (DOS network adapter driver (dc21x4.dosdc21x4.dos) ) http://developer.intel.com/design/networkhttp://developer.intel.com/design/network /drivers/sla_ndis2.htm /drivers/sla_ndis2.htm
ToolsToolsPrecompact.iso - zero fills unallocated sectorsPrecompact.iso - zero fills unallocated sectorshttp://go.microsoft.com/?linkid=2615769http://go.microsoft.com/?linkid=2615769(with Virtual PC SP1)(with Virtual PC SP1)
Newsid.exe - assigns random SID to (delta) VMNewsid.exe - assigns random SID to (delta) VMhttp://www.sysinternals.com/ntw2k/source/newsid.shtmlhttp://www.sysinternals.com/ntw2k/source/newsid.shtml