VMware vSphere

 View Only
  • 1.  automatic snapshot creation and deletion

    Posted Feb 07, 2021 10:55 AM

    Hi Experts,

    I know we shouldn't be using snapshots for backup but we kind of need this feature right now to protect a critical server for the next 2 weeks. Is it possible to automate the creation of snapshot at 6AM and 6PM then delete the 2 oldest snapshot at 10PM? The environment is on a free ESXi version so I believe we have to create cron jobs for it in the ESXi Host? Please advise.


    Thank you all in advanced!

    Logbi



  • 2.  RE: automatic snapshot creation and deletion

    Posted Feb 07, 2021 12:34 PM

    To "protect" a VM running on free ESXi you do NOT make the system more fragile by adding snapshots !!!

    Instead you remove all snapshots - make sure the vmdks are eager-zeroed provisioned and then write down the mapping of the existing fragments.
    Store the textfile with the mapping outside of the ESXi.

    How to create a textfile with the mapping::

    vmkfstools -p 0 name-flat.vmdk > name-flat-mapping.txt

    Then copy name-flat-mapping.txt to your admin-host.
    This procedure "protects" your vmdk against accidental deletes and VMFS-corruption.

    And by the way ... creating cron-jobs in free ESXi is not trivial !

     

    Ulli

     

     



  • 3.  RE: automatic snapshot creation and deletion

    Posted Feb 09, 2021 01:23 AM

    I found vim-cmd.  Do you guys know the missing parameters I should add in this command to delete the oldest snapshot of the VM? 

    vim-cmd vmsvc/snapshot.remove17

     

    Thank You!

    Logbi



  • 4.  RE: automatic snapshot creation and deletion

    Posted Feb 09, 2021 12:05 PM

    Hi continuum I did not understand ? what does it do?



  • 5.  RE: automatic snapshot creation and deletion

    Posted Feb 10, 2021 12:42 AM

    I found this below command in this article but its unfortunately not deleting the oldest snapshot.  Can you guys check  what could be missing here?

     

    VM_ID=17
    SNAPSHOT_COUNT=`vim-cmd vmsvc/snapshot.get $VM_ID | egrep -- '--\|-CHILD|^\|-ROOT' | wc -l`
    vim-cmd vmsvc/snapshot.remove $VM_ID false $(($SNAPSHOT_COUNT-1)) 0

     

    Thank You!

    Logbi



  • 6.  RE: automatic snapshot creation and deletion

    Posted Feb 10, 2021 07:37 PM

    Another question.  Can we use Power CLI without vCenter?

    Thank You!

    Logbi