Tuesday, August 28, 2012

How to capture memory dump of Windows 2003 PVS Streamed VMs

Prep XenApp vm to enable COM port debugging.

1. Logon to XenApp vm and run “msconfig” from command line.

2. Select “Boot.ini” tab, then click “Advanced Options” button and check to enable the following checkbox and selected values.

“/DEBUG”

“/DEBUGPORT=COM1:”

“/BAUDRATE=115200”

3. Reboot server to take effect

Attach a Virtual Serial Port to VM

While the target XenApp vm is running on Xenserver console command line issue the following command to enable virtual COM port redirection to a separate machine running sockpipe tool and Windbg:

#xe vm-param-set uuid=<UUID of the VM> other-config:hvm_serial="tcp:<<IP-of-the-Windbg-machine>>:7001"  

(can use any open ports beside port 7001 on the machine running sockpipe/Windbg) .  This command can be run even if the VM is not running.

Configure Debug session

1. From sockpipe/windbg machine disable Windows firewall or 3rd party Anti-virus/firewall, etc.

2. Start sockpipe via command line (run in administrator mode for the command line if it’s Win7 or Win2K8), and run command “sockpipe mypipe 7001”

"mypipe" is name given to the pipe being used to connect to the VM. This needs to be  unique for all the Debug Session and so should be the port number.

image

Start Windbg and select “File > Kernel Debug” and enter the following on the first COM tab:

· Baud Rate=115200

· Port=\\.\pipe\mypipe

· Check the “Pipe” check box

· Click OK button

image

If the VM is running then reboot the XenApp VM so the virtual COM port of the VM will be redirected to sockpipe/windbg machine IP address. If the VM is not running, just start the VM

How to Capture

When XenApp vm experience hang or freeze, on Windbg machine select “Debug > Break” within Windbg to enter break point.  On bottom of Windbg you can type the command

“.dump /f c:\temp\fulldump.dmp” (or whatever location you have enough free disk space to hold the entire memorydump of same size as the vm’s physical memory)

Now wait for the full memory to copy out of the VM thru it’s virtual COM port.

Download Dump Configurator from CTX129575  

Download Sockpipe

Source : Based on input provided by my colleague Vipul Tripathi

No comments: