VMware vSphere

 View Only
Expand all | Collapse all

Clone VM to consolidate Snapshots via Command Line

beckham007fifa

beckham007fifaMay 28, 2012 11:17 AM

  • 1.  Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 10:27 AM

    Hi,

    I have a VM which has mulitple Snapshots which have failed to be consolidated via the snapshot manager.

    I belive the best approach to resolve this issue is by cloning the VM via the Command Line using vmkfstools.

    The VM in question is a mail server (running MDaemon) which is in production so uptime is an issue.

    Can the clone be done whilst the VM is powered on? And if so is it then possible to consolidate the changes that have happened since the clone started?

    Thanks in advance, Karl.



  • 2.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 10:29 AM

    i am not good in pcli.

    for doing it through commands,

    vmkfstools -i <source.vmdk> <clone.vmdk>

    Apology if your purpose is not resolved.



  • 3.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 10:31 AM

    And if so is it then possible to consolidate the changes that have happened since the clone started?

    in esxi5.0, there is snapshot consolidation option available.



  • 4.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 11:05 AM

    Hi,

    As stated I have been unable to consolidate the Snapshots via the vSphere client, hence I need to do it via the Command Line.

    Do you know if the clone can be done 'online'? And also what changes will be included whilst the clone is taking place?

    Thanks



  • 5.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 11:09 AM

    Welcome to the Community,

    unfortunately, cloning is an offline function.

    What kind of issues do you have with deleting the snapshots and how many snapshots do you have (in the datastore browser)? Maybe there's a chance to resolve the issue with the VM powered on.

    André



  • 6.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 11:20 AM

    Hi Andre,

    Somehow there was a snapshot that was not showing in snapshot manager.

    We then had a powercut whilst Veeam was running a backup, which meant there was a second snapshot.

    Veeam then also tried to run last night but failed to remove the newest snapshot (so now there are 3).

    I have paused the Veeam backup, and attempted to Consolidate the 2 Veeam snapshots, these were removed from snapshot manager, but are still visable in Datastore Browser.

    It sounds as if the only option will be to take the server offline whilst the clone is completed?

    Thanks, Karl



  • 7.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 11:27 AM

    Hard to say what happened with the power cut. However, to me this sounds more like there's still a process on the ESXi host which may lock any of the virtual machine's files? Do you see any entries in the VM's latest vmware.log file which might help (e.g. locked files)? Often such issues can be resolved by making sure the backup server is inactive and then restarting the Management Agents on the ESXi host. After that, open the Snapshot Manager, create another snapshot and run "Delete All".

    André

    PS: http://kb.vmware.com/kb/1003490 (Restarting the Management agents on ESXi)



  • 8.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 11:33 AM

    We did have a problem when trying to delete the snapshots as they were locked out by another process, so I restarted the management tools on that host.

    The snapshots were then deleted unsucessfully.

    Attached is the log file for this VM.

    Also if I try to take another snapshot now I get the message "A general system error occurred: Unable to save the snapshot file"

    Thanks



  • 9.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 11:51 AM


  • 10.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 11:57 AM

    To be honest, I don't know what's causing the "An error occurred while saving the snapshot" error message. Maybe there's an issue with the VMFS metadata after the power failure. If you do have an active Support contract with VMware, you should immediately open a call and not try to do anything that could make things even worse.

    André



  • 11.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 12:24 PM

    AB - does that command set just delete the snapshots or consolidate them?

    Andre - I'm not sure either, which is why I think the least risky option is a command line Clone. We can always revert to the original disks if there is a problem. Our support contract is subscription only so we would have to purchase a support call, and I'm fairly sure they would only advise us to clone the machine anyway.

    re the powercut, I'm sure the snapshot had been created successfully, just that the Veeam backup didn't complete, so the snapshot was then never removed.



  • 12.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 12:34 PM

    You could clone the VM while it's running with the Converter Standalone tool, as well.  I'm a little disturbed that the snapshot consolidation didn't work, as your problem is exactly the issue it was added to fix :smileysad:



  • 13.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 01:44 PM

    Interesting development. The Host was consolidating the snapshots in the background the whole time, the VM is now only showing snapshot 00002.vmdk.

    Attached is the log, can anyone tell me if they think this is still running?

    Thanks



  • 14.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 02:08 PM
    Attached is the log, can anyone tell me if they think this is still running?

    At least it looks that way. You may be able to determine whether the process is still running by checking the performance values for the datastore!?

    Anyway, other than the issue mentioned, you may want to set the virtual CD-ROM drive to disconnected unless you need it. There are lots of errors in the log file and this could lead to a reduced VM performance. I'd also recommend you set the video RAM for this VM to 32MB (currently 8).

    André



  • 15.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 29, 2012 03:38 AM

    From the logs, I have taken some of the entries which is justifying that i may would have completed. Also as a.p suggested check from esxtop performance results displayed for confirming its completion from all possible ways.

    From your logs:

    May 28 11:42:02.210: SnapshotVMXCombiner| SnapshotVMXCombineFinalCb: Done with combine of 2 links, starting from 2 with error 0x0: The operation completed successfully

    May 28 11:58:54.399: vmx| Closing all the disks of the VM.
    May 28 11:58:54.399: vmx| SNAPSHOT: SnapshotDelete

    May 28 11:59:19.128: vmx| SnapshotVMXConsolidateOnlineCB: Done with consolidate

    So, I think you must be a happy man now if your issue got resolved.



  • 16.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted Jun 06, 2012 10:41 AM

    Update - In the end we cloned the VM online via the VMWare Convertor tool. We then used a third party application (Deltacopy) to sync changes between the two servers that had occurred since the conversion started (which incidently took 15 hours!).

    We then switched over to the newly converted VM and all is good.


    Thanks to all who made suggestions on this.

    Karl



  • 17.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 11:17 AM

    which version of ESX you have



  • 18.  RE: Clone VM to consolidate Snapshots via Command Line

    Posted May 28, 2012 11:21 AM

    We have vCenter 5.0 (virtual appliance), 1 ESXi v5.0 host, and two ESXi v4.1 hosts.

    The VM is question is sitting on a v4.1 host.

    Thanks