Monthly Archives: November 2007

VM Professional

Yet another VM blog http://www.vmprofessional.com/

Advertisements

Quiesce your live VMware VMs before you snapshot them

Make sure you quiesce any services such as Oracle 10g DB in your VMware VMs before you snap them:

  • Install VMware Tools in your VM
  • Create /usr/sbin/pre-freeze-script
  • Create /usr/sbin/post-thaw-script

Use vcbMounter to snapshot your live VMware VM which will call /usr/sbin/pre-freeze-script just BEFORE creating the snap and /usr/sbin/post-thaw-script approx 1 second AFTER the delta/diff/redo file has been created BUT before the original VMDK has been been exported via vmkfstools.

# cat /usr/sbin/pre-freeze-script

#!/bin/sh

#####################################

# DO NOT modify this file directly as it will be overwritten the next
# time the VMware Tools are installed.
#####################################

echo frez$(date) >> /var/log/snap

# cat /usr/sbin/post-thaw-script

#!/bin/sh

#####################################

# DO NOT modify this file directly as it will be overwritten the next
# time the VMware Tools are installed.
#####################################

echo thaw$(date) >> /var/log/snap

# tail /var/log/snap
frezWed Nov 28 11:26:20 GMT 2007
thawWed Nov 28 11:26:21 GMT 2007

VMware Tools guest VM freeze & thaw scripts for VCB

To get the most out of your VMs and backup and restore them in the most reliable way you must install VMware tools in your guests.

As well as providing better mouse & video drivers it provides an API to the host providing IP, clock information and installs VM startup, VM shutdown, VM freeze & VM thaw scripts /usr/sbin/pre-freeze-script and /usr/bin/post-thaw-script.

http://www.vmware.com/pdf/vi3_vm_backup.pdf

VMware ESX 3 vcbRestore quick restore

After backing up a VMWESX VM with vcbMounter you can use vcbRestore to perform a quick restore on another ESX server

Edit the catalog file

  • change SOURCE hostname to DEST hostname
  • check the same “resource pool” exists on DEST host (if not change it so it does)

for example

  • host=myserver.mydomain
  • resourcepool= “/ha-folder-root/ha-datacenter/host/myserver.mydomain/Resources”

VMware ESX 3 snapshots

Here’s a CentOS 4 VM with 4 snapshots, in each snapshot I added a 40M file and in two of the snapshots i snapped the memeory as well.

Note a memory snapshot file is ALWAYS created if it doesn’t contain anything !

The .VMSD contains a snapshot definition !

https://i0.wp.com/farm3.static.flickr.com/2225/2065721033_1fae81b809.jpg

-rw——-    1 root     root         8.0G Nov 26 17:26 cent4-flat.vmdk
-rw——-    1 root     root          334 Nov 21 12:39 cent4.vmdk

-rw——-    1 root     root         1.4K Nov 26 17:31 cent4.vmsd

-rw——-    1 root     root          48M Nov 26 17:28 cent4-000001-delta.vmdk
-rw——-    1 root     root          219 Nov 26 17:27 cent4-000001.vmdk
-rw——-    1 root     root          18K Nov 26 17:27 cent4-Snapshot1.vmsn

-rw——-    1 root     root          48M Nov 26 17:29 cent4-000002-delta.vmdk
-rw——-    1 root     root          226 Nov 26 17:28 cent4-000002.vmdk
-rw——-    1 root     root         257M Nov 26 17:28 cent4-Snapshot2.vmsn

-rw——-    1 root     root          48M Nov 26 17:31 cent4-000003-delta.vmdk
-rw——-    1 root     root          226 Nov 26 17:29 cent4-000003.vmdk
-rw——-    1 root     root         257M Nov 26 17:29 cent4-Snapshot3.vmsn

-rw——-    1 root     root          16M Nov 26 17:31 cent4-000004-delta.vmdk
-rw——-    1 root     root          226 Nov 26 17:31 cent4-000004.vmdk
-rw——-    1 root     root          18K Nov 26 17:31 cent4-Snapshot4.vmsn

VMware ESX 2 v VMware ESX 3 live VM backups

Basically during the VMware ESX two phase live backup process

ESX 2 uses .redo and .redo.redo “redo files” while

ESX 3 uses -0001-delta.vmdk and -0002-delta.vmdk “snapshots”
In VMWESX 2 .redo and .redo.redo are used for live backups

Running

var.vmdk

Backup started

var.redo

var.vmdk

Backup completed (applying redo)

var.redo.redo

var.redo

var.vmdk

In VMWESX 3 snapshots -000001-delta.vmdk and -000002-delta.vmdk are used

Running VM

var-flat.vmdk

var.vmbk

Backup started

var-000001-delta.vmdk

var-000001.vmdk

Backup completed (applying, commiting, delete all, removing snapshots)

var-000002-delta.vmdk

var-000002.vmdk

var-000001-delta.vmdk

var-000001.vmdk

var-flat.vmdk

var.vmdk