VMware Communities > People

guyrleech's Profile

  • Name: Guy Leech 
  • Email: (Private)
  • Member Since: Mar 6, 2006
  • Last Logged In: Jul 5, 2009 11:15 PM
  • Status Level: Master Master (4,857 points)
  • Location: UK
  • Occupation: Consultant at AppSense Ltd
  • Signature: Guy Leech VMware vExpert 2009 --- If you found this or any other answer useful please consider the use of the Helpful or Correct buttons to award points.

guyrleech's Latest Content

If you snapshot a running VM and then just copy the base disk away then you lose the running information and may corrupt a VM restored from this disk particularly if the VM is stateful like a database server. The method below will work to allow you to take a snapshot of a live machine, copy away the files and create a cloned VM that can be resumed from the exact point of the snapshot. This technique can be used for backup and restore purposes and is obviously scriptable. The reason we do this is because the disk files of a running VM are locked and therefore cannot be copied, particularly on Linux hosts where there is no VSS functionality. Note that the disk files in use after the snapshot are called *-000001.vmdk where there may be more than one depending on how many disks you have and whether they are split into 2GB chunks or not. The .vmdk disk files that are not named *-000001.vmdk are the base, original disks, and are no longer locked after a snapshot since they are read-only.

1) Create a new folder for the cloned VM

2) Copy in here the following files from the running, snapshotted VM you want to live backup:

*-Snapshot1.vmem renamed to drop the "-Snapshot1" part
*-Snapshot1.vmsn renamed to drop the "-Snapshot1" part and change ".vmsn" to ".vmss"
Disk files (obviously more than one file if 2GB split) - don't copy the *-000001.vmdk files as these are the post snapshot disk files and will be in use
*.vmx
*.vmxf
*.nvram

3) Add this line to the .vmx which is the key to making VMware realise that this VM that you add to the inventory is suspended:

checkpoint.vmState = "Whatever it is called.vmss"
4) Change the reference to the disk in the .vmx from *-000001.vmdk to the base .vmdk(s) that you have copied over

5) Add the .vmx to the inventory and check that it shows as suspended

5) Start it - note that it will ask if you have copied or moved it but you can safely answer "copied" and it will retain the suspended state and not clash with the other VM at the VMware layer but may do network, SID, etc wise if the original VM is still running

I have tested this on an openSUSE host but beleive it should work too on Windows hosts.

0 Comments Permalink

The default host-only networking in Server 2.0 and Workstation allows the guests to talk to each other and also to the host itself. What you may want or need to do is to have host-only networking where the guests can talk to teach other but not to the host and vice versa. This is actually very easy to setup. I would suggest that you create a new host-only network adapter for this so that you can also have "traditional" host-only networking available too.

For Windows hosts (I tested this with Workstation 6.5.1 running on Vista SP1 x86), it is simply a case of disabling the VMware NIC on the host.

For Linux hosts (I tested this with Server 2.0 build 122956 on openSUSE 10.3 x64) , I found that if you just take the network interface down (e.g. "ifconfig vmnet3 down"), although the guests cannot ping the host's IP address, the host can ping its own ip address. I therefore also removed the IP address from the interface on the host. This is achieved thus (obviously substituting the correct IP address, subnet mask length and network interface):

ip address del 192.168.188.1/24 dev vmnet3

I've not exhaustively tested this, just used WinPE bootable ISOs and pinging another host-only VM and checked that they cannot ping the host's host-only IP address. Note that the guests still get IP addresses via DHCP (if configured that way). There may also still be some communication possible between host and guest but simple IP based stuff seems to be disabled.

Given the similarity between Workstation and Server 2.0 at the network level, I would assume that each of the methods above will work on both Windows and Linux.

0 Comments 0 References Permalink