Stockage / Sauvegarde / Archivage Rsnapshot Organiser la sauvegarde et l’archivage des fichiers sur un serveur Linux Avantage : - utilisation de « hard links » pour préserver de l’espace sur le disque - sauvegarde incrémentale Installation : CentOS dépôt EPEL # yum install rsnapshot Debian # apt-get install rsnapshot Configuration : /etc/rsnapshot.conf - emplacement des sauvegardes snapshot_root /people/backup/snapshot/ - définition des sauvegardes backup /home/ localhost/ backup /people/backup/machines/garbin/etc localhost/ backup root@cers:/etc/ cers/ Sauvegarde locale Sauvegarde distante
Stockage / Sauvegarde / Archivage Rsnapshot Configuration : /etc/rsnapshot.conf - rotation des sauvegardes retain hourly 4 retain daily 7 retain weekly 4 - activation de SSH cmd_ssh /usr/bin/ssh - Option : lancement de script pré et post sauvegarde cmd_preexec /usr/local/sbin/preexec_sync_backup cmd_postexec /usr/local/sbin/create_backupDir
Stockage / Sauvegarde / Archivage Rsnapshot Tâche CRON : en cohérence avec le « retain » de rsnapshot.conf - # crontab -e 01 */6 * * * /usr/bin/rsnapshot hourly 2>&1 | /usr/local/bin/rsnapreport.pl | mail -s "rsnapshot hourly" admin@ies.univ-montp2.fr 35 22 * * * /usr/bin/rsnapshot -q daily 15 22 * * 6 /usr/bin/rsnapshot -q weekly
Stockage / Sauvegarde / Archivage Rsnapshot Test : # rsnapshot -t hourly echo 8829 > /var/run/rsnapshot.pid /usr/local/sbin/preexec_sync_backup /bin/rm -rf /people/backup/snapshot/hourly.3/ mv /people/backup/snapshot/hourly.2/ /people/backup/snapshot/hourly.3/ mv /people/backup/snapshot/hourly.1/ /people/backup/snapshot/hourly.2/ /bin/cp -al /people/backup/snapshot/hourly.0 \ /people/backup/snapshot/hourly.1 /usr/bin/rsync -a --delete --numeric-ids --relative --delete-excluded \ --stats --exclude='/home/lost+found' --exclude='/home/aquota.user' \ --exclude='perso/' --exclude='.cache/' --exclude='*.iso' /home \ /people/backup/snapshot/hourly.0/localhost/ …
Stockage / Sauvegarde / Archivage Rsnapshot Organisation de la sauvegarde
Stockage / Sauvegarde / Archivage Rsnapshot Vérification taille : # rsnapshot du localhost/home/camps …. 31G /people/backup/snapshot/hourly.0/localhost/home/camps 206M /people/backup/snapshot/hourly.1/localhost/home/camps 112M /people/backup/snapshot/hourly.2/localhost/home/camps 112M /people/backup/snapshot/hourly.3/localhost/home/camps 112M /people/backup/snapshot/daily.0/localhost/home/camps 112M /people/backup/snapshot/daily.1/localhost/home/camps 206M /people/backup/snapshot/daily.2/localhost/home/camps 206M /people/backup/snapshot/daily.3/localhost/home/camps 206M /people/backup/snapshot/daily.4/localhost/home/camps 208M /people/backup/snapshot/daily.5/localhost/home/camps 207M /people/backup/snapshot/daily.6/localhost/home/camps 112M /people/backup/snapshot/weekly.0/localhost/home/camps 208M /people/backup/snapshot/weekly.1/localhost/home/camps 208M /people/backup/snapshot/weekly.2/localhost/home/camps 206M /people/backup/snapshot/weekly.3/localhost/home/camps 34G total