I have a VPS with Debian 6 (squeeze) and want to back it up on an external drive at home, so that in case of failure I can restore the complete operating system with all software, settings and databases.
The solution I think of is to rsync
the server's /
directory to the external drive, like rsync --one-file-system --archive "[email protected]:/" "/media/backup"
. The --one-file-system
option will exclude virtual directories like /proc
, /sys
, /dev
and /run
.
Most VPS providers don't have the option of booting the server from a virtual CD or modifying its filesystem when it's not running, so backup restoration to a new VPS would have to involve a fresh install of Debian modifying itself.
I think it can be done by rsync
ing the external drive to the server's /
directory, with a command like rsync --one-file-system --archive --delete "/media/backup" "[email protected]:/"
. --delete
is used to delete files on the server that are not in the backup, and --one-file-system
not to delete virtual directories (that were excluded when making the backup).
The virtualization platform is OpenVZ, so the kernel is shared and /boot
is empty.
Is the described solution reliable? Should I exclude some more directories? If the solution is not reliable, what alternative do you suggest?