Monitoring Snapshot Removal: Strategies For Effective Surveillance

how to monitor snapshot removal

Monitoring snapshot removal is an important activity to ensure the smooth functioning of virtual machines (VMs). Snapshots play a critical role in the backup process, but they can also increase disk load if not properly managed. Left unchecked, snapshots can fill up datastore space, leading to performance issues or even VM failure. Therefore, it is essential to monitor the removal of snapshots to maintain the health of the VM environment. This includes tracking the age and size of individual snapshots, their impact on datastores, and the overall snapshot growth trend. By doing so, administrators can avoid resource contention, reclaim VM space, and effectively plan resource allocation. Additionally, there are various tools available, such as native VMware features and third-party software, that can assist in detecting and monitoring snapshots, ensuring the optimal performance of virtual machines.

Characteristics Values
Tools VMware vSphere ESXi, vim-cmd command, watch command, unix command, vCenter Orchestrator, Veeam ONE Reporter, The Veeam Management Pack, RVTools, Symantec NetBackup
Commands vim-cmd vimsvc/task_list, vim-cmd vimsvc/task_info <task_name_from_step_6>, watch -d 'ls -luth grep -E "delta flat sesparse">, find /vmfs/volumes/ -iname „*delta.vmdk”, vim-cmd vimsvc/task_info
Snapshot removal symptoms Task hangs at 95% or 99%, unable to observe progress, long VM unresponsiveness
Snapshot removal causes Virtual Machine snapshot size on disk, storage performance, network connection interruption, size of the Virtual Machine, underlying storage latency, high volume of I/O
Snapshot removal impact Performance degradation issues in VMs, VM failure, disk contention, resource allocation issues, adverse effects on guest applications or services
Snapshot removal best practices Monitor snapshot size and age, receive alerts, delete aged and unwanted snapshots, free up datastore space, prevent snapshot files from merging with parent snapshot

shundigital

Using the vim-cmd command

To monitor snapshot removal using the vim-cmd command, you can follow these steps:

Firstly, log in as root to the ESXi host using SSH. You can do this by opening an SSH shell session to the host that is performing the snapshot removal task. This can be achieved by running the following command:

Vim-cmd vimsvc/task_list

An example output of this command is:

ManagedObjectReference) [ 'vim.Task:haTask-9-vim.VirtualMachine.removeAllSnapshots-304060994' ]

Once you have identified the specific task, you can retrieve more detailed information about it by running the following command:

Vim-cmd vimsvc/task_info

For example, the command would look like this:

Vim-cmd vimsvc/task_info haTask-9-vim.VirtualMachine.removeAllSnapshots-304060994

The output of this command will provide various details about the snapshot removal task, including its status, progress, and any errors. For example, a successful consolidation of the snapshot will show "state = "success"" in the output.

Additionally, you can use the vim-cmd command to list all VMs on the host:

Vim-cmd vmsvc/getallvms

Then, using the vmid from the output, you can check for snapshot information:

Vim-cmd vmsvc/get.snapshotinfo vmid

These commands will help you monitor the progress and status of snapshot removal tasks using the vim-cmd command.

Wifi Adapter Monitor Mode: How to Check?

You may want to see also

shundigital

Using the watch command

The "watch" command can be used to monitor snapshot deletion in Linux. This is particularly useful when dealing with large snapshots that take longer than the 15 minutes Virtual Center gives to delete them. In such cases, it is better to order the Remove Snapshot on the Host rather than the Virtual Center as the former has no timeout.

Watch "ls -oghut --full-time *.vmdk"

If you are using ESXi, you can use the ls command instead:

Ls -lhut --time-style=full-iso *.vmdk

To monitor the VMDK snapshot and base disks that are currently being updated, you can use the following command:

Watch -d 'ls -luth | grep -E "delta|flat|sesparse"'

This command refreshes the file referred to by the ongoing task every 2 seconds. The -d option highlights the differences between successive updates.

Additionally, you can run the following command to monitor the timestamp update of the base disks and confirm if the process is working:

Ls -lrth |grep -E "flat|delta|sesparse"

shundigital

Using the find command

The 'find' command is a powerful tool in Linux that enables users to search for files and directories based on specific criteria. When monitoring snapshot removal, the 'find' command can be used to locate and manage snapshot files. Here are some ways in which the 'find' command can be utilised for this purpose:

Locating Snapshot Files

The 'find' command can be used to search for snapshot files within a specific directory or the entire filesystem. For example, to find all snapshot files in the current directory, you can use the command:

Find . -name "*.snapshot"

This command searches for any files or directories ending with the ".snapshot" extension.

Excluding Snapshot Directories

In some cases, you may want to exclude snapshot directories from the results of the 'find' command. This can be achieved by using the '-path' and '-prune' options. For instance:

Find $filedir -path "/.snapshots" -prune -o -name \*.gz -mmin +10 -print

This command excludes the ".snapshots" directory and its subdirectories from the search, while still looking for .gz files older than 10 minutes.

Monitoring Snapshot Removal Progress

The 'find' command can also be combined with other tools to monitor the progress of snapshot removal. For example, by using the 'watch' command in combination with 'find', you can refresh the file listing at regular intervals to see if snapshot files are being removed:

Watch -d 'find /path/to/snapshots -type f'

This command uses 'watch' to repeatedly execute the 'find' command, displaying any changes in the list of snapshot files every 2 seconds (by default).

Identifying Snapshot Files for Removal

In certain scenarios, you may need to identify specific snapshot files for removal. The 'find' command can assist in this process by providing various criteria for filtering files. For example, you can search for snapshot files based on their modification time:

Find /path/to/snapshots -type f -mtime +30

This command locates snapshot files that have not been modified in the last 30 days, which may be candidates for removal.

By utilising the 'find' command in these ways, you can effectively monitor and manage snapshot removal, ensuring efficient utilisation of system resources and maintaining optimal performance.

shundigital

Using the Delete option

To monitor snapshot removal, you can use the vim-cmd command. This allows you to monitor the snapshot deletion/consolidation process.

To do this, you must first open an SSH shell session to the host that is performing the consolidation and snapshot deletion task. You can do this by running the following command:

> vim-cmd vimsvc/task_list

Example output:

> (ManagedObjectReference) [ 'vim.Task:haTask-9-vim.VirtualMachine.removeAllSnapshots-304060994' ]

You can then retrieve more information about the task by running the following command:

> vim-cmd vimsvc/task_info

For example:

> vim-cmd vimsvc/task_info haTask-9-vim.VirtualMachine.removeAllSnapshots-304060994

Example output:

> (vim.TaskInfo) { dynamicType = , key = "haTask-9-vim.VirtualMachine.removeAllSnapshots-304060994", task = 'vim.Task:haTask-9-vim.VirtualMachine.removeAllSnapshots-304060994', description = (vmodl.LocalizableMessage) null, name = "vim.VirtualMachine.removeAllSnapshots", descriptionId = "VirtualMachine.removeAllSnapshots", --running process> entity = 'vim.VirtualMachine:9', entityName = "VirtualMachineName", ---Virtual Machine name> state = "running",---make sure the status is running & is not in a error state> cancelled = false, cancelable = false, error = (vmodl.MethodFault) null, result = , progress = 33, ---progress of task> reason = (vim.TaskReasonUser) { dynamicType = , userName = "root", }, queueTime = "2013-10-02T07:22:02.224526Z", startTime = "2013-10-02T07:22:02.225526Z", completeTime = , eventChainId = 304060994, changeTag = , parentTaskKey = , rootTaskKey = ,}

Note: A complete and successful consolidation of the snapshot will show state = "success" when you run the above command.

The Delete option can be used to remove a single parent or child snapshot from the snapshot tree. When you use the Delete option, disk changes that occur between the state of the snapshot and the previous disk state are written to the parent snapshot.

It is important to note that deleting a single snapshot will preserve the current state of the virtual machine and will not affect any other snapshots.

The Delete option can also be used to remove a corrupt snapshot and its files from an abandoned branch of the snapshot tree. This can be done without merging them with the parent snapshot.

To prevent snapshot files from merging with the parent snapshot, you can first use the Restore command to restore to a previous snapshot. This will invalidate the snapshot delta disks and delete the memory file. You can then use the Delete option to remove the snapshot and any associated files.

The Delete option is a useful tool for removing snapshots from the snapshot tree while preserving the current state of the virtual machine. It is important to note that deleting a snapshot will consolidate the changes between snapshots and previous disk states. This process can impact the performance of the virtual machine until consolidation is complete.

shundigital

Using the Delete All option

The 'Delete All' option is used to delete all snapshots from the Snapshot Manager. When you select this option, changes that occur between snapshots and the previous delta disk states are consolidated and written to the base parent disk, merging them with the base virtual machine disk. This process is also known as the "Consolidation process".

Using the 'Delete All' option will commit every snapshot of the chain directly to the Base Disk(s) of the virtual machine. If the Base Disk is preallocated (thick provision), no extra space is required for the 'Delete All' operation. However, if the Base Disk is non-preallocated (thin provision), the base disk will only grow when committing information from the snapshots, and each thin provision disk may grow up to its maximum size as mentioned in the Provisioned Size option in the virtual machine settings for the disk.

To monitor the status of the Consolidation Process, it is important to note that there is no accurate way to determine the progression of the commit process, and the progression bar in the VMware vSphere Client may not always report the accurate percentage. As long as the files are being read or written and the timestamps on the files continue to update, the process is still working.

To monitor snapshot deletion and consolidation using the vim-cmd command, you can follow these steps:

  • Open an SSH shell session to the host that is performing the consolidation and snapshot deletion task by running the command: vim-cmd vimsvc/task_list.
  • To retrieve more information about the task, run the following command: vim-cmd vimsvc/task_info . For example: vim-cmd vimsvc/task_info haTask-9-vim.VirtualMachine.removeAllSnapshots-304060994.

A complete and successful consolidation of the snapshot will show state = "success" when you run the above command.

Frequently asked questions

A snapshot is a critical part of the backup process and can increase the load on the disk if left unchecked. Snapshots are the first place to look when a VM is running slow.

To monitor snapshot deletion/consolidation using the vim-cmd command, open an SSH shell session to the host that is performing the consolidation and snapshot deletion task by running this command: vim-cmd vimsvc/task_list.

Log in as root to the ESXi host using SSH. Navigate to the virtual machine directory containing vmdk virtual disk files. Run the cd command to change the current directory. For example: cd /vmfs/volumes/Datastore_name/Virtual_Machine_name/.

You cannot observe the progress when you delete a snapshot. The snapshot removal task may hang at 95% or 99%.

Failure to monitor snapshots can lead to performance degradation issues in virtual machines (VMs). This can cause the datastore to fill up, leading to VM failure.

Written by
Reviewed by
Share this post
Print
Did this article help you?

Leave a comment