Tuesday, November 8, 2016

Snapshots through Command line Interface


Symptoms

Snapshots of virtual machines running on snapshot disks are not detected by the Snapshot Manager.

Purpose

Consolidate snapshots on the ESXi host that are not detected by the Snapshot Manager.

Resolution

To resolve this issue, consolidate snapshots on the ESXi host.

To consolidate snapshots on the ESXi host:
  1. Log in to the ESXi console through iLO/DRAC as a root user.
  2. Navigate to the virtual machine directory containing the .vmdk files.
  3. Run this command to list files in the directory:

    ls -ltrh *.vmdk
  4. Locate snapshot files similar to VM_NAME-00000#.vmdk or VM_NAME-00000#-delta.vmdk.

    Note: The delta files should have the current timestamp

  5. Run this command to get a list of virtual machines and the VMID for each virtual machine:

    vim-cmd vmsvc/getallvms
    Note the VMID of the virtual machine for which the snapshot is not detected.

  6. Run this command to verify if the snapshot exists:

    vim-cmd vmsvc/snapshot.get VMID
  7. Run this command to remove all snapshots:

    vim-cmd vmsvc/snapshot.removeall VMID
  8. If the snapshot.removeall command fails with the error cannot find VMID, run this command to create a new snapshot:

    vim-cmd vmsvc/snapshot.create VMID snapshotName description includeMemory quiesced
    Where includeMemory and quiesced variables are boolean values. Set the value to 1 to enable or 0 to disable the snapshot option.

    For example:

    # vim-cmd vmsvc/snapshot.create 10 my_snapshot snapshot_test 0 0
  9. Run this command to remove all snapshots:

    vim-cmd vmsvc/snapshot.removeall VMID

Additional Information

To verify if the virtual machine is running on snapshot disks:
  1. Right-click the virtual machine and click Edit Settings.
  2. Select the Virtual Disk and check the Disk File. If it is labeled as VM-000001.vmdk, the virtual machine is running on snapshot disks.

No comments:

Post a Comment

Thanks for showing interest in tech-jockey.

Content of this blog has been moved to GITHUB

Looking at current trends and to make my content more reachable to people, I am moving all the content of my blog https://tech-jockey.blogsp...