10 Replies Latest reply on Mar 15, 2011 8:18 AM by opbz

    How to remove snapshot files?

    AndreyGorokhov Enthusiast


      i have a problem:

      i removed snapshot from vSphere client but snapshot files still in VM folder and i cannot create new snapshots... so how to remove this snapshot files???

      thanks in advance

        • 1. Re: How to remove snapshot files?
          AJ Master

          login to comment prompt

          type vmware-cmd -l


          locate the vmx file location of the vm for which u want to delete the snapshots


          once you do that


          type this

          vmware-cmd -v /vfs/volumes/path of vmx of VM removesnapshots.


          you can do the same through the GUI as well...


          hope this helps

          • 2. Re: How to remove snapshot files?
            AndreyGorokhov Enthusiast

            yes, i think it's a goot direction... but i have ESXi... and i forgor how this tool calls... for ESXi.

            • 3. Re: How to remove snapshot files?
              AJ Master

              u can use vcli for the same..


              i would recommend u to use GUI in this case....but make sure u pull out a backup of the VM (cloning etc) before u play with snapshots....

              • 4. Re: How to remove snapshot files?
                AndreyGorokhov Enthusiast

                i tryed to do this and its looks like all snapshots removed!

                ~ # vim-cmd vmsvc/getallvms
                Vmid       Name                              File                                                      Guest OS                       Version   Annotation
                144    r1002kncr          [Main Datastore] r1002kncr/r1002kncr.vmx                 winNetStandardGuest       vmx-07
                16     rusbw002_test    [Main Datastore] rusbw002_test/rusbw002_test.vmx   slesGuest                        vmx-07
                32     kl00pcws           [Main Datastore] kl00pcws/kl00pcws.vmx                   winXPProGuest                vmx-07
                96     Winback            [Main Datastore] Winback/Winback.vmx                    slesGuest                        vmx-07    Winback
                ~ # vim-cmd vmsvc/snapshot.removeall 16
                Remove All Snapshots:
                ~ #



                but in VM folder still no changes...

                /vmfs/volumes/5d57c4f3-ca3cf76a/rusbw002_test # ls
                rusbw002_test-000001-delta.vmdk    rusbw002_test-flat.vmdk            rusbw002_test.vmxf                 rusbw002_test_2-000001-delta.vmdk  vmware-2.log
                rusbw002_test-000001.vmdk          rusbw002_test.nvram                rusbw002_test_1-000001-delta.vmdk  rusbw002_test_2-000001.vmdk        vmware-3.log
                rusbw002_test-Snapshot73.vmsn      rusbw002_test.vmdk                 rusbw002_test_1-000001.vmdk        rusbw002_test_2-flat.vmdk          vmware-4.log
                rusbw002_test-aux.xml              rusbw002_test.vmsd                 rusbw002_test_1-flat.vmdk          rusbw002_test_2.vmdk               vmware-5.log
                rusbw002_test-aux.xml.tmp          rusbw002_test.vmx                  rusbw002_test_1.vmdk               vmware-1.log                       vmware.log

                • 5. Re: How to remove snapshot files?
                  AndreyGorokhov Enthusiast

                  From GUI... do you mean vSphere Client?

                  • 7. Re: How to remove snapshot files?
                    AndreyGorokhov Enthusiast

                    there are no snapshots in GUI... vSphere Client don't see this snapshot...

                    • 8. Re: How to remove snapshot files?
                      AJ Master

                      try this

                      vim-cmd vmsvc/snapshot.get [VMID]


                      You see an output similar to:

                      Get Snapshot:
                      --Snapshot Name        : Test
                      --Snapshot Desciption  :
                      --Snapshot Created On  : 8/27/2009 13:49:55
                      --Snapshot State       : powered on


                      vim-cmd vmsvc/snapshot.create [VmId] [snapshotName]


                      Run this command and try to remove all snapshots again:


                      vim-cmd vmsvc/snapshot.removeall [VmId]




                      hope this works

                      • 9. Re: How to remove snapshot files?
                        AndreyGorokhov Enthusiast

                        i have tryed it. no luck... files still not removed.

                        i using ghettoVCB script for backup and its not working now... something do not let this script to make new snapshots...

                        • 10. Re: How to remove snapshot files?
                          opbz Hot Shot

                          are the snapshots still in use?


                          If you look at the vm settings and the disks does it mention one of the snapshot files?


                          If it does not then you should be able to manually delete them. but before you do this check to ensure that the parentCID of the vmdk file is all f's


                          if it shows that you are using a snapshot then you will need to run the vmkfstools -i to consolidate the snapshots.


                          you can use it directly from the ESXi server you need to login into server and get to console (you might need to enable it)


                          then run

                          vmkfstools -i /vmfs/volumes/datstore-name/vm-name/snapshot.vmdk newdisk.vmdk

                          this will consolidate the vmdks and create a new disk file called newdisk.vmdk you will need to remove remove disks and add new disks to the VM use customer mode and point it to the newdisk.vmdk you created.


                          power on vm if it works you can then manually delete the snapshot vmdks and other vmdks that are not being used from the vm folder


                          good luck