VMware Cloud Community
jicheng_08
Contributor
Contributor

download vmx from vSphere Server

in my program,  i wang to automatic download  vmx file from vSphere Server  for  backuping, how to do it  ? I can get ns2__VirtualMachineConfigInfo from vSphere Server , but it is very difficulty to convert the  ns2__VirtualMachineConfigInfo to vmx file。pelease give me some advise, thanks

Reply
0 Kudos
9 Replies
jicheng_08
Contributor
Contributor

i want to download vmx file locally, for example, down vmx file from ESXi to loacl path /home/vmfoler/

Reply
0 Kudos
GPVenkatesh
Contributor
Contributor

Hi @jicheng_08

You can directly download the .vmx file from datastore browser using vsphere client (or) you can use tools like winscp to navigate to the VM folder path and copy it.

But why are you downloading the .vmx file, what is the reason behind it.

Thank you.

Reply
0 Kudos
jicheng_08
Contributor
Contributor

my program run like this:

1、the program use vSphere Web Services SDK to connect vsphere server.

2、 take snapshot form a vm , the vm will be bakcup.

3、in the server that my program running,  there has some *.vmdk files in the locally path;

4、the program use VDDK connet to the snapshot disks, and copy the snap shot  disk data to the locally disk vmdk file;

5、 delete the sanoshot;

when the vm in the vsphere server can not use, we should use nfs to mount the locally vmdk file to the vsphere server, but we dont have the vmx file to register the a new vm to the vsphere server.

the new  vm must have the same configure as the snapshot vm take before, and vm disk is the diskes we backup before.

Reply
0 Kudos
GPVenkatesh
Contributor
Contributor

Hi -

You may create new VM with same configuration and map the backup local .vmdk files to it. SvMotion after that will help you in bringing all the files (vmx, vmdk , nvram etc) in single folder with required name. But in this case, UUID and MAC will get change.

Thank you.

Reply
0 Kudos
jicheng_08
Contributor
Contributor

hi, GPVenkatesh, ​thank you very much for give me some advise.

but in this case, the vm in the vsphere sever is can not used or the vm is delete from the vsphere server, so the vm configuration can not kown.

we must record the vm configuration every bakcups.

Reply
0 Kudos
GPVenkatesh
Contributor
Contributor

hi @jicheng_08

Then you may consider using backup solution for your virtual infrastructure which will help you with image level, file level, application level backup and restore.

For example - Veeam Backup, Veritas Netbackup, VMware VDP etc.

https://www.vladan.fr/top-5-backup-software-vmware-infrastructure/

https://www.vladan.fr/top-5-backup-software-for-vmware-infrastructure-part-2/

Reply
0 Kudos
jicheng_08
Contributor
Contributor

i find vsphere server has provided http api to access vm file on vmfs. so i use http to download files

vSphere Documentation Center

Reply
0 Kudos
cyberpaul
Enthusiast
Enthusiast

Hi, I use the same approach - utilize curl to get / put files to a datastore via HTTPS. It's the simplest way imho. Don't forget to urlencode the path to deal with special characters.

Works both for vCenter and standalone ESXi.

BR, Pavel

Reply
0 Kudos
lambangdh
Contributor
Contributor

thank you so much

Reply
0 Kudos