Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
I think the best way is creating a raw image of your server and convert it to VBox hard drive with VBoxManage convertfromraw –  amotzg Jul 23 '12 at 8:42
    
Does clonezilla makes raw image? –  Kristian Jul 23 '12 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 Jul 23 '12 at 8:44
    
You can use dd to make a drive image, see howtogeek.com/howto/19446/… –  amotzg Jul 23 '12 at 8:52

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
It is still worth trying :) But i'm afraid your'e right. –  Kristian Jul 23 '12 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 Jul 23 '12 at 8:48
  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.

share|improve this answer
    
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 Jul 23 '12 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 Jul 23 '12 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 Jul 23 '12 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 Jul 23 '12 at 8:44
    
Okay, thanks mate! –  Kristian Jul 23 '12 at 8:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.