3

I have an Ubuntu Server 10.04 VPS (Virtual Private Server) that hosts my website. I would like to clone this VPS and create a VirtualBox machine from it. How can I do this?

Sergio
  • 367

2 Answers2

1

I think you want to look at the command VBoxManage convertfromraw or VBoxManage clonehd. I can't remember exactly how to do it, but I found these two guides: http://www.virtualbox.org/wiki/Migrate_Windows and http://www.pendrivelinux.com/boot-a-usb-flash-drive-in-virtualbox/.

Once you have the hard drive converted, you can just create a new Virtual Machine, but use your existing disk image you just created.

penguin359
  • 12,077
  • I realize that the first document is about migrating Windows, but near the end, they show a command to convert a device file on Linux to a VDI. – penguin359 Apr 20 '11 at 19:43
1

If you want to migrate the whole installation byte-for-byte, in essence making a copy of the disk: read penguin359's answer, or see Moving linux install to a new computer.

If you just want to reproduce the settings of an existing installation: install a basic system from scratch, then run aptitude-create-state-bundle on the VPS to export your package selection and APT settings, and run aptitude-run-state-bundle to import these settings into the VirtualBox installation (and in particular get the same set of packages installed). Then migrate your customizations: /etc (where you'll have to change a few files), /home, and /var/www or wherever you keep your web server data. See also How do I migrate configuration between computers with different hardware?. See also a step-by-step cloning guide, which addresses what files you'll most likely need to change in /etc.