This Bash script facilitates the export of a Proxmox VE Virtual Machine (VM) to a single OVA (Open Virtual Appliance) file. The OVA file will contain an OVF (Open Virtualization Format) descriptor and VMDK (Virtual Machine Disk Format) versions of the VM's disks, suitable for import into other hypervisors like VMware vSphere, Workstation/Fusion, VirtualBox, etc.
This script is designed to be run directly on a Proxmox VE host with root privileges.
- Exports a specified Proxmox VE QEMU/KVM VM.
- Retrieves VM configuration directly from the Proxmox VE environment.
- Supports various Proxmox storage types for disk images (Directory, LVM, LVM-thin, ZFS, NFS, CIFS, RBD).
- Converts VM disks to
streamOptimizedVMDK format. - Generates an OVF 1.0 descriptor file with VM hardware specifications.
- Packages the OVF descriptor and VMDK disk(s) into a single
.ovaarchive. - Attempts to map Proxmox OS types and hardware to common OVF/VMware equivalents.
- Proxmox VE Host: The script must be run on the Proxmox VE host where the target VM resides.
- Root Access: Root privileges are required to access VM configurations, disk paths, and execute necessary commands.
- Required Packages: Ensure the following command-line utilities are installed on your Proxmox VE host:
qm: Proxmox VE VM management tool (standard).pvesh: Proxmox VE shell/API tool (standard).jq: Command-line JSON processor.- Install if missing:
apt update && apt install jq
- Install if missing:
qemu-img: QEMU disk image utility (usually standard withqemu-utils).- Install if missing:
apt update && apt install qemu-utils
- Install if missing:
tar: The GNU tar archiving utility (standard).sha256sum: For generating checksums (standard, part ofcoreutils).uuidgen: For generating unique IDs (standard, part ofuuid-runtime).bc: Basic command-line calculator (standard).stat: Display file or file system status (standard, part ofcoreutils).
- Sufficient Disk Space:
- Temporary Space: The script creates a temporary working directory (usually in
/tmp) to store converted VMDK files before packaging. This will require space roughly equivalent to the virtual size of all VM disks. - Output Space: The location for the final
.ovafile must have enough space to hold the packaged appliance.
- Temporary Space: The script creates a temporary working directory (usually in
- Download the
ovaexport.shscript to your Proxmox VE host. - Make it executable:
chmod +x ovaexport.sh
Execute the script as the root user or using sudo:
sudo ./ovaexport.sh <VMID> <output_ova_filepath>