0

P2V: Converting Ubuntu Machine to Virtual Machine

In this post, I will discuss on how I convert or migrate an Ubuntu Machine (Physical) into a Virtual Machine in ESXi or vSphere 6/vSphere 6.5.

First we need to have a Windows Machine within the Management Network of Ubuntu and vSphere. In this windows machine, we need to install the VMWare vCenter Converter (discussed in a previous post) and this converter tool will connect to our Ubuntu Machine via SSH Protocol.

List of Requirements:

  • SSH Service installed and running in Ubuntu Machine (Guide)
  • SSH Service has been allowed to your OS’ firewall (ufw/firewalld) in Ubuntu MachineĀ  (Guide)
  • Admin Account of Ubuntu Machine
  • VMWare vCenter Converter installed in Windows Machine (Guide)
  • Atleast 1Gbps Network Connectivity in Ubuntu Machine-Windows Machine-ESXi
    (100Mbps would be fine but it will be 10x slower on transfer speed)
  • Ubuntu Machine, Windows Machine and ESXi/vSphere must be on the same network/subnet to avoid network firewall restriction if exists.
  • Patience šŸ™‚ Actual migration/conversion cannot be computed the time you need to wait, it is NOT computed like this: if you have 100Gb of Hard Disk on your Ubuntu Machine, and 1Gbps (128Mb/sec) connection then (100GB converted to Mb) 102400Mb /128Mb = 800 Seconds or 13minutes 20seconds. its not like that! Many people always think of this. Copying might be slower or faster on many factors (Type of disks, Block type, Connection).

Quick testing if Ubuntu Machine is accessible from Windows Machine:

Instructions

Step 1: Open the VMWare vCenter Converter on Windows Machine:

Step 2: Click the “Convert Machine

Step 3: From “Select Source Type” choose “Remote Linux Machine“, then Provide details for IP Address or Hostname, Username, Password or Keyfile.

Step 4: Click “Yes” to continue on the Converter Security Warning prompt.

If you encounter this problem: “Unable to query the Live Linux source machine. Make sure you can run sudo without entering password when logged in to the source machine over SSH as ‘username’” then we need to follow the KB1008164 from VMWare:

Step 4.1: Go to %ALLUSERSPROFILE%\Application Data\VMware\VMware vCenter Converter Standalone\

Step 4.2: Open the converter-worker.xml file in a text editor and change the useSudo flag from false to true.

Step 4.3: Restart the Converter Standalone Worker & Agent, open the Services section in the Microsoft Management Console, find the VMware Converter Standalone Worker & Agent service and restart.

Step 4.4: Log-in to your Ubuntu machine, edit the /etc/sudoers file with vim or nano and append the following: username ALL=(ALL) NOPASSWD: ALL

Step 4.5: Go back Converter tool then retry again.

Step 5: Enter details for Destination VMWare Infrastructure server details,could be your ESXi or vCenter Machine if ESXi is currently managed by it, Click ‘Next‘ to proceed.


Step 6:
Click ‘Ignore‘ to proceed on Security Warning prompt.

Step 7: Enter the destination Virtual Machine Name, then click ‘Next‘ to proceed.


Step 8:
Choose for destination host (if using vCenter)Ā and Datastore, click ‘Next‘ to proceed.


Step 9:
You have option to modify other settings like change the vCPU, RAM, storage, etc. The most important in this portion is the Helper VM network, if you don’t have DHCP on your network then you need to assign Static IP Address on it, since this Helper VM will connect to your Source Machine.


Step 10:
Summary details shown, if you want to change any setting you can go Back or click ‘Finish‘ to start the conversion/migration.

Check for the Conversion/Migration task:

Go to your vSphere/ESXi UI then check if the virtual machine is created and powered on.

Check the Console of virtual machine, should similar to this, don’t mind for the prompt on converter login, Everything should have OK on the console.

Check again on your Conversion/Migration task, the actual time for migration might be longer or faster depends on many factors discussed above:

Finished Migration:

 

Try to power-on the virtual machine and check the console:

 

Summary:

  • Source Ubuntu Machine, Windows Machine and vSphere/ESXi management should be on the same subnet/network or they must be able to communicate on each other, and all firewall rules must be allowed if they were in different LAN Segment.
  • You must observe if there is DHCP on the network or else your Helper VM must need to have an static IP discussed on Step #9.
  • Actual conversion/migration time depends on many factors: Disk type, block size, connection, etc…
  • Virtual Machine may not work properly on first boot up, you might need to install drivers or install the VMware Tools to resolve most of the issues like console output, mouse, keyboard mapping, etc…
  • User can also use vCenter as destination infrastructure on Step 5.
  • The oldest Ubuntu version that is compatible with ESXi or vSphere was Ubuntu 10.04.
  • Thanks to Wee Kiong Tan of VMWare vExport FB Group.
Kevin San Jose, VCP6-DCV

Kevin San Jose, VCP6-DCV

MTCNA, VCP6-DCV, CSS NCII, EIM NCII

Leave a Reply

Your email address will not be published. Required fields are marked *