Note this article is not intended to be a comprehensive guide but a collection of notes on commands used to aid in migrating ESXi systems to Proxmox.
Table of Contents
Before you do anything make sure that you take a note of all configuration settings for each VM being migrated from ESXi; pay special attention to:
- Attached storage devices.
- Boot type: UEFI or Legacy.
- Network adaptor MAC addresses (if required).
Exporting VM images from ESXi
Exporting directly from ESXi
If you decided to export VM’s from ESXi directly using an external USB drive for example you will need to prepare the file system using vmkfstools:
- Create a GPT (GUID Partition Table) label on the specified disc:
partedUtil mklabel /vmfs/devices/disks/mpx.vmhba33:C0:T0:L0 gpt
- Retrieve the partition table information for the disc:
partedUtil getptbl /vmfs/devices/disks/mpx.vmhba33:C0:T0:L0
- Output from getptbl command indicates the disc geometry:
486397 255 63 7813969920 (Cylinders: 486397, Heads: 255, Sectors per track: 63, Total sectors: 7813969920)
- Perform a calculation to determine the last usable sector:
486397 * 255 * 63 - 1 = 7813967804
- Set a new partition table with one partition:
partedUtil setptbl /vmfs/devices/disks/mpx.vmhba33:C0:T0:L0 gpt "1 2048 7813967804 AA31E0AC01246547FE3425AD102221B8 0"
- Partition number: 1
- Start sector: 2048
- End sector: 7813967804
- Partition type GUID:
AA31E0AC01246547FE3425AD102221B8
(VMware VMFS partition) - Flags: 0 (none)
- Create a VMFS6 filesystem on the newly created partition:
vmkfstools -C vmfs6 -S vmi-backup /vmfs/devices/disks/mpx.vmhba33:C0\:T0\:L0:1
-C vmfs6
: Create a VMFS6 filesystem-S vmi-backup
: Set the volume label to “vmi-backup”/vmfs/devices/disks/mpx.vmhba33:C0\:T0\:L0:1
: The device path for the new partition
Short version
partedUtil mklabel /vmfs/devices/disks/mpx.vmhba33:C0:T0:L0 gpt
partedUtil getptbl /vmfs/devices/disks/mpx.vmhba33:C0:T0:L0
486397 255 63 7813969920
486397 * 255 * 63 - 1
7813967804
partedUtil setptbl /vmfs/devices/disks/mpx.vmhba33:C0:T0:L0 gpt "1 2048 7813967804 AA31E0AC01246547FE3425AD102221B8 0"
vmkfstools -C vmfs6 -S vmi-backup /vmfs/devices/disks/mpx.vmhba33:C0\:T0\:L0:1
Exporting using the ovftool
The ovftool is straight forward to use:
./ovftool --noSSLVerify "vi://<username>:<password>@<hostname>/<vm_name>" "/some/export/path/<vm_name>.ovf";
Below is a a very simple bash
script that uses an array containing VM names and iterates over them running the ovftool
to create an export at another location; update the username, password and host to utilise this script for your own exports:
#!/bin/bash
esx=""
esxuser=""
esxpass=""
declare -a arr=("VM Name 1" "VM Name 2" "VM Name 3")
for vm in "${arr[@]}"
do
echo "Exporting $vm..."
./ovftool --noSSLVerify "vi://$esxuser:$esxpass@$esx/$vm" "/some/export/path/$vm.ovf";
done
echo "Finished"
You may need libxcrypt
install it with:
# Fedora
sudo dnf install libxcrypt-compat
# Ubuntu
sudo apt install libxcrypt
Importing ovf images to Proxmox
If you exported VM’s using the ovftool
to an external devices you can use the followings notes to aid in importing them; note the mount point used is just an example customise to suit your needs.
Mount the external drive
For NTFS use
mkdir /mnt/ntfstemp
# Set the type to NTFS
mount -t ntfs /dev/sdg1 /mnt/ntfstemp
For EXT4 use
mkdir /mnt/exttemp
# No type needs to be defined
mount /dev/sdg1 /mnt/exttemp
Importing ovf images to Proxmox
# qm importovf <id> <iamge-name> <pool> -format raw
qm importovf 100 ./TEST01.ovf nebula -format raw
VMFS support
If you have used a external drive connected to the ESXi system and exported VM’s to the external drive. You may require VMFS tools :
# Install with
apt install vmfs6-tools
# Create a mount location
mkdir /mnt/vmfstemp
# Mount the drive to the location
vmfs6-fuse /dev/sdg1 /mnt/vmfstemp
Miscellaneous notes
Drives not detected under Proxmox
If during the configuration of a new server; the drives do not appear. It may be that you have used (or re-used) existing drives that may have a configuration already present on them.
Determine the drive/s that needs to be wiped use the following:
# Views connected devices
lsblk
# Using the drive identifier for example: /dev/sda
wipefs --all /dev/sda