Reputation: 11
How can I use the command line to change the display name of a VMware snapshot, or to move one snapshot to another one? The vim-cmd utility has the following subcommands under vmsvc/, but they don't seem to be able to do this.
snapshot.create
snapshot.dumpoption
snapshot.get
snapshot.remove
snapshot.removeall
snapshot.revert
snapshot.setoption
Using the GUI, I am edit the name. What command or combination of commands can I use to achieve this on the command line?
Upvotes: 1
Views: 1170
Reputation: 85883
The vim-cmd …
commands don't support this directly, but you can you can perform this task by editing the .vmsd file associated with the VM. For instance, on a server:
# ls -1 /vmfs/volumes/Datastore/Debian7Generic/*[x,d]
/vmfs/volumes/Datastore/Debian7Generic/Debian7Generic.vmsd
/vmfs/volumes/Datastore/Debian7Generic/Debian7Generic.vmx
The .vmx file is the main configuration; the .vmsd file describes the snapshots. The latter has content like:
.encoding = "UTF-8"
snapshot.lastUID = "19"
snapshot.current = "12"
snapshot0.uid = "1"
snapshot0.filename = "Debian7Generic-Snapshot1.vmsn"
snapshot0.displayName = "Fresh Install"
snapshot0.type = "1"
snapshot0.createTimeHigh = "331196"
snapshot0.createTimeLow = "1387465219"
snapshot0.numDisks = "1"
snapshot0.disk0.fileName = "Debian7Generic.vmdk"
snapshot0.disk0.node = "scsi0:0"
snapshot1.uid = "7"
snapshot1.filename = "Debian7Generic-Snapshot7.vmsn"
snapshot1.parent = "1"
snapshot1.displayName = "Fresh A"
snapshot1.type = "1"
snapshot1.createTimeHigh = "331234"
snapshot1.createTimeLow = "1435772305"
snapshot1.numDisks = "1"
snapshot1.disk0.fileName = "Debian7Generic-000001.vmdk"
snapshot1.disk0.node = "scsi0:0"
…
It's not a beautiful way to do it, but you can rename the snapshot by using a text editor to edit that file, or for a more automated approach, using sed. E.g., you could do:
# sed -i -e 's|snapshot0.displayName = .*|snapshot0.displayName = "A different name"|' Debian7Generic.vmsd
.encoding = "UTF-8"
snapshot.lastUID = "19"
snapshot.current = "12"
snapshot0.uid = "1"
snapshot0.filename = "Debian7Generic-Snapshot1.vmsn"
snapshot0.displayName = "A different name"
snapshot0.type = "1"
snapshot0.createTimeHigh = "331196"
snapshot0.createTimeLow = "1387465219"
snapshot0.numDisks = "1"
snapshot0.disk0.fileName = "Debian7Generic.vmdk"
snapshot0.disk0.node = "scsi0:0"
snapshot1.uid = "7"
snapshot1.filename = "Debian7Generic-Snapshot7.vmsn"
…
Upvotes: 1