7

The situation is; I am running a web server (Ubuntu 10.10 server) on virtualbox v.4 inside Ubuntu 10.10 Desktop and now I want to clone entire web server on my brand new PC. Please help me with this, how do I do it?

Thanks!


I found a possible solution here: http://www.turnkeylinux.org/blog/convert-vm-iso

2
  • You mean virtual to physical (V2P)?
    – hookenz
    Apr 20, 2011 at 10:38
  • Yes, something like that but even easer way like creating bootable DVD of Virtual OS, something like recovery DVD..
    – Himalay
    Apr 20, 2011 at 11:41

2 Answers 2

1

Using converttoraw feature of virtual box and DD.

See: http://techokarma.blogspot.com/2008/10/v2p-virtual-to-physical-for-virtualbox.html

This assumes you have a reasonable knowledge of linux.

2
  • 1
    thanks for the reply. Yes, v2p may work if I copy raw into a attached HDD. But what if I need to clone into a new laptop which has no OS installed? Do you think will it work if I copy raw into a USB pendrive then attach with new laptop and boot from Live-CD then do dd??
    – Himalay
    Apr 20, 2011 at 11:36
  • @Himalay, Not sure about that.
    – hookenz
    Apr 20, 2011 at 22:17
6

Quick trick to copy over a network: use linux netcat (nc). Using this method you do not have to convert to a raw image as dd will copy literally everything from the source drive.

Use your choice of linux live discs to boot both the physical machine and virtual machine, make sure both have network access and write down the IP addresses of both. Switch to root (sudo su). Find out what your drive paths are using fdisk -l

On the destination machine:

nc -l 10000 | dd of=/dev/sda bs=64

Command syntax:

nc -l <port#> | dd of=<destination drive> bs=<size in bytes>

Block size (bs) can be whatever you want, I try to keep it fairly small.

On the source virtual machine:

dd if=/dev/sda bs=64 | nc 192.168.0.100 10000

Command Syntax:

dd if=<source drive> bs=<size in bytes> | nc <destination ip> <destination port#>

Block size (bs) at the source and destination must match. I always set the destination machine up to reduce sending errors. There is no progress bar, just wait for the bash prompt to return and you are good to go. Remove the live discs and reboot.

1
  • 1
    You can actually get the progress of dd by running kill -USR1 $PIDOfDD or watching the transfer over time by running watch -n 10 kill -USR1 $PIDOfDD link Jan 24, 2015 at 13:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .