Deep Intro to VMware, Part 8: Snapshot
A big benefit of Virtual Machines is the ability to take a snapshot. Every snapshot contains small or big changes on your virtual machine and it gives you a great tool to test new software or functionality before you really upgrade your computer.
A snapshot captures the entire state of the virtual machine at the time you take the snapshot. This includes:
- Memory state - The contents of the virtual machine's memory.
- Settings state - The virtual machine settings.
- Disk state - The state of all the virtual machine's virtual disks.
Snapshots operate on individual virtual machines. In a team of virtual machines, taking a snapshot helps to preserves the state of an active virtual machine. When you revert to a snapshot, you return all these items to the state they were in at the time you took that snapshot. Snapshots are useful when you need to revert repeatedly to the same state but you don't want to create multiple virtual machines. With snapshots, you create backup and restore positions in a linear process. You can also preserve a baseline before using a virtual machine. Snapshots can be used as restore points during a process, such as installing update packages, install service packs, or installing different versions of a program. Taking snapshots ensures that each installation begins from an identical baseline.
Relationship Between Snapshots
The relationship between snapshots is like that of a parent to a child:
- In the linear process, each snapshot has one parent and one child, except for the last snapshot, which has no children.
- In the process tree, each snapshot has one parent, but one snapshot may have more than one child. Many snapshots have no children.
You can revert to a parent or a child.
NOTE Snapshots of raw disks, RDM physical mode disks, or independent disks are not supported.
When you take a snapshot, make sure that there is no other activity going on in the virtual machine and the likely effect of that activity can make your snapshot unusable. In general, it is best to take a snapshot when no applications in the virtual machine are communicating with other computers. The potential for problems is the greatest if the virtual machine is communicating with another computer, especially in a production environment. 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, 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 will most likely fail. Another example is taking a snapshot while an application in the virtual machine is sending a transaction to a database on a separate machine. When you revert back to the previous snapshot your database will get corrupted because the processed data is already there.
Taking a Snapshot
Taking a snapshot is a synchronous operation. All user operations on the virtual machine during the period that is necessary to take the snapshot are blocked for snapshot and data consistency. The time necessary to take a snapshot depends on the amount of data and the load on the Vmware ESX host server. On average, the time ranges from 20 to 50 seconds for minimal snapshot creation. You can take a snapshot while a virtual machine is powered on, powered off, or suspended. If you are suspending a virtual machine, wait until the suspend operation has finished before you take a snapshot. You must power off the virtual machine before taking a snapshot if the virtual machine has multiple disks in different disk modes. 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. The independent disk will not work in the created snapshot. Be aware that before you take the snapshot that you set the disk dependent and later change it back again.
To take a snapshot of a virtual machine!
- Choose Inventory > Virtual Machine > Snapshot > Take Snapshot. You can also click the Take a snapshot of this virtual machine button, or right-click the virtual machine and choose Snapshot > Take Snapshot.
- The Take Virtual Machine Snapshot window appears. Type a name for your snapshot and type a description for your snapshot. Descriptions are very useful to identify differences between similarly named snapshots. Descriptions appear in the Snapshot Manager so it will be more easy to recognize the snapshot.
- Click OK. A progress pop-up menu box appears. When the snapshot has been successfully taken, it is listed in the Recent Tasks field at the bottom of VirtualCenter.
- Click the target virtual machine to display tasks and events for this machine or, while the virtual machine is still selected, click the Tasks & Events tab.
Changing Disk Mode to Exclude Virtual Disks from Snapshots
You must power off and delete any existing snapshots before you attempt to change the disk mode of a virtual machine. Deleting a snapshot involves committing the existing data on the snapshot disk to the parent disk. To exclude a disk from a snapshot
- Choose Inventory > Virtual Machine > Edit Settings.
- Click the Hardware tab, and select the hard disk you want to exclude.
- Under Mode, select Independent. Independent disks are not affected by snapshots. You have the following persistence options for an independent disk: Persistent - Changes are immediately and permanently written to the disk. All changes to an independent disk in persistent mode remain, even when you revert to that snapshot. Nonpersistent - Changes to the disk are discarded when you power off or revert to that snapshot.
- Click OK.
Using the Snapshot Manager
The Snapshot Manager lets you review all snapshots for the active virtual machine and act on them directly. The Snapshot Manager window contains the following areas:
- Snapshot tree - Displays all snapshots for the virtual machine.
- Details - Displays the name and description of the selected snapshot. These fields are blank if you have not selected a snapshot region Contains buttons for navigating out of the dialog box: Close - Closes the Snapshot Manager.
- Help - Opens the help system.
- Command buttons - The Snapshot Manager has three command buttons in the left pane: Go to, Delete, and Delete All.
- Navigation region
- and a You are here icon. Represents the current operational state of the virtual machine.
The You are here icon represents a state that is never a snapshot itself but rather the virtual machine state after the parent snapshot. A snapshot is always a static record of a virtual machine state. The You are here state can be operational and changing. Even when you create a snapshot of a powered off or suspended virtual machine, the You are here state is not identical to the snapshot.
You cannot go to or select the You are here state. You are here always represents the current and active state.
To use the snapshot manager
- Choose Inventory > Virtual Machine > Snapshot > Snapshot Manager.
- In the Snapshot Manager, select a snapshot by clicking it.
- To go to a snapshot, click the Go to button to restore the virtual machine to any of the arbitrary snapshots. The Go to command allows you to restore the state of any snapshot.
- Click Yes in the confirmation dialog box.
- To delete a snapshot, click the Delete button to permanently remove a snapshot from VirtualCenter use.
- Click Yes in the confirmation dialog box.
- To delete all snapshots, click the Delete All button to permanently remove all snapshots from VirtualCenter use.
- Click Yes in the confirmation dialog box.
- Click Close to exit the Snapshot Manager.
Restoring a Snapshot
VMware VirtualCenter includes the following snapshot methods to allow you to return to the original virtual machine:
- The Inventory > Virtual Machine > Snapshot menu contains the command Revert to Snapshot.
- The Snapshot Manager has a Go to button.
NOTE Delete commits the snapshot data to the parent and then removes the selected snapshot. Delete All commits all the immediate snapshots before the You are here current state to the base disk and removes all existing snapshots for that virtual machine.
As you see using snapshots can be a very good task to prevent you from losing virtual machines. You can do every installation upgrade or whatever you need to do in a safe manner without the risk getting stuck with non-working servers or clients.
Snapshots helped me a lot.
More information can be found on:
http://pubs.vmware.com/vi301/admin/wwhelp/wwhimpl/...