Clone Ubuntu Server to new location

Imagine you have to move your server to another provider. It is a time-consuming task to set up a new server, install all the applications, databases, and so on… and then configure it all the same way as before.

Of course you would copy a lot of that from the old to the new server. You could even make an image from the old server and copy it to the new. But wait, is it that simple though? Well, considering a few things it isn’t all that hard. I didn’t fetch an image, but made a backup from the old server using rdiff-backup. Then I set up my new server with the same OS as the old server (Ubuntu 14.04). Then I would adapt a few things to the configs of the backup and play the backup back into the new server. Voilà.

Remote Password-less Root Access

At first you need remote root access. For this to work you usually have to modify your ssh daemon config found at /etc/ssh/sshd_config

If you can access your remote server with ssh root@<your server> you’re good to go.


Install rdiff-backup on both machines (server and your local machine).

sudo apt-get install rdiff-backup

Then we backup our remote server. Create a directory where you can put the backup and ensure you have enough space left. Run this as the root user:

rdiff-backup --exclude '/tmp/*' --exclude '/proc/*' --exclude '/sys/*' --exclude '/media/*/*' <your server>::/ <your local backup folder>

Now we have a backup of our server.

Preparing the new server

You probably have some kind of control panel. Install the same OS as you had on the old server.

We then again need remote root access to the new server.


On your local machine as root user:

rdiff-backup --force -r now --exclude '/boot' --exclude '/dev' --exclude '/tmp' --exclude '/proc' --exclude '/sys' --exclude '/media' --exclude '/etc' <your local backup folder> <your new server>::/

You can see I excluded the etc directory to not overwrite some important configuration files that need to stay the same on the new server.

On your new server make a new temporary directory anywhere. From your local machine as root we now copy the old configuration files to the temporary directory. I use rsync for this:

rsync -av /etc <your new server>:<your tmp folder>

Then go back to the shell of your new server and copy the file system and network configuration back into the configuration from your old server.
cp -a /etc/network <tmp-folder>/etc/ # network configuration
cp -a /etc/fstab <tmp-folder>/etc/ # file system table
cp -a /etc/resolvconf <tmp-folder>/etc/ # nameserver information

Finally overwrite the etc folder from your new server:

cp -a <tmp-folder>/etc /

Everything should be up and running by now.

Flattr this!

SpiderOak upload never finishes

If you encounter problems with your SpiderOak installation never finishing (on Ubuntu 14.04) with the upload, but it’s always running then you may try the following.

At first download the SpiderOak package. Then open up a terminal and use the following commands.

Change to your home directory and remove the old installation: (this will not remove your files stored in SpiderOak!)

rm -r .config/SpiderOak 
sudo apt-get remove --purge SpiderOak spideroak:i386

Now reinstall SpiderOak:

sudo dpkg -i spideroak.deb 
SpiderOak --setup=-

This will hopefully reinstall your SpiderOak and synchronize it with the server again. The last step can take a long time. So I actually faced this problem twice. Probably because I used the same device name on two different machines (which – guess what – you shouldn’t do 😉 ).

First time I encountered this problem this procedure resolved my problem, the second time the synchronize step never finished (and with never I mean like for 12 hours) even with a decent internet connection – so I cancelled it. I then repeated that procedure but set up a new device name. After an also quite long (few hours) synchronize period my SpiderOak finally came back to life.

Hope this helps you if you encounter similar problems.

Flattr this!