Unable to create snapshot: Operation failed because file already exists or Cannot complete the operation because the file or folder [DatastoreName] VMname/VMname.vmx already exists
search cancel

Unable to create snapshot: Operation failed because file already exists or Cannot complete the operation because the file or folder [DatastoreName] VMname/VMname.vmx already exists

book

Article ID: 308942

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

Symptoms:

While creating a virtual machine snapshot from the VI or vSphere Client, or from the command line, you may receive any of these errors depending on your product version:

  • ESX/ESXi 3.5 or VirtualCenter 2.5 VI Client, shows an error similar to:

    Operation failed because file already exists

  • ESX/ESXi 3.5 Service Console, shows an error similar to:

    VMControl error -3: Invalid arguments

    For example:

    # vmware-cmd VMname.vmx createsnapshot name desc 0 0
    VMControl error -3: Invalid arguments


  • ESX/ESXi/vCenter Server 4.0 vSphere Client, shows an error similar to:

    Cannot complete the operation because the file or folder [DatastoreName] VMname/VMname.vmx already exists

  • ESX/ESXi/vCenter Server 4.1 vSphere Client, shows an error similar to:

    Cannot complete the operation because the file or folder <unspecified filename> already exists

  • ESX/ESXi 4.0 Service Console, shows an error similar to:

    # vmware-cmd /vmfs/volumes/47ecbe04-acfca740-564c-001a4be960e0/VMname/VMname.vmx createsnapshot name desc 0 0
    Task reported error: (vim.fault.FileAlreadyExists) {
    dynamicType = <unset>,
    dynamicProperty = (vmodl.DynamicProperty) [],
    msg = 'Cannot complete the operation because the file or folder [DatastoreName] VMname/VMname.vmx already exists',
    faultCause = <unset>,
    faultMessage = (vmodl.LocalizableMessage) [],
    file = '[DatastoreName] VMname/VMname.vmx'
    }
    createsnapshot(name, desc, 0, 0) = 0


  • ESX/ESXi 4.1 Service Console, shows an error similar to:

    # vmware-cmd /vmfs/volumes/47ecbe04-acfca740-564c-001a4be960e0/VMname/VMname.vmx createsnapshot name desc 0 0
    Task reported error: (vim.fault.FileAlreadyExists) {
    dynamicType = <unset>,
    dynamicProperty = (vmodl.DynamicProperty) [],
    msg = 'Cannot complete the operation because the file or folder <unspecified filename> already exists',
    faultCause = <unset>,
    faultMessage = (vmodl.LocalizableMessage) [],
    file = '[DatastoreName] VMname/VMname.vmx'
    }
    createsnapshot(name, desc, 0, 0) = 0


  • ESX/ESXi 3.5 hostd.log file contains these entries:

    'BaseLibs' 51723184 info] SNAPSHOT: SnapshotBranchDisk failed: The file already exists (39).
    'BaseLibs' 51723184 info] SNAPSHOT: SnapshotBranch failed: The file already exists (5).
    'BaseLibs' 51723184 info] DISKLIB-LINK : File '/vmfs/volumes/4c0f81ad-b85976a8-21d1-001cc493ce16/VMname/VMname-000002-delta.vmdk' already exists.
    'BaseLibs' 51723184 info] DISKLIB-LIB : Failed to create link: The file already exists (39)
    'BaseLibs' 51723184 info] SNAPSHOT: SnapshotBranchDisk failed: The file already exists (39).
    'BaseLibs' 51723184 info] SNAPSHOT: SnapshotBranch failed: The file already exists (5).


  • ESX/ESXi 4.x hostd.log file contains these entries, shows an error similar to:

    info 'Libs'] SNAPSHOT: SnapshotBranch failed: The file already exists (5).
    info 'Vmsvc'] Failed to do Snapshot op: Error: (12) The file already exists
    info 'DiskLib'] DISKLIB-LINK : File '/vmfs/volumes/47ecbe04-acfca740-564c-001a4be960e0/VMname/VMname-000004-delta.vmdk' already exists.
    info 'DiskLib'] DISKLIB-LIB : Failed to create link: The file already exists (39)
    info 'DiskLib'] DISKLIB-LIB : Failed to create link: The file already exists (39)
    info 'Libs'] SNAPSHOT: SnapshotBranch failed: The file already exists (5).
    info 'Vmsvc'] Failed to do Snapshot op: Error
    : (12) The file already exists

  • ESXi 5.x hostd.log file contains entries similar to, shows an error similar to:

    012-05-22T12:36:59.075Z [5ED40B90 info 'vm:/vmfs/volumes/4f66bf0c-9c44e66e-d073-984be10fb0db/a4/a4.vmx'] Failed to consolidate disks in Foundry: Error: (15) The file is already in use
    2012-05-22T12:36:59.075Z [5ED40B90 info 'Libs'] Vix: [5956 foundryHandleProperties.c:372]: Error VIX_E_UNRECOGNIZED_PROPERTY in FoundryGetStringProperty(): Unrecognized handle property identifier
    2012-05-22T12:36:59.075Z [5ED40B90 info 'Libs'] Vix: [5956 foundryHandleProperties.c:3354]: Error VIX_E_UNRECOGNIZED_PROPERTY in Vix_GetPropertiesImpl(): Unable to get string property 3045.
    2012-05-22T12:36:59.075Z [5ED40B90 info 'Libs'] Vix: [5956 foundryHandleProperties.c:3252]: Error VIX_E_UNRECOGNIZED_PROPERTY in Vix_GetPropertiesVargs(): Unrecognized handle property identifier
    2012-05-22T12:36:59.075Z [5ED40B90 info 'ha-eventmgr'] Event 2230 : Virtual machine a4 disks consolidation failed on esx01.abc.com in cluster vm01.abc.com in ha-datacenter.
    2012-05-22T12:36:59.101Z [5ED40B90 verbose 'vm:/vmfs/volumes/4f66bf0c-9c44e66e-d073-984be10fb0db/a4/a4.vmx'] Found helper snapshot 57, the VM needs consolidation.
    2012-05-22T12:36:59.101Z [5ED40B90 verbose 'vm:/vmfs/volumes/4f66bf0c-9c44e66e-d073-984be10fb0db/a4/a4.vmx'] Time to gather Snapshot information ( read from disk, build tree): 3 msecs. needConsolidate is true.
    2012-05-22T12:36:59.101Z [5ED40B90 verbose 'vm:/vmfs/volumes/4f66bf0c-9c44e66e-d073-984be10fb0db/a4/a4.vmx'] Snapshot property update: Configure will be invalidated for:


Environment

VMware ESX Server 3.5.x
VMware ESXi 4.1.x Embedded
VMware ESXi 4.0.x Embedded
VMware vSphere ESXi 5.0
VMware ESX 4.0.x
VMware ESXi 4.1.x Installable
VMware ESXi 3.5.x Installable
VMware ESXi 4.0.x Installable
VMware ESXi 3.5.x Embedded
VMware vSphere ESXi 5.5
VMware vSphere ESXi 5.1
VMware ESX Server 3.0.x
VMware ESX 4.1.x

Resolution

This issue occurs when VMware ESX or ESXi tried to create a new vDiskname-delta.vmdk redolog file, but the generated filename already exists. This can occur if the -delta.vmdk redolog file does not have an associated descriptor file.

Every virtual disk is composed of two files, a flat or delta file containing the actual data and a descriptor file containing geometry and topology information. For example, vDiskname.vmdk and vDiskname-flat.vmdk or vDiskname-delta.vmdk. For more information, see Understanding virtual machine snapshots in VMware ESX (1015180).

When creating a snapshot, the host uses the lowest file number that is not in use by the chain of snapshots and does not exist on the directory. The host calculates this by checking through the descriptor files.

When the host tries to create the snapshot, it first creates the new descriptor file, then creates the associated -delta.vmdk file. If the host detects that a -delta.vmdk file with that name already exists the snapshot operation fails and the virtual machine reverts to its previous state.

To resolve this issue, locate and manually rename or move the -delta.vmdk file that does not have an associated descriptor file.
To locate and manually rename or move the -delta.vmdk file that does not have an associated descriptor file:
  1. Connect to the ESX or ESXi host using the vSphere Client.
  2. Locate the affected virtual machine in the Inventory.
  3. Determine which datastore(s) the virtual machine is stored on.
  4. Open the Datastore Browser.
  5. Navigate to the working directory containing the virtual machine configuration files. For more information, see Creating snapshots in a different location than default virtual machine directory (1002929).
  6. Confirm that remnant redolog delta.vmdk files from previous snapshots exist. For example:

    • The virtual machine is currently pointed to vmname-000001.vmdk.
    • vmname-000001.vmdk's parent is the virtual machine base disk, vmname.vmdk.
    • A file named vmname-000002-delta.vmdk exists in the virtual machine directory.
    • A file named vmname-000002-delta.vmdk~ exists in the virtual machine directory.
    • The .vmx file does not reference the file named vmname-000002-delta.vmdk.
    • The .vmsd file does not reference the file named vmname-000002-delta.vmdk.

  7. Rename or move the remnant file aside. For example, move the file vmname-000002-delta.vmdk into a backup directory.
  8. Retry the Create Snapshot operation, it should complete successfully.
Notes:
  • If the memory state is captured for a snapshot, a .vmsn file is created before the new .vmdk files. If the snapshot operation fails unexpectedly, the process halts and the .vmsn file is left behind. The .vmsn files can be safely removed if the virtual machine has no snapshots. If there are any snapshots, look in the .vmsd file to identify which .vmsn files are referenced by the virtual machine and remove the rest.
  • You may encounter such issue when you delete the descriptor file by browsing the datastore (assuming those are snapshot disk files and delta files are not visible) of a Virtual machine whose Snapshot/s is/are not visible through Snapshot Manager.


Additional Information

For related information, see Working with snapshots (1009402).

To be alerted when this document is updated, click the Subscribe to Article link in the Actions box

Creating snapshots in a different location than default virtual machine directory for VMware ESXi and VMware ESX
Working with snapshots
Understanding VM snapshots in ESXi / ESX
无法创建快照:由于文件已经存在而操作失败,或者由于文件或文件夹 [DatastoreName] VMname/VMname.vmx 已经存在而无法完成操作