I have a little Dell server for home lab running ESXi and 5 VM (Windows server, Windows 10, Ubuntu, etc.)
Sometime I need to backup VM, usually when I perform changes, and usually I export the VM to OVF format.For my purpose it is enough.
Unfortunately one of the VM has a BIG raw device disk that is saved by its own and if I export to OVF it tries also to export the raw disk and I do not want to do it (not enough free TByte).
is there any way to avoid the raw disk to be also exported to the OVF?
what are the files I should manually copy to ensure the backup?
For your needs: just a handful of VMs that you backup every now and then I would recommend to steal the basic idea of the OVA/OVF approach.
That means to also create a tar-archive and use gzip or bzip to compress it.
The OVF-tool uses this single steps:
- read the current vmx-file and figure out which vmdks need to be included
- for each vmdk in the list it then runs a command that is almost the same as this one:
vmkfstools -i current-vmdk1.vmdkname1.vmdk -d monosparse
vmkfstools -i current-vmdk2.vmdk name2.vmdk -d monosparse
NOTE: vmkfstools does not include a parameter to create the streamOptimized vmdk-format that is used with OVF/OVA packages
the type "monosparse" is very similar - main difference: the descriptorfile is not embedded like it is with type streamOptimized
- next OVF-tool creates an oversimplified copy of the vmx-files and store it in an xml-format
- finally OVFtool collects all files in a new directory and compressed that directory in a tar.gz format
You can do the same steps - and skip the oversimplifying of the vmx-file while only including the vmdks you really need or want.
So you would power off your VM.
Next create a new empty dir to collect the required files - lets assume this is called backup-dir
Then run vmkfstools -i against all vmdks you want to backup.
vmkfstools -i active-vm-dir/name.vmdk backup-dir/name.vmdk -d monosparse
Next run a copy command like this:
cp active-vm-dir/*.vmx .vmx backup-dir/
cp active-vm-dir/*.nvram .vmx backup-dir/
cp active-vm-dir/*.log .vmx backup-dir/
Next create a textfile that has any info that you may want to include - like patch-state of the VM, admin password ... what ever - call this readme.txt
Finally backup-dir should have files like this:
- name-s001.vmdk + name.vmdk
- at least one log-file
- iso-files and floppy-images (optional)
Then last part of the job is to create an archive - gzip or bzip - that has the complete content of the backup-dir.
When that is done your backup is ready and you download the new archive and store it in a nice cozy location.
This approach can be easily scripted so that you can later run a sh-script named "backup-VMname.sh
This basically does the same as the OVF/OVA export - while it avoids all the obscure steps (oversimplifying vmx, include vmdks you dont need ...
The resulting backups can be used in Workstation and hosted platforms and can also be easily restored to ESXi.
If you use esxi 5 or 6 you can create backups while the VM is running - the usual caveats apply as always ....
Yes - looks ugly - and requires some thought while creating the scripts - but the approach is solid - chances that you cant restore your backups because OVF-import function is in a bad mood is zero and you have full control.of the results
If anybody knows how to create real streamlineOptimized vmdks with vmkfstools - please post the exact parameter and tell us for which esxi-version the parameter works.
when restoring backups you may want to skip the conversion of the "monosparse" format back to regular "vmfs" format.
This will indeed really work - but the "monosparse" format will prevent future snapshot-operations - so normally you would not skip the vmkfstools -i backup.vmdk native-esxi.vmdk -d thin during a backup-restore.
Many thanks for your prompt feedback.
What about if I simply:
1) shut down the VM
2) using the datastore explorer in the WEB GUI, copy and download the folder containing all the VM files (vmdk, vmx, log, etc.)
3) store for backup purpose