Doc /

Complete backup of a server

Version française: Sauvegarde complète d'un serveur

A data or web server needs several kinds of backups, depending what problem the backup is aimed to fix.

Rsync scripts

Most backups are done with rsync scripts, preferably to an external server (other than the one being backed). So you may need to setup a ssh authentification key without pass phrase to connect the two computers (see).

Home

By home, I mean home and all the eventual data, I mostly try to setup data folders in /home for convenience (in the server). There are probably in /home no special file needing special treatment, but the files may be large or in large number. These files mostly have to survive a server upgrade.

rsync -avz --delete --rsync-path="rsync --fake-super" -e "ssh -i /root/.ssh/id_dsa" /home user@dodin.org:~/data/

fake-super is there to keep superuser permissions if any.

save it in a script bash in bin

In cron:

 30 01 * * * /root/bin/backup-home

System

In system, the key is "-x' that mean "no external file system", for example do not go to mounted parts (so no /home) nor extra file systems like /dev or /proc.

rsync -avz --delete --rsync-path="rsync --fake-super"   -e "ssh -i /root/.ssh/id_dsa" -x / nemo-bk@dodin.org:/data/nemo-bk/system

Variants

rsync -av --max-size=400m --delete --exclude=/media --exclude=/proc --exclude=/dev --exclude=/sys --exclude=/tmp --exclude=/var/tmp --delete-excluded --exclude='*/Cache/*' --exclude=/windows/C/pagefile.sys / /media/opensuse11/

ajouter "-n" (dry run) au premier essai

sauvegarde du serveur:

rsync -av --exclude=/media --exclude=/proc --exclude=/dev --exclude=/sys --exclude=/tmp --exclude=/var/tmp --exclude=/data --exclude=/extra --exclude=/home / .

-e ssh root@dodin:/ pour passer par ssh

attention, ca exclu /data

pour les données:

rsync -av --exclude k2_root/ --exclude backup/ -e ssh root@dodin.org:/data/ .

Usage de l'option "-x" (one file system)?

se placer dans le répertoire de réception et

rsync -av -x --delete origine destination

Sauvegarde du serveur du culte:

m-r (dans m-r, script cron):

rsync -avz -e "ssh -i /root/.ssh/id_dsa" / cu1lt2@dodin.org:/data/culte-serveurs-bk/m-r/ --exclude=/proc --exclude=/dev --exclude=/sys --exclude=/tmp --exclude=/var/tmp --delete-excluded --exclude='*/Cache/*' --max-size=400m --delete