Convert a Running Linux box to VMware over the Internet

2 minute read

Published:

I wanted to backup a dedicated server I didn’t have physical access to as it is hosted for me in a different state. There was a twist though - I wanted to back it up to a VMware image. There are tools to do this for Windows systems (i.e. VMware vCenter Converter which have worked great for me in the past, however my machine was Linux.

I found a few ways this could be done, but they required shutting down the system and booting from a live cd. This was not possible for me (without a support ticket anyways) so I kept searching. I couldn’t find anything that seemed like it would work for me, so I muddled through and came up with my own experiment:

bzip2 -c /dev/hda | ssh username@remotemachine "bzip2 -d | dd of=hda.vdmk"

This command compresses and decompresses the contents of the hard disk over the internet and across ssh to a disk image in my home directory on a remote machine. You can then use Live View to convert the disk image to a VMware image. Live View is a powerful and scary tool I suggest you check out as it does much more than this alone.

It worked. I thought it would, but I wasn’t sure what would happen. Technically the more idle the file system the more likely this is to work and the more volatile it is the more trouble you will have. I would recommend shutting down all processes not required during the backup as I had a number of file system errors that were corrected on start up. I’m sure log files were changing and other normal activity was happening on the real disk during the hours of copying. As this was just an initial experiment everything was left running.

The only caveat I had to deal with was fixing my network cards as eth0 was still looking for the physical card and not the VMware virtual card. I’ve had this issue in the past after swapping real network cards, so this is not a limitation of the conversion process at all.

Also note that dd does a bit for bit copy, so I transferred 40gb of data that day (albeit compressed). That is one area this process could be improved. If I had a second disk I could have created and compressed the image before transferring. This would also lower the number of file system errors as it would take less time to create and less would change.

Hope this helps someone else out there!

As an Amazon Associate I earn from qualifying purchases.