

Autour de LDAP
Awstats
Backup HP COLORADO 5G
Compatibilit� Linux
Configuration NFS
Configuration ZSH
Configuration de FreeBSD
Connexion ADSL PPPOE
IPFILTER
Installation PXE
Installation d'un DNS
Installation d'un Squirrelmail
Installation de Apache SSL
Installation de FreeBSD
Installation de GRUB
Installation de MailScanner
Installation de PostgreSQL
Jail sous FreeBSD
Mise a jour de votre FreeBSD
Serveur CVS
Serveur DHCPd
Serveur IRCd
Serveur NTPd
Serveur ProFTPd
Serveur at home
Utilisation simple de CVS
X11: interface graphique




Et aussi ...
rockanjou.org
|
Mise en oeuvre d'un Backup sur HP COLORADO 5G
sommaire
Introduction
Aspects mat�riels
Aspects logiciels
Installation Flexbackup
Utilisation simple
Utilisation avan��e
Conclusions
introduction
Ce condens� synth�tise les articles que j'ai lus sur les BACKUP et expose de fa�on concr�te la fa�on d'installer et de configurer un syst�me de backup bas� sur FreeBSD 4.10 en association avec un Hp colorado ide de 5 go (bande type travan).
Les donn�es expos�es dans cet article sont tir�es de mon exp�rience personnelle avec les mat�riels et softwares cit�s.
Elles r�sultent de nombreux tests, tatonnements, empirismes...
aspects mat�riels
La mat�riel utilis� est :
- mini pc avec carte mini itx epia 800 avec 256 Mo ram et un disque dur ide de 40 Go
- hp colorado ide 5 go compress� (bande type travan)
Le Colorado est connect� en slave secondaire.
Il est reconnu par le bios sans probl�me.
aspects logiciels
La version de FreeBSd utilis�e est 4.10.
Au niveau du kernel, il faut activer, si ce n'est pas d�j� fait, l'option :
device atapist # ATAPI tape drives
et recompiler le noyau.
Dmesg fournit le message suivant :
ast0: TAPE at ata1-slave PIO4
installation flexbackup
Un logiciel open source, simple et souple, disponible dans les ports est FLEXBACKUP.
cd /usr/ports/sysutils/flexbackup
make && make install && make clean
L'installation se passe normalement sans soucis.
Il reste � configurer le fichier /etc/flexbackup.conf.
Mon fichier personnel est joint en annexe.
Les lignes � renseigner ou � modifier sont les suivantes :
# Device to backup to. -->> non-rewinding version, please! <<--
$device = '/dev/nast0';
# Block size (in kilobytes!) to use for archive programs and dd. Default is
$blksize = '32';
# Block size (in bytes!) to use for the tape device, with "mt setblk" or
$mt_blksize = "0";
# Padding. True to pad blocks to blocksize
$pad_blocks = 'true';
Ces param�tres sont ceux � configurer au minimum.
Compte tenu de la richesse de Flexbackup, il y a �videmment d'autres options utilisables d�taill�es dans le man.
utilisation simple
Les commandes minimum utiles et les cas les plus simples sont examin�s ci-apr�s. Il s'agit de sauvegarde compl�te.
A titre d'exemple, les temps n�cessaires � la sauvegarde et � l'extraction d'un r�pertoire de 3.7 go sont de l'ordre de 1h15.
1) pr�paration de la bande :
a) Effacement
mt -f /dev/nast0 rewind
mt -f /dev/nast0 erase
b) Cr�ation d'un index sur la bande :
flexbackup -newtape
mt -f /dev/nast0 rewind
2) v�rification de la bonne syntaxe du fichier /etc/flexbackup.conf
flexbackup -test-tape-drive
entraine un message (extrait) :
--------------------------------------------------------------------------------------------------------------------------------------
flexbackup version 1.2.1 (http://flexbackup.sourceforge.net)
/etc/flexbackup.conf syntax OK
|------------------------------------------------------------
| Checking 'buffer' on this machine... Ok
| Checking /bin/sh on this machine... unknown (probably Bourne Shell)
|------------------------------------------------------------
......................................................
Comparing...
SUCCESS! Tape drive parameters seem to work just fine
---------------------------------------------------------------------------------------------------------------------------------------------
Malgr�s certains messages d'erreurs, tout fonctionne correctement.
3) Sauvegarde d'un r�pertoire :
Apr�s 1)a) et 1)b), faire :
flexbackup -dir /home/repertoire_a_enregister
les donn�es ont comme num�ro d'index = 1 pour cet exemple
4) Lister les fichiers contenus dans une archive :
mt -f /dev/nast0 rewind
mt -f /dev/nast0 fsf 1
flexbackup -list
fsf 1 correspond au num�ro d'index des donn�es
5) Restauration des donn�es du r�pertoire :
se placer dans le r�pertoire o� l'on veut restaurer les donn�es /home/repertoire_pour_restauration
mt -f /dev/nast0 rewind
mt -f /dev/nast0 fsf 1
flexbackup -extract
6) Comparer les fichiers contenus dans une archive avec ceux du r�pertoire courant :
mt -f /dev/nast0 rewind
mt -f /dev/nast0 fsf 1
flexbackup -compare
7) v�rification des donn�es entre l'original et la restauration :
diff /home/repertoire_a_enregister /home/repertoire_pour_restauration
utilisation avan��e
1) Sauvegardes successives :
Il suffit d'enchainer les instructions :
flexbackup -dir /home/repertoire_a_enregister01
flexbackup -dir /home/repertoire_a_enregister02
flexbackup -dir /home/repertoire_a_enregister03
flexbackup -dir /home/repertoire_a_enregister04
flexbackup -dir /home/repertoire_a_enregister05
Le num�ro d'index est automatiquement incr�ment� de 1 � chaque sauvegarde (1 � 5 ici)
2) Restauration successives :
Il suffit de rembobiner la bande
mt -f /dev/nast0 rewind
et de positionner la bande (fsf 1 � 5 ici) au niveau des diff�rentes sauvegardes avec
mt -f /dev/nast0 fsf 1
puis d'extraire les donn�es dans le r�pertoire o� l'on ex�cute la commande
flexbackup -extract
3) Restauration dans le r�pertoire courant d'un ou de plusieurs fichiers list�s dans un fichier texte liste_fichiers_a_extraire :
mt -f /dev/nast0 rewind
mt -f /dev/nast0 fsf 1
flexbackup -extract - flist /chemin/liste_fichiers_a_extraire
conclusions
Les exemples trait�s ici ont �t� volontairement simplifi�s afin de bien comprendre le m�canisme de sauvegarde.
L'exploration des commandes de flexbackup et la configuration du fichier /etc/flexbackup.conf vous apporteront les solutions � vos probl�matiques de sauvegarde personnelles.
Le co�t d'un tel syst�me acquis d'occasion sur Ebay est d�risoire (40 euros sur ebay) et permettra de rendre bien des services.
Il est � noter que l'on peut aussi sauvegarder sur un deuxi�me disque dur, voire m�me sur plusieurs tapes et �galement sur un r�pertoire distant d'une autre machine.
ANNEXES :
flexbackup.conf
# -*-Mode: perl-*-
# ----------------------------------------------------------------------
# Flexbackup configuration file
# check "flexbackup -help" for usage information
# ----------------------------------------------------------------------
# General configuration section
# Archive type? afio, dump, tar, cpio, star, pax, zip, lha, ar, shar
# 'copy' or 'rsync' are extra options if running in archive-to-disk mode.
# 'filelist' dumps a list of files in your cwd - for debugging setup/exclusion
$type = 'afio';
# Configure backup "sets".
# Not needed if you use "-dir " to backup one tree at a time.
# Each set is a simple space-separated list of filesystems
# Remote filesystems should denoted as 'host:dir'
# You can use anything (other than 'all') as set names
#
# Example:
# $set{'set1'} = "/home /usr";
# $set{'set2'} = "/dir3 machine2:/dir4 machine3:/dir5";
#
# "-set all" will back up all defined sets. If you are doing a full backup
# using tapes, each "set" will go onto a different tape and you will be
# prompted for tape change in between.
#
$set{'backup'} = "/home";
# Subtree pruning
# A space-separated list of directories to prune from each backup.
# Key is a filesystem or host:dir spec as outlined above
# regular expressions allowed (not shell-type wildcards!)
$prune{'/'} = "tmp proc";
# Compression
$compress = 'gzip'; # one of false/gzip/bzip2/lzop/zip/compress/hardware
$compr_level = '4'; # compression level (1-9) (for gzip/bzip2/lzop/zip)
# Buffering program - to help streaming
$buffer = 'buffer'; # one of false/buffer/mbuffer
$buffer_megs = '10'; # buffer memory size (in megabytes)
$buffer_fill_pct = '75'; # start writing when buffer this percent full
$buffer_pause_usec = '100'; # pause after write (tape devices only)
# Device to backup to. -->> non-rewinding version, please! <<--
#
# Examples:
# Linux SCSI: /dev/nst0 Linux IDE: /dev/nht0
# Linux ftape: /dev/nqft0 FreeBSD SCSI: /dev/nrsa0 (4.x compat device node)
# FreeBSD SCSI: /dev/nsa0 (5.x)
#
# If a directory, will archive to files in that directory rather than a device
# If "host:/dev/tapedevice", will use remote tape drive via rsh/ssh
#
#$device = '/dev/tape';
$device = '/dev/nast0'; Hp colorado 5 go
#$device = '/usr/repertoire_o�_stocker_la_sauvegarde'; si on veut sauvegarder sur disque dur
# Block size (in kilobytes!) to use for archive programs and dd. Default is
# 10 for most things. Some tape drives need 32 or 64. Set to '0' to
# disable all blocking
$blksize = '32';
# Block size (in bytes!) to use for the tape device, with "mt setblk" or
# equivalent. If set to 0, will use "variable" block size for the tape
# device (which is recommended). Comment out or set to "$blksize * 1024" to
# have it be the same as the archiver block size above.
$mt_blksize = "0";
# Padding. True to pad blocks to blocksize
# (devices only, not used when archiving to files)
$pad_blocks = 'true';
# Other global flags
$remoteshell = 'ssh'; # command for remote shell (rsh/ssh/ssh2)
$remoteuser = ''; # if non-null, secondary username for remote shells
$label = 'true'; # somehow store identifying label in archive?
$verbose = 'true'; # echo each file?
$sparse = 'true'; # handle sparse files?
$indexes = 'true'; # false to turn off all table-of-contents support
# If backing up to files, use static filenames - no date stamp
# (same level backup of same directory will overwrite old backups)
$staticfiles = 'false';
# True to try and preserve file access times during backup, if the selected
# archive program can do so. Note that if this is true, -cnewer checks (file
# permission/status changes only, not content) are turned off when deciding
# which files to archive on the local system.
$atime_preserve = 'false';
# Span across filesytems? ("dump" will ignore this option)
# Set to "false" (don't) , "local" (all but nfs/smbfs), or "all" (everything)
$traverse_fs = 'false';
# Exclude files that match these *regular expressions* (not shell wildcards)
# from the backups (no affect on 'dump' archives). You can list more than one,
# just keep incrementing the index in the brackets for each. Also, strip off
# leading directories (the filesystem specs above or the "-dir" flag).
# Matches paths, not filenames, so put .* on the front/back as needed.
# Comment these out to exclude nothing.
$exclude_expr[0] = '.*/[Cc]ache/.*';
$exclude_expr[1] = '.*~$';
# If true (default), and using a tape device, level zero "set" backups
# assume you want to erase and use a new tape for each set. If false, level
# zero "set" backups append to tapes. To force an erase for any backup,
# use "-erase" on the commandline.
$erase_tape_set_level_zero = 'true';
# Set this to "true" to make erase operations just call "mt rewind" - not
# "mt rewind' followed by "mt erase". (For some tape drives, erase takes
# hours rather than seconds or is otherwise undesirable)
$erase_rewind_only = 'false';
#$erase_rewind_only = 'true';
# ----------------------------------------------------------------------
# Log/stamp files, path for temporary files
$logdir = '/var/log/flexbackup'; # directory for log files
$comp_log = 'gzip'; # compress log? false/gzip/bzip2/lzop/compress/zip
$staticlogs = 'false'; # static log filenames w/ no date stamp
$prefix = ''; # log files will start with this prefix
$tmpdir = '/tmp'; # used for temporary refdate files, etc
$stampdir = '/var/lib/flexbackup'; # directory for backup timestamps
$index = '/var/lib/flexbackup/index'; # DB filename for tape indexes
$keyfile = '00-index-key'; # filename for keyfile if archiving to dir
$sprefix = ''; # stamp files will start with this prefix
# ----------------------------------------------------------------------
# Parameters for 'afio' only
# File extensions that should not be compressed (seperate with spaces)
$afio_nocompress_types = 'mp3 MP3 Z z gz gif zip ZIP lha jpeg jpg JPG taz tgz deb rpm bz2 lzo';
# True to show block numbers
$afio_echo_block = 'false';
# Files less than this size (kilobytes) won't be compressed
$afio_compress_threshold = '3';
# Maximum amount of memory (megabytes) to use for temporary storage of
# compression results. If a compressed file is bigger than this, compression
# will have to run twice on the file (see manpage).
$afio_compress_cache_size = '2';
# ----------------------------------------------------------------------
# Parameters for 'tar' only
# True to show record numbers
$tar_echo_record_num = 'false';
# ----------------------------------------------------------------------
# Parameters for 'cpio' only
# Format of cpio archive
$cpio_format = 'newc';
# ----------------------------------------------------------------------
# Parameters for 'dump' only
# Estimated tape size (in kilobytes). This number doesn't really do much
# but help 'dump' get size estimates if set to zero uses 'dump -a'
$dump_length = '0';
# True to use /etc/dumpdates (could mess things up if you dump subdirectories
# of mount points). False to use flexbackup's timestamps.
$dump_use_dumpdates = 'false';
# ----------------------------------------------------------------------
# Parameters for 'star' only
# Use fifo (buffering)? (you probably want to set $buffer=false above if so)
$star_fifo = 'true';
# Handle ACLs?
$star_acl = 'true';
# Format of star archive
$star_format = 'exustar';
# True to show block numbers
$star_echo_block_num = 'false';
# ----------------------------------------------------------------------
# Parameters for 'pax' only
# Format of pax archive
$pax_format = 'ustar';
# ----------------------------------------------------------------------
# Parameters for 'zip' only
# File extensions that should not be compressed (seperate with spaces)
$zip_nocompress_types = 'mp3 MP3 Z z gz gif zip ZIP lha jpeg jpg JPG taz tgz deb rpm bz2 lzo';
# ----------------------------------------------------------------------
# Parameters for 'package delta' backups
# Archive a list of all installed packages in the top level of each backup?
# Can be 'false', 'true' (save it for any backup), or
# 'rootonly' (saves list only if the filesystem is '/')
$pkgdelta_archive_list = 'rootonly';
# Archive files not "owned" by packages?
$pkgdelta_archive_unowned = 'true';
# Archive any package-owned files which have been modified?
$pkgdelta_archive_changed = 'true';
# ----------------------------------------------------------------------
# Paths to commands. Default will look for them in $PATH. Use this if
# you want to set commands explicitly. You can use full paths or just
# change command names.
#
# Example: If GNU tar is called "gtar" on your system:
# $path{'tar'} = 'gtar';
#
# Or can be used to "sudo" certain commands. Examples:
# $path{'find'} = 'sudo find';
# $path{'dump'} = 'sudo dump';
# $path{'afio'} = 'sudo -u nonrootuser afio';
#
# ----------------------------------------------------------------------
# mt operation overrides. Set if flexbackup doesn't know the right mt
# command(s) for your OS/device, or you want to override things.
#
# Example: use "mt status" instead of "mt tell"
# $mt{'tell'} = 'status';
######################################################################
#
# $Id: flexbackup.conf,v 1.74 2003/09/21 22:59:58 edwinh Exp $
# $Name: v1_2_1 $
#
# Leave '1;' on the the next line - for perl 'require'
1;
Marc HOQUET le 2004/09/22 |
|