Noctis0791
Enthusiast
Enthusiast

automatic snapshot creation and deletion

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

Labels (2)
0 Kudos
5 Replies
continuum
Immortal
Immortal

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

 

 


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
Noctis0791
Enthusiast
Enthusiast

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

0 Kudos
hamidja
Enthusiast
Enthusiast

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

0 Kudos
Noctis0791
Enthusiast
Enthusiast

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

0 Kudos
Noctis0791
Enthusiast
Enthusiast

Another question.  Can we use Power CLI without vCenter?

Thank You!

Logbi

Tags (1)
0 Kudos