tirsdag den 2. oktober 2012

Physical to Virtual linux

I had an Ubuntu linux server that I wanted to virtualize to an ESXi 4.1.
For some reason, the free p2v tool from vmware didn't work, so I decided to try something else.
I installed a virtual host on the target ESXi with a small disk and installed the minimal necessary to get an sshd up and running and then added an extra hard disk the size of the source host.
I created a user, temproot, on the destination host and changed the uid to 0, using vipw so the user had full root access.
I then booted up the source host on a live cd, and did the following on the source host:
dd if=/dev/sda bs=1m | ssh temproot@dst_host "dd of=/dev/sda"
After an hour or so for my 20GB disk, I powered off the source host and removed the small disk from the destination virtual host.
After booting up the destination host, I changed the automatically detected virtual network adapter so it would become eth0, and removed the old network adapter. This is controlled in /etc/udev/rules.d/70-persistent-net.rules. If you open up the file in vi or nano, it should be pretty clear what you need to do.

After this change, I booted the virtual destination host again, and now everything is running virtual.

Ingen kommentarer:

Send en kommentar