samedi 6 décembre 2008

Disk backup

Installing and configuring backup2l

This covers only basic configuration. In a following post I might want to explain how to set it up for writing your backups on an external disk (NAS/NDAS).

Install backup2l software:

$ sudo apt-get install backup2l
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
liblockfile1
Veuillez utiliser « apt-get autoremove » pour les supprimer.
Paquets suggérés :
cdlabelgen
Les NOUVEAUX paquets suivants seront installés :
backup2l
0 mis à jour, 1 nouvellement installés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 29,8ko dans les archives.
Après cette opération, 143ko d'espace disque supplémentaires seront utilisés.
Réception de : 1 http://be.archive.ubuntu.com hardy/universe backup2l 1.4 [29,8kB]
29,8ko réceptionnés en 0s (97,9ko/s)
Sélection du paquet backup2l précédemment désélectionné.
(Lecture de la base de données... 144923 fichiers et répertoires déjà installés.)
Dépaquetage de backup2l (à $ sudo apt-get install backup2l
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
liblockfile1
Veuillez utiliser « apt-get autoremove » pour les supprimer.
Paquets suggérés :
cdlabelgen
Les NOUVEAUX paquets suivants seront installés :
backup2l
0 mis à jour, 1 nouvellement installés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 29,8ko dans les archives.
Après cette opération, 143ko d'espace disque supplémentaires seront utilisés.
Réception de : 1 http://be.archive.ubuntu.com hardy/universe backup2l 1.4 [29,8kB]
29,8ko réceptionnés en 0s (97,9ko/s)
Sélection du paquet backup2l précédemment désélectionné.
(Lecture de la base de données... 144923 fichiers et répertoires déjà installés.)
Dépaquetage de backup2l (à partir de .../archives/backup2l_1.4_all.deb) ...
Paramétrage de backup2l (1.4) ...partir de .../archives/backup2l_1.4_all.deb) ...
Paramétrage de backup2l (1.4) ...

Configure the software

Backup2l is a niece piece of software. All configuration is located in /etc/backup2l.conf and few changes are required to make it work:

  • Source directories to be backed up. In my case I did not want /var/mail or /usr/local to be backed up so I removed that from the configuration:
< srclist="(/etc"

> SRCLIST=(/etc /root /home )
  • Files and Directories to skip. I don't want to backup music or video files, or firefox caches, or different kinds of "Thrash" cans:
< skipcond="(-path"

> SKIPCOND=( -path '*/.cpan/*' -o -path '*/lost+found/*' -o -path '*/CPAN/*' -o -path '*/.thumbnails/*' -o -path '*/.Trash/*' -o -path '*/Trash/*' -o -path '*/Cache/*' -o -path '*/.cache/*' -o -name '*.mp3' -o -name '*.wmw' -o -name '*.mov' -o -name '*.avi' -o -name '*.MP3' -o -name '*.WMW' -o -name '*.MOV' -o -name '*.AVI' )
  • Where to put the backups. In this case we'll use a file system (/var/backup) defined in /etc/fstab with the "noauto" option. This means that the file system is not mounted at boot but reserved for backup2l usage. The backups will be located in a subdirectory hereunder:
< #BACKUP_DEV="/disk2"
---
> BACKUP_DEV="/var/backup"

< backup_dir="/disk2/backup"
> BACKUP_DIR="/var/backup"
  • Pre- and Post- backup commands. Mounting the backup file system is not necessary, backup2l will do that before running the pre-backup commands. You might want (like I did) to uncomment the action that keeps a list of your selected (installed) packages before running the backup. This can be used to reinstall the system if you lose the entire system disk. Remember, /root is being backed up so you'll have this list available after you restore your backup on a new system:
<
> #echo " pre-backup: nothing to do"
90,91c91,92
< #echo " writing dpkg selections to /root/dpkg-selections.log..."
< #dpkg --get-selections | diff - /root/dpkg-selections.log
> /dev/null || dpkg --get-selections > /root/dpkg-selections.log
---
> echo " writing dpkg selections to /root/dpkg-selections.log..."
> dpkg --get-selections | diff - /root/dpkg-selections.log > /dev/null || dpkg --get-selections > /root/dpkg-selections.log
  • Final steps. You should enable the following to allow the software to run automatically from your daily crontab:
< autorun="0"

> AUTORUN=1

< unconfigured="1"

> #UNCONFIGURED=1
  • Lots of space but slow CPU? You might want to enable the following to produce backups in plain TAR format (instead of compressed tar.gz):
< # CREATE_DRIVER="DRIVER_MY_AFIOZ"

> CREATE_DRIVER="DRIVER_TAR"

Aucun commentaire: