VMware Cloud Community
shishaozheng
Enthusiast
Enthusiast

A question of vm snapshot in Esxi

Hi, all

I have created two virtual machines in Esxi named vm_001 and vm_002

the directory of them is:

/vmfs/volumes/datastore1/VM001               /vmfs/volumes/datastore1/VM002

                        |------vm_001.vmx                                    |------vm_002.vmx

                        |------vm_001.vmdk                                  |------vm_002.vmdk                                      

                        |------vm_001.vmsd                                  |------vm_002.vmsd

                        |------ ...                                                       |------ ...


specially, I mount the vm_002.vmdk disk to VM001,  then take a snapshot of VM001, after that,

if open the vm_001.vmsd, the content of this file is :


.encoding = "UTF-8"

snapshot.lastUID = "1"

snapshot.current = "1"

snapshot0.uid = "1"

snapshot0.filename = "VM-fnst-test-Snapshot1.vmsn"

snapshot0.displayName = "vm_001-snap"

snapshot0.createTimeHigh = "331165"

snapshot0.createTimeLow = "1181461572"

snapshot0.numDisks = "2"

snapshot0.disk0.fileName = "vm_001.vmdk"

snapshot0.disk0.node = "scsi0:0"

snapshot0.disk1.fileName = "/vmfs/volumes/datastore1/VM002/vm_002.vmdk "

snapshot0.disk1.node = "scsi0:1"

snapshot.numSnapshots = "1"

the red content show the path of two disks mounted to VM001

Now I must copy the file under /vmfs/volumes/datastore1/VM001 and /vmfs/volumes/datastore1/VM002 to a new directory, the new  directory looks like:

vmfs/volumes/datastore2/VM001               /vmfs/volumes/datastore2/VM002

                        |------vm_001.vmx                                    |------vm_002.vmx

                        |------vm_001.vmdk                                  |------vm_002.vmdk                                      

                        |------vm_001.vmsd                                  |------vm_002.vmsd

                        |------ ...                                                       |------ ...


after that, the question comes out:

the fist disk path of vm_001.vmsd is ok, but the second disk path of vm_001.vmsd is still "/vmfs/volumes/datastore1/VM002/vm_002.vmdk ", actually I want it to be the new path "/vmfs/volumes/datastore2/VM002/vm_002.vmdk ".

Of course, I can modify the vmsd file and make the value of "snapshot0.disk1.fileName" to the new disk path by myself,  but I want to know is there any official vmware cmd or API to change the disk path in vmsd file, or any official method to copy the vm with updating the disk path in vmsd file automatically?


Thank you very much

Tags (3)
Reply
0 Kudos
5 Replies
shishaozheng
Enthusiast
Enthusiast

who can help me please?

Reply
0 Kudos
a_p_
Leadership
Leadership

Cold Migration as well as Storage vMotion support VMs with snapshots (see VMware KB: Migrating virtual machines with snapshots), so I assume that the metadata will be modified if required. Btw. the paths are  not only stored in the .vmsd file, but also in the .vmsn file.

André

Reply
0 Kudos
shishaozheng
Enthusiast
Enthusiast

Thank you for reply, I know cold migration, but for some reason, I must copy the vm physically. Under this situation, is there any official method to update the path in related .vmsd and .vmsn files?

Reply
0 Kudos
a_p_
Leadership
Leadership

Unfortunately none that I'm aware of.

André

Reply
0 Kudos
shishaozheng
Enthusiast
Enthusiast

I see. Thanks anyway

Reply
0 Kudos