0

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?

Yusuf Ali
  • 7
  • 2
  • 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 09 '14 at 16:50

1 Answers1

0

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: https://wiki.archlinux.org/index.php/Full_System_Backup_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 :)

Semirke
  • 314
  • 1
  • 2
  • 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 02: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