Skip to content

Server notes

How to convert your real system to a virtual machine

A whole disk image plus VirtualBox converts an old server into a test machine you can keep after the hardware is gone.

By Jozsef 2 min read

I had a real Linux server that I needed to turn into a virtual server. I wanted to sell the old hardware but keep the system as a backup that could still run. VirtualBox is the free open source virtual computer from Oracle, and it handled the job.

1. Back up the system disk

If possible, move the system disk to another computer. If that is not an option, work from the original system.

Back up the whole disk, not just a partition:

bash
cd /the/path/of/your/backup
cat /dev/sda > ./sda.backup

This creates a raw image of the disk in the backup folder.

2. Convert the image to a virtual disk

bash
VBoxManage convertfromraw ./sda.backup sda.vdi --format vdi

3. Create the virtual machine

  1. Download, install, and start VirtualBox.
  2. Create a new machine.
  3. At the virtual hard disk step, choose Use an existing virtual hard disk file.
  4. Select sda.vdi.

Boot the machine and check the network adapter. The old system may still expect the hardware it was installed on, so keep a console open for the first boot.

Sources and further reading