Category Archives: VMGuide
Migration fundamentals
Cold Migration: Moving a powered-off virtual machine to a new host. Optionally, you can relocate configuration and disk files to new storage locations. You can use cold migration to move virtual machines from one datacenter to another.
Migrating a Suspended Virtual Machine: Moving a suspended virtual machine to a new host. Optionally, you can relocate configuration and disk files to new storage location. You can migrate suspended virtual machines from one datacenter to another.
Migration with vMotion (a.k.a. live migration): Moving a powered-on virtual machine to a new host. You cannot use vMotion to move virtual machines from one datacenter to another. Some configurations include Metro vMotion, a feature that enables reliable migrations between hosts separated by high network round-trip latency times. Metro vMotion is automatically enabled when the appropriate license is installed. No user configuration is necessary.
Both migration of a suspended virtual machine and migration with vMotion are sometimes referred to as “hot migration”, because they allow migration of a virtual machine without powering it off
Migration with Storage vMotion
Moving the virtual disks or configuration file of a powered-on virtual machine to a new datastore. Migration with Storage vMotion allows you to move a virtual machine’s storage without any interruption in the availability of the virtual machine.
You can move virtual machines manually or set up a scheduled task to perform the cold migration.
Virtual Machine Configuration Requirements for vMotion
A number of specific virtual machine configurations can prevent migration of a virtual machine with vMotion.
The following virtual machine configurations can prevent migration with vMotion:
-
You cannot use migration with vMotion to migrate virtual machines using raw disks for clustering purposes.
-
You cannot use migration with vMotion to migrate a virtual machine that uses a virtual device backed by a device that is not accessible on the destination host. (For example, you cannot migrate a virtual machine with a CD drive backed by the physical CD drive on the source host.) Disconnect these devices before migrating the virtual machine.
-
Virtual machines with USB passthrough devices can be migrated with vMotion as long as the devices are enabled for vMotion.
-
You cannot use migration with vMotion to migrate a virtual machine that uses a virtual device backed by a device on the client computer. Disconnect these devices before migrating the virtual machine.
Disks are converted from thin to thick format or thick to thin format only when they are copied from one datastore to another. If you leave a disk in its original location, the disk format is not converted, regardless of the selection made here.
Consolidate Snapshots in the vSphere Client (not from webclient)
The snapshot Consolidation command searches for hierarchies or delta disks to combine without violating data dependency. After consolidation, redundant disks are removed, which improves virtual machine performance and saves storage space.
Snapshot consolidation is useful when snapshot disks fail to compact after a Delete or Delete all operation or if the disk did not consolidate. e.g. This might happen, for example, if you delete a snapshot but its associated disk does not commit back to the base disk.
The Needs Consolidation column in the vSphere Client shows the virtual machines that need to be consolidated
and the virtual machine’s Summary tab shows a Configuration Issues consolidation message if the virtual machine needs to be consolidated. If you see errors for failed conditions, such as running out of disk space, correct them and run the consolidation task.
Required privilege: Virtual machine.State.Remove Snapshot
Procedure
1. Display the Need Consolidation column in the vSphere Client.
a. Select a vCenter Server, host, or cluster and click the Virtual Machines tab.
b. Right-click the menu bar for any virtual machine column and select Needs Consolidation from the menu.
The Needs Consolidation column appears. A Yes status indicates that the snapshot files for the virtual machine should be consolidated and that the virtual machine’s Tasks and Events tab shows a configuration problem. A No status indicates that the files are OK.
2. To consolidate the files, right-click the virtual machine and select Snapshot > Consolidate.
3. Check the Need Consolidation column to verify that the task succeeded.
If the task succeeded, the Configuration Issues message should be cleared and the Needs Consolidation value should be No.
Deleting Snapshots
Deleting a snapshot removes the snapshot from the Snapshot Manager. The snapshot files are consolidated and written to the parent snapshot disk and merge with the virtual machine base disk. Deleting a snapshot leaves the current state of the virtual machine or any other snapshot untouched. Deleting a snapshot consolidates the changes between snapshots and previous disk states and writes to the parent disk all data from the delta disk that contains the information about the deleted snapshot. When you delete the base parent snapshot, all changes merge with the base virtual machine disk.
Deleting snapshots involves large amounts of disk reads and writes, which can reduce virtual machine performance until consolidation is complete. Consolidating snapshots removes redundant disks, which improves virtual machine performance and saves storage space. The time it takes to delete snapshots and consolidate the snapshot files depends on the volume of data that the guest operating system wrote to the virtual disks after you took the last snapshot. The required time is proportional to the amount of data the virtual machine is writing during consolidation if the virtual machine is powered on.
Delete
Use the Delete option to remove a single parent or child snapshot from the snapshot tree. Delete writes disk changes between the snapshot and the previous delta disk state to the parent snapshot. You can also use the Delete option to remove a corrupt snapshot and its files from an abandoned branch of the snapshot tree without merging them with the parent snapshot.
Delete All
Use the Delete All option to delete all snapshots from the Snapshot Manager. Delete all consolidates and writes changes between snapshots and previous delta disk states to the base parent disk and merges them with the base virtual machine disk.
To prevent snapshot files from merging with the parent snapshot, for example in cases of failed updates or installations, first use the Go to command to restore to a previous snapshot. This action invalidates the snapshot delta disks and deletes the memory file. You can then use the Delete option to remove the snapshot and any associated files.Refer example below
Use care when you delete snapshots. You cannot restore a deleted snapshot.
For example, you might want to install several browsers, a, b, and c, and capture the virtual machine state after you install each browser. The first, or base snapshot, captures the virtual machine with browser a and the second snapshot captures browser b. If you restore the base snapshot that includes browser a and take a third snapshot to capture browser c and delete the snapshot that contains browser b, you cannot return to the virtual machine state that includes browser b.
Restoring Snapshots
To return a virtual machine to its original state, or to return to another snapshot in the snapshot hierarchy, you can restore a snapshot. When you restore a snapshot, you return the virtual machine’s memory, settings, and the state of the virtual machine disks to the state they were in at the time you took the snapshot. If you want the virtual machine to be suspended, powered on, or powered off when you start it, make sure that it is in the correct state when you take the snapshot. When you revert a virtual machine, the virtual machine returns to the parent snapshot of the virtual machine (that is, the parent of the current You are here state).
You can restore snapshots in the following ways:
Revert to Current Snapshot
Restores the parent snapshot, one level up in the hierarchy from the You are Here position. Revert to Current Snapshot activates the parent snapshot of the current state of the virtual machine.
Go To
Lets you restore any snapshot in the snapshot tree and makes that snapshot the parent snapshot of the current state of the virtual machine. Subsequent snapshots from this point create a new branch of the snapshot tree.
Restoring snapshots has the following effects:
-
The current disk and memory states are discarded, and the virtual machine reverts to the disk and memory states of the parent snapshot.
-
The delta disks for snapshots that you took after you restored the current snapshot are not removed. You can restore those snapshots at any time.
-
If the snapshot includes the memory state, the virtual machine will be in the same power state as when you created the snapshot.
-
Virtual machines running certain kinds of workloads can take several minutes to resume responsiveness after reverting from a snapshot.
How To Take a Snapshot in the vSphere Web Client
Snapshots capture the entire state of the virtual machine at the time you take the snapshot. You can take a snapshot when a virtual machine is powered on, powered off, or suspended. If you are suspending a virtual machine, wait until the suspend operation finishes before you take a snapshot.
When you create a memory snapshot, the snapshot captures the state of the virtual machine’s memory and the virtual machine power settings. When you capture the virtual machine’s memory state, the snapshot operation takes longer to complete. You might also see a momentary lapse in response over the network.
When you quiesce a virtual machine, VMware Tools quiesces the file system in the virtual machine. The quiesce operation pauses or alters the state of running processes on the virtual machine, especially processes that might modify information stored on the disk during a restore operation.
Prerequisites
- If you are taking a memory snapshot of a virtual machine that has multiple disks in different disk modes, verify that the virtual machine is powered off. For example, if you have a special purpose configuration that requires you to use an independent disk, you must power off the virtual machine before taking a snapshot.
- To capture the memory state of the virtual machine, verify that the virtual machine is powered on.
- To quiesce the virtual machine files, verify that the virtual machine is powered on and that VMware Tools is installed.
- Required privilege: Virtual machine.State. Create snapshot on the virtual machine.
Procedure
1. Select a virtual machine.
2. Right-click the virtual machine and select Snapshot > Take Snapshot.
3. Type a name for the snapshot.
4. (Optional) Type a description for the snapshot.
5. (Optional) Select the Snapshot the virtual machine’s memory check box to capture the memory of the virtual machine.
6. (Optional) Select the Quiesce guest file system (Needs VMware Tools installed) check box to pause running processes on the guest operating system so that file system contents are in a known consistent state when you take the snapshot.
7. Click OK.
Change Disk Mode to Exclude Virtual Disks from Snapshots in the vSphere Web Client
You can set a virtual disk to independent mode to exclude the disk from any snapshots taken of its virtual machine.
Prerequisites
Power off the virtual machine and delete any existing snapshots before you change the disk mode. Deleting a snapshot involves committing the existing data on the snapshot disk to the parent disk.
Required privileges:
Virtual machine.State.Remove Snapshot
Virtual machine.Configuration.Modify device settings
Procedure
1. Select a virtual machine.
2. In the VM Hardware panel, click Edit Settings.
3. Click Virtual Hardware.
4. Click the triangle to display the settings for the disk to exclude from snapshots.
5. Select one of the independent disk mode options.
a. Independent –Persistent
b. Independent –Non Persistent
6. Click OK
Managing Snapshots
You can review all snapshots for the active virtual machine and act on them by using the Snapshot Manager. After you take a snapshot, you can use the Revert to current snapshot command from the virtual machine’s right-click menu to restore that snapshot at any time.
If you have a series of snapshots, you can use the Go to command in the Snapshot Manager to restore any parent or child snapshot. Subsequent child snapshots that you take from the restored snapshot create a branch in the snapshot tree. You can delete a snapshot from the tree in the Snapshot Manager
Taking Snapshots
You can take one or more snapshots of a virtual machine to capture the settings state, disk state, and memory state at different specific times. When you take a snapshot, you can also quiesce the virtual machine files and exclude the virtual machine disks from snapshots.
When you quiesce a virtual machine, VMware Tools quiesces the file system of the virtual machine. A quiesce operation ensures that a snapshot disk represents a consistent state of the guest file systems. If the virtual machine is powered off or VMware Tools are not available, the Quiesce parameter is disabled.
The disks are crash-consistent unless you quiesce them.
When is the best time to take snapshot?
The best time to take a snapshot from a storage perspective, is when you are not incurring a large I/O load. The best time to take a snapshot from a service perspective is when no applications in the virtual machine are communicating with other computers. The potential for problems is greatest if the virtual machine is communicating with another computer, especially in a production environment. For example, if you take a snapshot while the virtual machine is downloading a file from a server on the network, the virtual machine continues downloading the file and communicating its progress to the server. If you revert to the snapshot, communications between the virtual machine and the server are confused and the file transfer fails.
Snapshot Limitations (Draw bags)
Snapshots can affect virtual machine performance and do not support some disk types or virtual machines configured with bus sharing.
-
VMware does not support snapshots of raw disks, RDM physical mode disks, or guest operating systems that use an iSCSI initiator in the guest.
-
Virtual machines with independent disks must be powered off before you take a snapshot. Snapshots of powered-on or suspended virtual machines with independent disks are not supported.
-
Snapshots are not supported with PCI vSphere Direct Path I/O devices.
-
VMware does not support snapshots of virtual machines configured for bus sharing. If you require bus sharing, consider running backup software in your guest operating system as an alternative solution. If your virtual machine currently has snapshots that prevent you from configuring bus sharing, delete (consolidate) the snapshots.
-
If the files containing a virtual machine are lost, its snapshot files are also lost. Also, large numbers of snapshots are difficult to manage, consume large amounts of disk space, and are not protected in the case of hardware failure.
-
Snapshots can negatively affect the performance of a virtual machine.
-
Performance degradation is based on
a.How long the snapshot or snapshot tree is in place, the depth of the tree, and
b.How much the virtual machine and its guest operating system have changed from the time you took the snapshot.
- You might see a delay in the amount of time it takes the virtual machine to power-on. Do not run production virtual machines from snapshots on a permanent basis.
-
You cannot revert to a snapshot with dynamic disks, so quiesced snapshots are not used when you restore dynamic disks. Snapshot technology has no visibility into Dynamic Disks. Dynamic Disks are commonly known as Microsoft specific file systems.
Snapshot Files
A snapshot consists of files that are stored on a supported storage device. A Take Snapshot operation creates .vmdk, -flat.vmdk, .vmsd, and .vmsn files. By default, the first and all subsequent snapshots are stored with the virtual machine base files.
Delta Disks
A delta disk has two files, including a descriptor file that is small and contains information about the virtual disk, such as geometry and child-parent relationship information, and a corresponding file that contains the raw data.
NOTE If you are looking at a datastore with the Datastore Browser in the vSphere Client, you see only one entry to represent both files.
In above figure you can see 000002–delta.vmdk is bigger in size compared to 000002.vmdk file
The files that make up the delta disk are referred to as child disks or redo logs.A child disk is a sparse disk. Sparse disks use the copy-on-write mechanism, in which the virtual disk contains no data in places, until copied there by a write operation. This optimization saves storage space. A grain is the unit of measure in which the sparse disk uses the copy-on-write mechanism. Each grain is ablock of sectors that contain virtual disk data. The default size is 128 sectors or 64 KB.
Database file (vmsd)
A .vmsd file that contains the virtual machine’s snapshot information and is the primary source of information for the Snapshot Manager. This file contains line entries, which define the relationships between snapshots and between child disks for each snapshot.
.vmsd file contents grabbed from putty
Memory file(.vmsn)
A .vmsn file that includes the active state of the virtual machine. Capturing the memory state of the virtual machine lets you revert to a turned on virtual machine state. With non-memory snapshots, you can only revert to a turned off virtual machine state. Memory snapshots take longer to create than non-memory snapshots. The time the ESX host takes to write the memory on to the disk is relative to the amount of memory the virtual machine is configured to use.
In above figure two snapshots are created.
Using Snapshots To Manage Virtual Machines
Snapshots are useful as a short term solution for testing software with unknown or potentially harmful effects.For example, you can use a snapshot as a restoration point during a linear or iterative process, such as installing update packages, or during a branching process, such as installing different versions of a program.
Using snapshots ensures that each installation begins from an identical baseline.With snapshots, you can preserve a baseline before diverging a virtual machine in the snapshot tree.
The Snapshot Manager in the vSphere Web Client and the vSphere Client provide several operations for creating and managing virtual machine snapshots and snapshot trees. These operations let you create snapshots, restore any snapshot in the snapshot hierarchy, delete snapshots, and more. You can create extensive snapshot trees that you can use to save the virtual machine state at any specific time and restore the virtual machine state later. Each branch in a snapshot tree can have up to 32 snapshots.
A snapshot preserves the following information:
· Virtual machine settings. The virtual machine directory, which includes disks that were added or changed after you took the snapshot.
· Power state. The virtual machine can be powered on, powered off, or suspended.
· Disk state. State of all the virtual machine’s virtual disks.
· (Optional) Memory state. The contents of the virtual machine’s memory.
The Snapshot Hierarchy
The Snapshot Manager presents the snapshot hierarchy as a tree with one or more branches. The relationship between snapshots is like that of a parent to a child. In the linear process, each snapshot has one parent snapshot and one child snapshot, except for the last snapshot, which has no child snapshots. Each parent snapshot can have more than one child. You can revert to the current parent snapshot or restore any parent or child snapshot in the snapshot tree and create more snapshots from that snapshot. Each time you restore a snapshot and take another snapshot, a branch, or child snapshot, is created.
Parent Snapshots The first virtual machine snapshot that you create is the base parent snapshot.The parent snapshot is the most recently saved version of the current state of the virtual machine. Taking a snapshot creates a delta disk file for each disk attached to the virtual machine and optionally, a memory file. The delta disk files and memory file are stored with the virtual machine’s files. The parent snapshot is always the snapshot that appears immediately above the You are here icon in the Snapshot Manager. If you revert or restore a snapshot, that snapshot becomes the parent of the You are here current state.
No snapshot is taken in above screen.
Screen capture while taking snapshot
After snapshot is taken
Child Snapshots A snapshot that is taken of the same virtual machine after the parent snapshot.Each child constitutes delta files for each attached virtual disk, and optionally a memory file that points from the present state of the virtual disk (You are here). Each child snapshot’s delta files merge with each previous child snapshot until reaching the parent disks. A child disk can later be a parent disk for future child disks.The relationship of parent and child snapshots can change if you have multiple branches in the snapshot tree.
IMPORTANT Do not manually manipulate individual child disks or any of the snapshot configuration files because doing so can compromise the snapshot tree and result in data loss. This restriction includes disk resizing and making modifications to the base parent disk using vmkfstools.
Each snapshot creates an additional delta .vmdk disk file. When you take a snapshot, the snapshot mechanism prevents the guest operating system from writing to the base .vmdk file and instead directs all writes to the delta disk file. The delta disk represents the difference between the current state of the virtual disk and the state that existed at the time that you took the previous snapshot. If more than one snapshot exists, delta disk scan represent the difference between each snapshot.
Warning Delta disk files can expand quickly and become as large as the entire virtual disk if the guest operating system writes to every block of the virtual disk.