2

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 rsyncing 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?

1 Answer 1

1

Is the described solution reliable?

The only thing you need to be careful of is ensuring critical files are not being written to or otherwise in heavy use when you make the rsync. Other than that, this method will work fine. It's reliable in this sense because Linux has no concept of a registry or global key/value data-store.

One thing you might want to do is disable uid/gid matching (--numeric-ids), otherwise if your destination system has a user with the same user/groups (e.g. nobody or mailman) then rsync will swap the UID, and may/may not swap it back depending on what order you restore the files (e.g. if /etc/passwd is present with the mappings or not).

Should I exclude some more directories?

I don't feel this is necessary. I've used -auvz when making rsyncs and never had an issue with them. You might want to use rsnapshot, it'll give you rsyncs plus rotational backups at little additional cost.

1
  • You may want to take a look at Hot Copy for snapshotting functionality without LVM. It requires loading a kernel module, though. So using it in an OpenVZ environment likely would not be an option unless the provider has loaded it for you.
    – the-wabbit
    Jul 17, 2012 at 11:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .