Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a vps server that I would like to backup using tar. I currently use this command to do so, and it works very well for me right now.

tar cvpjf backup.tar.bz2 --exclude=/proc 
 --exclude=/lost+found --exclude=/backup.tar.bz2 --exclude=/mnt --exclude=/sys /

however, if i would like to restore this tar on a new vps system, this won't work because it will mess up the network settings (ip, interfaces, etc.)

how can i modify this tar command so that i can tar one server, and decompress it on another so no problem and it will still maintain my data, iptables,software, cron jobs, groups, users etc.

Is that possible?

share|improve this question
Generally you cannot simply copy the system like that, except if the destination system was the exact same version of the OS. Then maybe copying /etc would restore your config. But I would still refrain fro m actually copying package databases (probably in /var) etc. over. You need to do this more fine-grained. Probably you reinstall a new OS, configure it manually, move user data and reconfigure the new OS (apache, etc.) according to the docs you created while configuring your old OS. – Marki Feb 9 '14 at 16:50
up vote 0 down vote accepted

this kind of backup/restory is used,yes.

Depending on the virtualization, OpenVZ would reset your IP after restart. However on KVM/XEN/(any other full virt) I would advise you to save your network configuration and restore them manually before restart.

Also perhaps you may be interested in doing it with rsync: (so you can keep the backup up to date). This will still overwrite your config, but you could try chattr -i to remove writeability from those config files.

Hope i helped :)

share|improve this answer
what do you mean by "save your network configuration"? How would I go about doing that? What is my network configuration? – Yusuf Ali Feb 10 '14 at 2:14
It depends on your OS. RHEL like (centos): /etc/sysconfig/network and /etc/sysconfig/network-scripts Debian like: /etc/network/interfaces – Semirke Feb 10 '14 at 10:46

Your Answer


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.