civilvar 发表于 2015-10-12 07:06:32

How to get xen whole-machine dump image and analyse it prepair

enable kexec



[*]apply kexec patches to xen source tree.   latest patches are available in xen-devel list.(It maybe merged into xen 3.0.3)



install dom0cut



[*]
prerequirement: libelf, python, binutils
get dom0cut script and libelf wrapper from http://people.valinux.co.jp/~moriwaka/dumpread/ install libelf wrapper

$ wget http://people.valinux.co.jp/~moriwaka/dumpread/libelf-0.3.0.tar.gz
$ tar zxf libelf-0.3.0.tar.gz
$ cd libelf-0.3.0
$ sudo python ./setup.py install

install dom0cut script
$ wget http://people.valinux.co.jp/~moriwaka/dumpread/dumpread-20060927.tar.gz
$ tar zxvf dumpread-20060927.tar.gz





prepair xen-syms, vmlinux



[*]
copy xen executable binary with symbols (when you compile, it is made at xen/xen-syms) and vmlinux used for domain 0




get coredump




load kdump kernel


1. append followings to xen boot args


[*]
kdump_megabytes=64 kdump_megabytes_base=32



2. on dom0, load kdump kernel, take a dump.


[*]
This is same as linux kdump usage. http://lse.sourceforge.net/kdump/




get a dump image



[*]
echo c > /proc/sysrq-trigger



after reboot, copy /proc/vmcore to core file.


[*]
cp /proc/vmcore /vmcore





analysis


http://wiki.xensource.com/wiki/modern/img/alert.png Now dom0cut script eats large memory(about 100-200MB).You should reboot machine before analysis.


extract domain 0 image



[*]
$ cd dumpread
$ ./dom0cut_x86.py -d/vmcore --target=0 -odom0image -xxen-syms -txen



http://wiki.xensource.com/wiki/modern/img/alert.png you maybe need LD_PRELOAD=/usr/local/lib/libelf.so to resolve conflict for distribution's libelf.(same-name different library is contained in Fedora Core or Redhat)


use crash



[*]
$ crash vmlinux dom0image





extract xen hypervisor image



[*]
$ cd dumpread
$ ./dom0cut_x86.py -d/vmcore --target=x -oxenimage -xxen-syms -telf





use gdb


$ gdb xen-syms xenimage
页: [1]
查看完整版本: How to get xen whole-machine dump image and analyse it prepair