Migrate virtual machines to Proxmox

Introduction

If you wish to move virtual machines from VMware, other hypervisors or download readymade virtual machines. Importing them into Proxmox is quick and easy and with minimal hassle.

In this guide I will be using a VM downloaded from Bitnami which have loads of virtual machines that can be downloaded for free. Personally, I like to set everything up myself but for quickly test something this is perfect!

Head over to https://bitnami.com/stacks/virtual-machine if you wish to check out their assortment of virtual machines. Their virtual machines configured with different applications you can quickly get up and running.

Video

Transfer the VM

I will use SCP which is a terminal command that can be used in Windows, Linux and Mac to transfer files over the network. SCP stands for Secure Copy Protocol and use port 22 which is the same as SSH.

Start by opening a terminal window and changing the directory to where the file you wish to transfer is located. This is done with cd Downloads for example.

Then run a command like the one bellow.

1scp .\migrating-vm.ova root@192.168.200.45:/tmp

Command breakdown:

  • scp: This is in the command to actually run the scp program.
  • .\: This means you wish to find a file or folder in the directory you are currently in. For Windows it is a backslash while it is a slash for Linux
  • bitnami-vm.ova: The file you wish to transfer to Proxmox.
  • root: The username you wish to use to log into Proxmox with. Unless you have made more users, root is the default for Proxmox.
  • @: Just means you wish to use the previously typed username to log into the server IP to come.
  • 192.168.200.45: This is the IP address for my Proxmox node. Yours will probably be different.
  • :: The colon is there to indicate that you wish to add another argument. Often used for a port number, but in this case for a folder on the server.
  • /tmp: The folder you wish to transfer the file to. Here the temp folder is selected which is located in the root directory of Proxmox.

Hopefully transferred

You have hopefully transferred the file successfully. If not, an issue might be that you have spaces in the name of either the file or a folder.

To counter errors with spaces ' can be used. For example, if I have a file named bitnami vm.ova I would type it as 'bitnami vm.ova' the command would then look like the one bellow.

1scp '.\migrating vm.ova' root@192.168.200.45:/tmp

Import the VM

What you have to do to import a VM is different depending on what you have to work with.

The OVA File will usually include everything you will need to get a VM up and running. From how the VM is configured to the virtual hard drive.

If you only have the virtual hard disk, you will first have to create a VM in Proxmox without assigning a disk to it. You can then convert and assign your hard disk to the VM.

You can either use the shell in the Proxmox UI or use SSH to the Proxmox node. To connect to Proxmox using SSH you can use the command below changing the details to fit your details.

1ssh root@192.168.200.45

Breakdown:

  • ssh: Secure shell is a way to connect to the shell of a remote machine to run commands on it.
  • root: The username you wish to use to log into Proxmox with. Unless you have made more users, root is the default for Proxmox.
  • @: Just means you wish to use the previously typed username to log into the server IP to come.
  • 192.168.200.45: This is the IP address for my Proxmox node. Yours will probably be different.

OVA

Before you can import the VM, you will have to extract the contents of the OVA file. To do this you can run the command

1tar xvf migrating-vm.ova

Breakdown:

  • tar: This is the command to start the extraction program.
  • xvf: Using this tells the program you wish to copy the files from the compressed folder and paste it in the same directory.
  • migrating-vm.ova: This is the compressed directory to extract files from.

When that is done you can run a variant of the command below to import the VM into Proxmox.

1qm importovf 105 ./migrating-vm.ovf local-lvm

Breakdown:

  • qm: This is the program that Proxmox uses for virtualization.
  • importovf: This makes sure the VM is imported using the hardware specifications in the ovf file.
  • 105: Here you can set the number you want the VM to be assigned. Make sure it's not already in use.
  • ./: This means you wish to find a file or folder in the directory you are currently in. For Linux it is a slash while it is a backslash for Windows.
  • /migrating-vm.ovf: This is the File that contains all the hardware information and which virtual disk to use.
  • local-lvm: This a hard disk on Proxmox and can be changed if you wish to use another disk.

The time this will take depends on the size of the VM and power of your machine. When done, you should be able to start using the VM.

Virtual Hard Disk

Before converting and importing a virtual disk you will have to create the VM in Proxmox. This can be done the regular way in the WEB UI. When you come to the step configuring a disk, you can completely remove it by clicking the trash bin

With qm you are able to convert from most types of virtual hard disk into qcow2 which is what Proxmox use.

Change the command below into something that suits you and run it.

1qm importdisk 103 ./migrating-vm.vmdk local-lvm -f qcow2
  • qm: This is the program that Proxmox uses for virtualization.
  • importdisk: Indicates that you wish to import a disk file of some sort.
  • 103: This is the ID number of the VM you wish to import the disk to.
  • ./: This means you wish to find a file or folder in the directory you are currently in. For Linux it is a slash while it is a backslash for Windows.
  • migrating-vm.vmdk: The virtual disk you wish to convert.
  • local-lvm: This a hard disk on Proxmox and can be changed if you wish to use another disk.
  • -f: This option is set to indicate that you wish to change the format of the file to import.
  • qcow2: Finally, what format you wish the disk to be turned into.

After the disk have been imported, you will have to enable the disk before starting the VM.

  1. Select your VM.
  2. Click Hardware.
  3. Mark the disk that is unused.
  4. Click edit.
  5. Then press Add.

To enable the disk as a boot disk, you will have to edit the options.

  1. Navigate to Options.
  2. Select Boot Order.
  3. Click Edit.
  4. Here you can remove the check marks on both ide2 and net0. Then check the box next to scsi0.
  5. Press OK.

You can now start the VM, and it should hopefully start without issue.

Done

With this you should be able to import virtual machines into Proxmox. To find the information I used here I looked mostly at the Proxmox wiki but hopefully added some useful information.

Proxmox wiki: https://pve.proxmox.com/wiki/Migration_of_servers_to_Proxmox_VE