4

We have a private server set up by a stranger.

Now I'd like to make a server with exact same configuration and software (for localhost virtual machine - VirtualBox).

Is there any simple way to accomplish this, e.g. copy-paste?

By the way, the server is running Ubuntu 10.04.2 LTS, and cannot be accessed physically (it belongs to the hosting provider), but I do have SSH access to it.

4
  • I think the best way is creating a raw image of your server and convert it to VBox hard drive with VBoxManage convertfromraw
    – amotzg
    Commented Jul 23, 2012 at 8:42
  • Does clonezilla makes raw image?
    – Kristian
    Commented Jul 23, 2012 at 8:44
  • 1
    Just read that you don't have direct access to the server. I would have consider installing a new Ubuntu machine with the desired software and only copy the home direction with data and settings
    – amotzg
    Commented Jul 23, 2012 at 8:44
  • You can use dd to make a drive image, see howtogeek.com/howto/19446/…
    – amotzg
    Commented Jul 23, 2012 at 8:52

3 Answers 3

4

There's another approach you could use:

  1. create a new VM, and install the exact same Ubuntu version into it. Use the alternate CD to install from, and create a minimal install.
  2. login to your remote server, and execute dpkg --get-selections \* > /tmp/serverpkgs.lst.
  3. transfer /tmp/serverpkgs.lst to your new created VM
  4. on your new VM, execute sudo dpkg --set-selections < /tmp/serverpkgs.lst
  5. still on the VM, execute sudo apt-get dselect-upgrade

Now you should have duplicated the installed software -- which leaves you with its configuration. This might prove the more tricky part: as I don't know what is used, there's no "global answer" to that. Generally, configuration files are stored below /etc, so you might want to cd / && sudo tar czf /tmp/server-cfg.tar.gz etc/*, then transfer /tmp/server-cfg.tar.gz to your VM, unpack it to some temporary directory (using e.g. cd /tmp && tar xzf server-cfg.tar.gz, which would create /tmp/etc/*), and check carefully which config files to copy over to your /etc tree.

2

Directly coping between two different hardware platforms is theoretically possible (all you have to do is copy the files and install the bootloader) but rarely a good idea. I've done it successfully on several occasions, but I've also done it quit unsuccessfully on many more.

The problem is that when you install the OS, certain optimizations and other decisions are sometimes made based on the type of hardware you're installing to. If you duplicate to exactly the same hardware, then no problem. If you duplicated to very different hardware, then perhaps you will have a problem. Going from a physical machine to a virtual machine is probably an example of "different hardware". It may or may not work. Most likely, it won't work initially, but if you really, really know what you're doing then you can tweak things around till it does work.

But if you did really really know what you were doing, then you probably wouldn't have asked if it was possible. So, by that logic, the answer then is probably no.

But if you're persistent enough, you might be able to turn it into a yes. What you're trying to do is often shortened as "physical to virtual" or "P2V" for short (or even shorter). There's no shortage of opinion on the subject and lots and lots of people giving conflicting instructions on how to do it. So for further information, I'll defer to the mighty Google.

2
  • It is still worth trying :) But i'm afraid your'e right.
    – Kristian
    Commented Jul 23, 2012 at 8:42
  • 1
    @Kristian updated with some a bit of helpfulness, hopefulness, and good cheer. If you're bored, it's certainly worth a shot.
    – tylerl
    Commented Jul 23, 2012 at 8:48
0
  1. You can use clone/image for the servers' hardisks. Perhaps using clonezilla will be helpful (http://clonezilla.org/)

  2. If you are running the server on VirtualBox you can simply import/export the server. (I wasn't sure from your question)

There is no copy-paste solution for creating new server from scratch except imaging.

4
  • I'd like to copy from physical server to virtualbox. Okay, but does copying hard disk cause problems with drivers or should it work nice?
    – Kristian
    Commented Jul 23, 2012 at 8:34
  • If your hardware is different (and when using VirtualBox it does), then the drivers will need to be different on the new machine. I think Linux should be able to solve the new drivers issue by itself, but it might get you into trouble.
    – mrdvlpr
    Commented Jul 23, 2012 at 8:37
  • And can i use clonezilla over network(ssh?). I cannot access physical server myself(property of service provider), but i have ssh acces to it.
    – Kristian
    Commented Jul 23, 2012 at 8:37
  • You can use 'dd' command to copy the raw data of your harddisk and pass it through SSH network. It will take forever and seems useless.
    – mrdvlpr
    Commented Jul 23, 2012 at 8:44

You must log in to answer this question.

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