Différences

Cette page vous donne les différences entre la révision choisie et la version actuelle de la page.

Lien vers cette vue

linux:dar [2010/03/09 00:54]
matthieu créée
linux:dar [2012/08/27 18:32] (Version actuelle)
matthieu [Restaurer une sauvegarde]
Ligne 1: Ligne 1:
 +{{tag>fr fr:linux fr:client fr:sauvegarde}}
 ====== Dar ====== ====== Dar ======
  
Ligne 8: Ligne 9:
 Cette page décrit comment l'utiliser ponctuellement ou de manière automatisée. Cette page décrit comment l'utiliser ponctuellement ou de manière automatisée.
  
 +===== Installation =====
 +Installer le paquet :
 +  * dar
  
 +===== Aide intégrée =====
 +Voici le résultat de l'aide intégrée à dar.
 +
 +<code>
 +# dar -h
 +usage: dar [ -c | -x | -d | -t | -l | -C | -+ ] [<path>/]<basename> [options...]
 +       dar -h
 +       dar -V
 +
 +Commands are:
 +   -c  creates an archive
 +   -x  extracts files from the archive
 +   -d  compares the archive with the existing filesystem
 +   -t  tests the archive integrity
 +   -l  lists the contents of the archive
 +   -C  isolates the catalogue from an archive
 +   -+  merge two archives / create a sub archive
 +
 +   -h  displays this help information
 +   -V  displays version information
 +
 +Common options:
 +   -v              verbose output
 +   -q              suppress final statistics report
 +   -vs             display skipped files
 +   -R <path>       filesystem root directory (current dir by default)
 +   -X <mask>       files to exclude from the operation (none by default)
 +   -I <mask>       files to include in the operation (all by default)
 +   -P <path>       subdirectory to exclude from the operation
 +   -g <path>       subdirectory to include in the operation
 +   -[ <filename>   filename contains a list of files to include
 +   -] <path>       filename contains a list of files to exclude
 +   -n              don't overwrite files
 +   -w              don't warn before overwriting files
 +   -wa             don't warn before overwriting and removing files
 +   -b              ring the terminal bell when user action is required
 +   -O[ignore-owner | mtime | inode-type] do not consider user and group
 +                   ownership
 +   -H [N]          ignore shift in dates of an exact number of hours
 +   -E <string>     command to execute between slices
 +   -F <string>     same as -E but for the archive of reference
 +   -u <mask>       mask to ignore certain EA
 +   -U <mask>       mask to allow certain EA
 +   -K <string>     use <string> as key to encrypt/decrypt
 +   -J <string>     same as -K but it does concern the archive of reference
 +   -# <integer>    encryption block size
 +   -* <integer>    same as -# but for archive of reference
 +   -B <filename>   read options from given file
 +   -N              do not read ~/.darrc nor /etc/darrc configuration file
 +   -e              dry run, fake execution, nothing is produced
 +   -Q              suppress the initial warning when not launched from a tty
 +   -aa             do not try to preserve atime of file open for reading.
 +   -ac             do not try to preserve ctime (default behavior).
 +   -am             set ordered mode for all filters
 +   -an             the masks that follow are now case insensitive
 +   -acase          the masks that follow are now case sensitive
 +   -ar             set the following masks to be regex expressions
 +   -ag             set the following masks to be glob expressions
 +   -j              ask user what to do when memory is exhausted
 +
 +Saving / Isolation / merging options (to use with -c, -C or -+):
 +   -A [path/]<basename> archive to take as reference
 +   -@ [path/]<basename> auxiliary archive of reference for merging
 +   -$ <string>     encryption key for auxiliary archive
 +   -~ <string>     command between slices of the auxiliary archive
 +   -z [level]      compress data in archive using gzip algorithm
 +   -y [level]      compress data in archive using bzip2 algorithm.
 +   -s <integer>    split the archive in several files of size <integer>
 +   -S <integer>    first file size (if different from following ones)
 +   -aSI            slice size suffixes k, M, T, G, etc. are power of 10
 +   -abinary        slice size suffixes k, M, T, G, etc. are power of 2
 +   -p              pauses before writing to a new file
 +   -D              excluded directories are stored as empty directories
 +   -Z <mask>       do not compress the matching filenames
 +   -Y <mask>       do only compress the matching filenames
 +   -m <number>     do not compress file smaller than <number>
 +   --nodump        do not backup, files having the nodump 'd' flag set
 +   -G [path/]<basename> Do on-fly catalogue isolation of the resulting archive
 +   -M              stay in the same filesystem while scanning directories
 +   -,              ignore directories that follow the Directory Tagging
 +                   Standard
 +
 +Restoring options (to use with -x) :
 +   -k              do not remove files destroyed since the reference backup
 +   -r              do not restore file older than those on filesystem
 +   -f              do not restore directory structure
 +
 +Reading options (to use with -x, -d, -t, -l, -A)
 +   -i <named pipe> pipe to use instead of std input to read data from dar_slave
 +   -o <named pipe> pipe to use instead of std output to orders dar_slave
 +
 +Listing options (to use with -l):
 +   -T              tree output format
 +   -as             only list files saved in the archive
 +
 +
 +Type "man dar" for more details and for all available options.
 +</code>
 +
 +===== Sauvegarder un dossier à la main =====
 +Commençons par un simple sauvegarde de /home :
 +  dar -v -c home -R / -g home
 +
 +Quelques détails des options :
 +  * -c home : indique que nous voulons créer la sauvegarde home.dar
 +  * -R / : défini le chemin relatif pour la sauvegarde, sinon le répertoire actuel est utilisé
 +  * -g home : indique le répertoire à sauvegarder, celui-ci est relatif à l'option -R
 +  * -v : active le mode verbeux
 +
 +Exemple d'exécution :
 +<code>
 +# dar -v -c home -R / -g home
 +Adding file to archive: /home
 +Adding file to archive: /home/matthieu
 +Adding file to archive: /home/matthieu/.bashrc
 +Adding file to archive: /home/matthieu/.bash_logout
 +Adding file to archive: /home/matthieu/.profile
 +....
 +....
 +Writing archive contents...
 +
 +
 + --------------------------------------------
 + 56 inode(s) saved
 + with 0 hard link(s) recorded
 + 0 inode(s) changed at the moment of the backup
 + 0 inode(s) not saved (no inode/file change)
 + 0 inode(s) failed to save (filesystem error)
 + 28 inode(s) ignored (excluded by filters)
 + 0 inode(s) recorded as deleted from reference backup
 + --------------------------------------------
 + Total number of inodes considered: 84
 + --------------------------------------------
 + EA saved for 0 inode(s)
 + --------------------------------------------
 +</code>
 +
 +===== Lister les fichiers sauvegardés =====
 +Pour visualiser la sauvegarde, il faut utiliser l'option -l :
 +  dar -l home
 +
 +Exemple :
 +<code>
 +[data ][ EA  ][compr] | permission | user  | group | size  |          date                 |    filename
 +----------------------+------------+-------+-------+-------+-------------------------------+------------
 +[Saved]       [-----]   drwxr-xr-x   0  root    0       Sun Mar  7 15:08:58 2010        home
 +[Saved]       [-----]   drwxr-xr-x   matthieu   matthieu        0       Fri Mar  5 21:48:35 2010        home/matthieu
 +[Saved]       [     ]   -rw-r--r--   matthieu   matthieu        3116    Fri Mar  5 21:48:35 2010        home/matthieu/.bashrc
 +[Saved]       [     ]   -rw-r--r--   matthieu   matthieu        220     Fri Mar  5 21:48:35 2010        home/matthieu/.bash_logout
 +[Saved]       [     ]   -rw-r--r--   matthieu   matthieu        675     Fri Mar  5 21:48:35 2010        home/matthieu/.profile
 +...
 +</code>
 +
 +===== Restaurer une sauvegarde =====
 +Avant toute restauration, il est important de comprendre que seule une sauvegarde complète contient toutes les données. Pour restaurer des sauvegardes incrémentales ou différentielles, il faut restaurer dans un premier temps la sauvegarde complète puis les intermédiaires.
 +
 +:!: L'option **-R** indique où restaurer, les fichiers présents seront potentiellement écrasés.
 +
 +  dar -v -R /dossier_cible -x sauvegarde_a_restaurer
 +  
 +Exemple :
 +<code>
 +root@/backup# dar -v -R /restore/ -x full_20120815_040001.1.dar
 +Warning, full_20120815_040001.1.dar seems more to be a slice name than a base name. Do you want to replace it by full_20120815_040001 ? [return = OK | Esc = cancel]
 +Continuing...
 +Extracting contents of the archive...
 +Restoring file: /restore/selinux
 +Restoring file: /restore/backup
 +Restoring file: /restore/bin
 +Restoring file: /restore/media
 +</code>
 +
 +Il faut ensuite restaurer les intermédiaires avec la même commande et l'option "-w" pour écraser les fichiers :
 +<code>
 +root@/backup# dar -v -R /restore/ -x inc_20120827_040001.1.dar -w
 +Warning, inc_20120827_040001.1.dar seems more to be a slice name than a base name. Do you want to replace it by inc_20120827_040001 ? [return = OK | Esc = cancel]
 +Continuing...
 +Extracting contents of the archive...
 +Restoring file: /restore/backup
 +Restoring file: /restore/root
 +</code>
 +
 +Enfin, pour filtrer la restauration il est possible d'utiliser l'option "-g" avec le chemin relatif, par exemple pour ne restaurer que root :
 +<code>
 +root@/backup# dar -v -R /restore/ -x full_20120815_040001.1.dar -g root
 +Warning, full_20120815_040001.1.dar seems more to be a slice name than a base name. Do you want to replace it by full_20120815_040001 ? [return = OK | Esc = cancel]
 +Continuing...
 +Extracting contents of the archive...
 +Restoring file: /restore/root
 +</code>
 ===== Automatisation de la sauvegarde ===== ===== Automatisation de la sauvegarde =====
 <file> <file>
Ligne 149: Ligne 343:
  
 ===== Links ===== ===== Links =====
 +  * http://dar.linux.free.fr/ 
 +  * http://dar.linux.free.fr/doc/samples/index.html
  
linux/dar.1268092469.txt.gz · Dernière modification: 2010/03/09 00:54 par matthieu
Recent changes RSS feed Debian Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki