backup an existing linux server to a virtualbox virtual machine

I have some servers and VPSs to many companies across the world. I want to back them up locally. I have some backup solutions enabled to remote hosts, but I want to have a local backup on a computer at home.

What I am thinking is:

  1. Create a virtualbox virtual machine, install the same version linux as the server.

  2. Use rsync to backup the server to the local virtualbox machine. (something like rsync -av --delete --progress --exclude '/dev/' --exclude '/proc/' root@server_ip:// / )

  3. Repeat the command every few days update files.

  4. In case of a hard disk failure, or any other bad event, reverse the rsync command and get the files back and continue my bussiness.

I tried it with 2 openvz VPS, the one was a backup of the other. I also tried to transfer normal linux server host to openvz machine and it worked great.

That way looks pretty clean and easy to me, this is the kind of solution I am looking for. However I need to be sure that this will work if I am going to do it.

The question is, will that work ok ? Does anyone see any problem with that ? Do you have any other suggestions ?

Thanks


Solution 1:

You should add some methods to easily reconstruct the disk structure (partition table, file systems, mount points).

Also, an rsync backup can horribly fail in some cases where file are kept open for a long time and are steadily updated. Database servers are prime examples for this - you can't reliably backup a running database with rsync.