Friday, December 19, 2014

VMware ESXi (Free Hypervisor) : VM Backup and Restore


In order to backup the VMs via free ESXi product (without any third party software), we can export the VM in .OVF (Open VirtualMachine File) or .OVA (Open VirtualMachine Appliance) format. As a result, we will have the complete VM with less disk space also can be imported to VMWare ESXi or VM Player or VM Workstation any time.


Export the VM(s):-


1. You need to select the VM to be exported from inventory then select menu “File”->”Export”->”Export OVF Template…”
(To export any VM in .OVF/.OVA format, it should be turned off else you will see menu “Export OVF Template…” grayed out)




2. Enter the “Directory” location where the exported virtual machine template is saved, or click “...” to browse for the location.


3. In the “Format” field, determine how you want to store the files. For our backup requirement you can use any format as final disk size remains same. 
- Select “Folder of files (OVF)” to store OVF template as a set of files (.ovf,.vmdk,and .mf)
- Select “Single file (OVA)” to package the OVF template into a single .ova file.This might be convenient to distribute the OVF package as a single file if it needs to be explicitly downloaded from a web site or moved around using a USB drives.

4. Select the checkbox, if you want to include image files attached to floppy and CD/DVD devices in the OVF package. Please clear this checkbox, as we do not want any attached iso file to be backed up that attached to VM else OVF/OVA file size will get increased unnecessarily. (This checkbox is shown only if the virtual machine is connected to an ISO file or if the floppy drive is connected to a floppy image.) “Folder of files (OVF)” to store the OVF template as a set of files (.ovf, .vmdk, and .mf) “Single file (OVA)” to package the OVF template into a single .ova file.


 Import the VM(s):-
 
1. Select Menu “File”->”Deploy OVF Template…”


2. Browse the .OVF/.OVA file path.
3. Click on “Next” button.
4. If you want you can change the name of VM appears under ESXi inventory while on “Name   

    and Location” page
5. Change the “Disk Format” from default “Thick Provision Lazy Zeroed” to “Thin Provision” just to save disk space on Datastore else you can keep it as it is means

“Thick Provision Lazy Zeroed”


6. Finally, click on “Next” then “Finish” button.

**** You may receive below error while deploying the OVF file. ****




Workaround:
 
1. If you have exported VM in “Single file(OVA)” format, Open .ova file with WinRAR or 7Zip   

    program.
2. Delete the .mf file.
3. With a text editor like Notepad open the .ovf file. Search for the following:
    <rasd:ResourceSubType>vmware.cdrom.iso</rasd:ResourceSubType>


    Once located change it to :
    <rasd:ResourceSubType>vmware.cdrom.atapi</rasd:ResourceSubType>


4. If you have exported the VM in “Folder of Files(OVF)” format then repeat the step 2 and 3.
5. Import the VM via Menu “File”->”Deploy OVF Template…”