More Thoughts on Forensics

By Edward Haletky  4 comments

I mentioned in my last blog that it would be handy to get a copy of all the VMs datafiles as they contain memory files.

The best way to preserve these files is to power off the VM as if you were pulling the plug on the VM. There are several ways to accomplish this task.

The first is to pull the power on the entire ESX server. Not always desirable but it is done from time to time.

The other more appropriate way is to kill the process running the VM, however that is quite a bit of trouble. You are first required to find the VMID of the VM and then to find its parent VMID and finally kill the VM within the vmkernel. This is achieved by doing:

VMID=`/usr/bin/vm-support -x | grep VMName|awk '{print $1}'|awk -F= '{print $2}`

KVMID=`cat /proc/vmware/vm/$VMID/cpu/status |awk '{print $1}'|grep -v group|awk -F\. '{print $2}'`

/usr/lib/vmware/bin/vmkload_app -k 19 $KVMID

These steps will kill the VM while maintaining a copy of the virtual swap file. If the VM had to swap to disk, the data is now there for you to use in your investigations.

However, it is always best to remember that this file is not always used.

4 comments

    Anonymous 45 weeks ago
    This is a pretty good way to find the process you need to kill if a VM hangs. If you decide to use the commands Ed posted, just change "VMName" to the actual VM name, then fix the close parentheses at the end of line 1 and add the "$" to the '{print 21}' for line 2, so it looks like '{print $21}'.I just popped that into a "KillVM.sh" script and use it to nix any pesky hung VMs. I also changed the "vmkload_app -k 19" to "vmkload_app -k 9" so it will do a kill -9 which is signal 9 KILL (non-catchable, non-ignorable kill).~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# KillVM script## Usage: "killVM.sh "#VMID=`/usr/bin/vm-support -x
    Anonymous 1 year ago
    I revised the "vmkload_app -k 19" to "vmkload_app -k 9" so it will do a kill -9 which is signal 9 KILL (non-catchable, non-ignorable kill). -- hanamint patio furniture
    Anonymous 2 years ago
    Hi Edward,If you have the administrative and legal authority to stop a running VM and the willingness to do so in order to capture evidence, then you are better off suspending or taking a snapshot of the running VM so that a copy of the VM's virtual RAM is committed to a file on disk along with making the virtual disk images read only at the exact same time.Then you can capture all the files related to that VM and perform analysis on the virtual disk image and memory image. And if you have acquired the logged-in users password (analysis, court order, etc), you could even resume that VM at a later date, as many times as you'd like to show it as it was when the evidence was captured (in court for example).
    Anonymous 3 years ago
    Pulling the plug, I like it :O the command for killing the guest is very useful.once again an excellent blog. keep them coming.

      Add a comment

      Post a comment using one of these accounts
      Or join now
      At least 6 characters

      Note: Comment will appear soon after you have activated your account.
      Obscene/spam comments will be removed and accounts suspended.
      The information you submit is subject to our Privacy Policy and Terms of Service.

      ITworld LIVE

      VirtualizationWhite Papers & Webcasts

      White Paper

      AppAssure vs Backup Exec

      In this new Lab Report, openBench Labs examines AppAssure backup and replication software v4.7 with Symantec Backup Exec 2010 R2. AppAssure implements changed-block tracking technology to provide data protection for both virtual and physical servers in specific OS environments. In contrast, Backup Exec 2010 R2 uses traditional file-based backup to promote compatibility with the largest number of operating systems.

      White Paper

      Top 5 Requirements for Backup of Virtual and Physical Servers - Greg Shields, Microsoft MVP

      Reports by leading industry analysts like Gartner, IDC and Concentrated Technology suggest virtual servers in 2011 will eclipse physical servers in total server deployments. The majority of today's business computing environments already have both virtual and physical servers at the same time.

      White Paper

      Lab Report - Optimizing VM Backup for VMware and Hyper-V

      Data centers are becoming more difficult to manage and protect as more data and applications are moved into virtual environments. Adding fuel to the fire, CIOs must now deal with corporate mandates to build an IT infrastructure that scales to unknown demand levels and provides service assurance for fluctuating conditions that cannot be accurately projected. The solution is a transition to a private cloud characterized by a hypervisor-independent Virtual Infrastructure (VI).

      Webcast On Demand

      Managing Enterprise Mobility Costs

      Mobile employees, especially those traveling internationally, were spending time and resources finding and making connections. Roaming costs were out of control. The IT Administrator at The Hay Group tells you how he got more control over these costs, providing management with predictable budgets and insights while ensuring employee productivity.

      Sponsor: iPass

      White Paper

      Forrester Total Economic Impact (TEI) Case Study - Oracle

      In this paper, Forrester Consulting examines the total economic impact and potential return on investment (ROI) realized by three Enterprise organizations as they virtualized mission-critical Oracle databases on the VMware vSphere platform. The purpose of this study is to provide readers with a framework to evaluate the potential financial impact of VMware vSphere on their organizations.

      See more White Papers | Webcasts

      Ask a question

      Ask a Question