VMware Cloud Community
leiw324
Contributor
Contributor

How to remove locked snapshots ?

Hello,

One of VM has 20 snapshots and cannot be removed by snapshots manager.

And checked can use CLI to remove them: http://kb.vmware.com/kb/1002310

Question here

I checked the VM using PTDC01-000020.vmdk, is it mean I just remove other snapshots PTDC01-000001.vmdk - PTDC01-000019.vmdk

by command line ? and CLI can remove locked snapshots ?

Thanks !

0 Kudos
23 Replies
leiw324
Contributor
Contributor

Hi,

Just tried the following command:

vmware-cmd /vmfs/volumes/4d504681-97382283-b7a0-842b2b215ee8/PTDC01/PTDC01.vmx removesnapshots

But can’t remove locked snapshots:

Traceback (most recent call last):

  File "/usr/bin/vmware-cmd", line 93, in ?

    main()

  File "/usr/bin/vmware-cmd", line 65, in main

    result = TaskManager().HandleIfTask(result, async=False)

  File "/usr/lib/vmware/vmware-cmd/TaskManager.py", line 17, in HandleIfTask

    else:      return self.WaitForTask(task)

  File "/usr/lib/vmware/vmware-cmd/TaskManager.py", line 28, in WaitForTask

    result = task.WaitForCompletion()

  File "/usr/lib/vmware/vmware-cmd/Task.py", line 20, in WaitForCompletion

   .OnProgressUpdate)

  File "/usr/lib/python2.4/site-packages/pyVim/task.py", line 120, in WaitForTas                                                                             k

    raise task.info.error

pyVmomi.VmomiSupport.vim.fault.FileLocked: (vim.fault.FileLocked) {

   dynamicType = <unset>,

   dynamicProperty = (vmodl.DynamicProperty) [],

   msg = 'Unable to access file <unspecified filename> since it is locked',

   faultCause = <unset>,

   faultMessage = (vmodl.LocalizableMessage) [],

   file = '<unspecified filename>'

}

0 Kudos
a_p_
Leadership
Leadership

Could you please explain what you mean by "locked snapshot"?

With 20 snapshots it might be a better option to create a clone of the virtual disk instead of committing the snapshots. However, this depends on the size of the snapshots as well as the ESX version/build you are running.

Please attach a list of files in the VM's folder showing names, sizes, date/time as well as the latest vmware.log.

Which ESX version/build do you currently run?

How much free disk space do you have on the datatstore?

André

0 Kudos
depping
Leadership
Leadership

20 snapshots deep? What is the totalsize of the snapshot files? I would probably also opt for a converter task, as committing these can take a very long time.

ps: usually adding a new snapshot and doing a delete from the commandline does resolve these issue. but again doing a converter task is the safer.

Duncan

Yellow-bricks.com | HA/DRS technical deepdive - the ebook

0 Kudos
leiw324
Contributor
Contributor

Stopped the backup software service to release locked snapshot and the command show the following:

removesnapshots() = 1

What is it ??

0 Kudos
leiw324
Contributor
Contributor

The server do not have other datastorage for clone VM.

Please see attacged image

0 Kudos
leiw324
Contributor
Contributor

I followed KB to create snapshot by CLI and then remove by CLI, but it fail:

[root@ESX01 ~]# vmware-cmd /vmfs/volumes/4d504681-97382283-b7a0-842b2b215ee8/PTDC01/PTDC01.vmx createsnapshot "test" "" 0 0
createsnapshot(test, , 0, 0) = 1
[root@ESX01 ~]# vmware-cmd /vmfs/volumes/4d504681-97382283-b7a0-842b2b215ee8/PTDC01/PTDC01.vmx removesnapshots
Traceback (most recent call last):
  File "/usr/bin/vmware-cmd", line 93, in ?
    main()
  File "/usr/bin/vmware-cmd", line 65, in main
    result = TaskManager().HandleIfTask(result, async=False)
  File "/usr/lib/vmware/vmware-cmd/TaskManager.py", line 17, in HandleIfTask
    else:      return self.WaitForTask(task)
  File "/usr/lib/vmware/vmware-cmd/TaskManager.py", line 28, in WaitForTask
    result = task.WaitForCompletion()
  File "/usr/lib/vmware/vmware-cmd/Task.py", line 20, in WaitForCompletion
    onProgressUpdate=self.OnProgressUpdate)
  File "/usr/lib/python2.4/site-packages/pyVim/task.py", line 120, in WaitForTask
    raise task.info.error
pyVmomi.VmomiSupport.vim.fault.FileLocked: (vim.fault.FileLocked) {
   dynamicType = <unset>,
   dynamicProperty = (vmodl.DynamicProperty) [],
   msg = 'Unable to access file <unspecified filename> since it is locked',
   faultCause = <unset>,
   faultMessage = (vmodl.LocalizableMessage) [],
   file = '<unspecified filename>'
}

0 Kudos
leiw324
Contributor
Contributor

This standalone ESX host is verison 4.1 

0 Kudos
leiw324
Contributor
Contributor

If I do clone, is it require poweroff this VM ?

0 Kudos
a_p_
Leadership
Leadership

If I do clone, is it require poweroff this VM ?

Yes.

I still think it's the backup process locking a file. Do you see any entries about the lock in the vmware.log?

What you could try is to delete all the CTK files (your next backup may take more time, but they will be rebuilt with the next snapshot), create a new snapshot in the Snapshot Manager and then select "Delete All".

André

0 Kudos
leiw324
Contributor
Contributor

Log in attached file, please help

0 Kudos
leiw324
Contributor
Contributor

Do you mean  delete all ctk files > create a new snapshot in the Snapshot Manager > click "Delete All" button in the Snapshot Manager?

0 Kudos
a_p_
Leadership
Leadership

Do you mean  delete all ctk files > create a new snapshot in the Snapshot Manager > click "Delete All" button in the Snapshot Manager?

Yes. You can delete the ctk files using the datastore browser or the console. They are only used for changed block tracking and will be rebuilt. Maybe it's one of these files causing the issue!?

The log file does not help much, because it only shows events until March, 16th. Did you modify any settings regarding log rotation?

André

0 Kudos
leiw324
Contributor
Contributor

Please see attached file, I selected all ctk files, do you mean of them ?

0 Kudos
leiw324
Contributor
Contributor

I do not have much to change this VM.

0 Kudos
a_p_
Leadership
Leadership

Please see attached file, I selected all ctk files, do you mean of them ?

Yes, these are the ctk files. Btw you can also sort the files by size, that makes it easier to select the files.

I do not have much to change this VM.

I don't understand what you mean by this!?

André

0 Kudos
leiw324
Contributor
Contributor

I mean I have not change this VM settings too much

0 Kudos
leiw324
Contributor
Contributor

The answer is same ....

0 Kudos
leiw324
Contributor
Contributor

After cloned VM, is it possilbe remove all snapshot ?

0 Kudos
qvantas77
Contributor
Contributor

Hi,

After the cloning job there wont be any snapshot.

(On the source VM, Yes)

Regards

Johan

0 Kudos