robertkwild
Enthusiast
Enthusiast

taking a snapshot via command line in vsphere

hi all,

just want to know if its possible to take a snapshot of a vm via the command line when i ssh into my vsphere

i have googled and have found you can do it via powercli but is that the only way?

thanks,

rob

0 Kudos
5 Replies
DavoudTeimouri
Virtuoso
Virtuoso

Hi,

https://www.xmsoft.de/2019/03/07/create-snapshot-including-memory-on-esxi-command-line/

** If you found this note/reply useful, please consider awarding points for "Correct" or "Helpful" ** Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/
0 Kudos
robertkwild
Enthusiast
Enthusiast

is it best to Quiescence or not to and can i only Quiescence a vm if they have vm guest tools on the vm i want to backup?

ok you do need to install vm tools, i installed open-vm-tools, reading from here

https://docs.vmware.com/en/VMware-vSphere/6.7/com.vmware.vsphere.vm_admin.doc/GUID-9720B104-9875-4C2...

do you think i need to tick  "Snapshot the virtual machine’s memory", what benefit has that got please?

0 Kudos
DavoudTeimouri
Virtuoso
Virtuoso

I guess, open-vm-tools is enough.

If you check the “Snapshot the virtual machine’s memory” option, the snapshot will also record the VM’s memory. If you check this box and the VM is running when you take a snapshot, the icon of the snapshot will be green.

 

** If you found this note/reply useful, please consider awarding points for "Correct" or "Helpful" ** Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/
0 Kudos
robertkwild
Enthusiast
Enthusiast

everytime i run this command

vim-cmd /vmsvc/snapshot.create 9 freeradiusSS quiesced

its giving it a description of "quiesced" instead of quiescing the snapshot, what am i doing wrong?

0 Kudos
DavoudTeimouri
Virtuoso
Virtuoso

I think, nothing is wrong.

But as a reminder:

  1. Run this command to create a new snapshot:

    vim-cmd vmsvc/snapshot.create VMID snapshotName description includeMemory quiesced

    Where includeMemory and quiesced variables are Boolean values. Set the value to 1 to enable or 0 to disable the snapshot option.

    For example:

    # vim-cmd vmsvc/snapshot.create 10 my_snapshot snapshot_test 0 0
     
  2. Run this command to remove all snapshots:

    vim-cmd vmsvc/snapshot.removeall VMID
** If you found this note/reply useful, please consider awarding points for "Correct" or "Helpful" ** Davoud Teimouri - https://www.teimouri.net - Twitter: @davoud_teimouri Facebook: https://www.facebook.com/teimouri.net/
0 Kudos