Skip to content

Instantly share code, notes, and snippets.

@john-clark
Created September 4, 2022 06:07
Show Gist options
  • Save john-clark/01cefd0e47278d9607a398c67a23b88c to your computer and use it in GitHub Desktop.
Save john-clark/01cefd0e47278d9607a398c67a23b88c to your computer and use it in GitHub Desktop.
import esxi to proxmox
#!/bin/bash
# mount the esxi disk
# $ apt-get install vmfs-tools
# $ fdisk -l
# $ vmfs-fuse /dev/sdb1 /mnt/v
#
# convert error might need path something like this
# $ mount --bind /mnt/v /vmfs/volumes/56d37ecd-79274a3c-0d37-90b11c9a3f7f
RED='\033[0;31m'
NC='\033[0m' # No Color
VMID=$(pvesh get /cluster/nextid)
# convert vmx to ova
echo -e "${RED}ovftool /mnt/v/$1/$1.vmx /mnt/pve/local-dir/ova/$1.ova${NC}\n"
ovftool /mnt/v/$1/$1.vmx /mnt/pve/local-dir/ova/$1.ova
# extract ova to ovf
echo -e "${RED}tar xvf /mnt/pve/local-dir/ova/$1.ova${NC}\n"
tar xvf /mnt/pve/local-dir/ova/$1.ova -C /mnt/pve/local-dir/ova
# import ovf
echo -e "${RED}qm importovf ${VMID} /mnt/pve/local-dir/ova/$1.ovf local-dir --format qcow2${NC}\n"
qm importovf ${VMID} /mnt/pve/local-dir/ova/$1.ovf local-dir --format qcow2
# now you probably need to edit the hardware on the proxmox vm to make it work
# you may need to add the right controller with some recovery tool to get it to boot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment