Par LoiselJP Le 18/05/2014
Objectif Les administrateurs en informatique le savent : l un des points principaux du métier est la protection des données. Chacun sait que perdre ses données est souvent plus dramatique que de perdre un élément crucial du poste de travail tel qu un disque dur. Parmi l ensemble des techniques de la protection des données on y trouve les sauvegardes, la sécurité au travers de connexions, des pare feu, les mises à jour Dans ce document il va être question de protection du système et de sa restauration. Les administrateurs et dans le cadre d une entreprise les moyens mis en œuvre pour réaliser cette action sont généralement proportionnels au besoin. Dans le cadre d une utilisation personnelle, l objectif est de trouver le logiciel le plus approprié. Certes on trouvera un ensemble de logiciels tous plus performant les uns que les autres. En pensera bien évidemment à des produits comme CloneZilla, Clone Genius, des produits intégrés comme la sauvegarde intégrée du système Windows ou depuis peu celle intégrée dans les distributions Unix. Certes le système de sauvegarde utilisé doit être simple d emploi, convivial et efficace. Dans ce petit document il va être question de Fsarchiver. Il n a rien de convivial et n est pas si facile que cela à utiliser alors comment et pourquoi l utiliser? C est ce que va s efforcer d expliquer ce document. Description Fsarchiver est un programme de sauvegarde des systèmes de fichier. C est un logiciel très puissant et nettement plus pratique que des produits comme «partimage». Il mériterait d y consacrer un tutoriel mais les options ne sont pas assez nombreuses pour en discute r des heures. Bon nombre d entre vous devaient utiliser partimage jusqu à il y peu d autant que partimage était disponible sur tous les Cd-rom de dépannage.
L application était simple d emploi, rapide et assez pratique pour partager les sauvegardes, les contrôler et fiable. Portant on pouvait lui repprocher une petite chose, il n est pas possible de faire une restauration sur une partition plus petite que l originale. Ce Petit petit défaut était somme toute acceptable j usqu à l apparition de l Extend4 sur Linux, partimage étant non compatible il a fallu se rabattre sur d autres solutions. C est là que Fsarchiver entre en concurrence. Cete fois, Fsarchiver propose un système de sauvegrde en mesure de traiter des partitions en Ext4 ce qui n est pas toujours évident et qu il a pour autre très gros avantage de pouvoir restaurer un système sur des partitions plus petite que l originale. C est un coté bien pratique surtout lorsque l on ne connait pas les taille s d origine, ça arrive tellement souvent, ou il arrive aussi de faire une restauration sur un système temporaire, qui est souvent un disque de récupération donc plus petit et moins performant que l original. Fsarchiver ne s utilise qu en ligne de commande dommage! Trouver Fsarchiver Fsarchiver est disponible sur la plupart des CDrom de dépannage. A installer il n y a que 100Ko à télécharger et il occupe 300Ko installé autant dire que c est léger!
L aide (le manuel) ne fait pas plus de 200 Lignes NAME fsarchiver - filesystem archiver DESCRIPTION fsarchiver is a system tool that allows you to save the contents of a filesystem to a compressed archive file. The file-system can be restored on a partition which has a different size and it can be restored on a different file-system. Unlike tar/dar, FSArchiver also creates the filesystem when it extracts the data to partitions. Everything is checksummed in the archive in order to protect the data. If the archive is corrupt, you just lose the current file, not the whole archive. LINKS Official project homepage: http://www.fsarchiver.org Quick Start Guide: http://www.fsarchiver.org/quickstart Forums where to ask questions: http://www.fsarchiver.org/forums/ Report a bug: http://www.fsarchiver.org/forums/viewforum.php?f=17 SYNOPSIS fsarchiver [ options ] savefs archive filesystem... fsarchiver [ options ] restfs archive id=n,dest=filesystem[,mkfs=fstype,mkfsopt=options]... fsarchiver [ options ] savedir archive directory... fsarchiver [ options ] restdir archive destination fsarchiver [ options ] archinfo archive
fsarchiver [ options ] probe [detailed] COMMANDS savefs Save filesystems to archive. restfs Restore filesystems from archive. This overwrites the existing data on filesystems. Zero based index n indicates the part of the archive to restore. Optionally, a filesystem may be converted to fstype. savedir Save directories to archive (similar to a compressed tarball). restdir Restore data from archive which is not based on a filesystem to destination. archinfo Show information about an existing archive file and its contents. probe Show list of filesystems detected on the disks. OPTIONS -h, --help Show help and information about how to use fsarchiver with examples. -V, --version Show program version and exit. -v, --verbose Verbose mode (can be used several times to increase the level of details). The details will be printed to the console. -o, --overwrite Overwrite the archive if it already exists instead of failing. -d, --debug Debug mode (can be used several times to increase the level of details). The de tails will be written in /var/log/fsarchiver.log. -A, --allow-rw-mounted Allow to save a filesystem which is mounted in read-write (live backup). By default fsarchiver fails with an error if the partition if mounted in read-write mode which allows modifications to be done on the filesystem during the backup. Modifications can drive to inconsistencies in the backup. Using lvm snapshots is the recommended way to make backups since it will provide consistency, but it is only available for filesystems which are on LVM logical-volumes. -a, --allow-no-acl-xattr Allow to run savefs when partition is mounted without the acl/xattr options. By default fsarchiver fails with an error if the partition is mounted in such a way that the ACL and Extended-Attributes are not readable. These attributes would not be saved and then such attributes could be lost. If you know what you don't need ACL and Extended-Attributes to be preserved then it's safe to run fsarchiver with that option. -e pattern, --exclude=pattern Exclude files and directories that match that pattern. The pattern can contains shell asterisks such as * and?, and the pattern may be either a simple file/dir name or an absolute file/dir path. You must use quotes around the pattern each time you use wildcards, else it would be interpreted by the shell. The wildcards must be interpreted by fsarchiver. See examples below for more details about this option.
-L label, --label=label Set the label of the archive: it's just a comment about the contents. It can be used to remember a particular thing about the archive or the state of the filesystem for instance. -z level, --compress=level Valid compression levels are between 1 (very fast) and 9 (very good). The memory requirement increases a lot with the best compression levels, and it's multiplied by the number of compression threads (option -j). Level 9 is considered as an extreme compression level and requires an huge amount of memory to run. For more details please read this page: http://www.fsarchiver.org/compression -s mbsize, --split=mbsize Split the archive into several files of mbsize megabytes each. -j count, --jobs=count Create more than one compression thread. Useful on multi-core CPUs. By default fsarchiver will only use one compression thread (-j 1) and then only one logical processor will be used for compression. You should use that option if you have a multi -core CPU or more than one physical CPU on your computer. The typical way to use this option is to specify the number of logical processors available so that all the processing power is used to compress the archive very quickly. You may also want to use all the logical processors but one for that task so that the system stays responsive for other applications. -c password, --cryptpass=password Encrypt/decrypt data in archive. Password length: 6 to 64 chars. You can either provide a real password or a dash ("-c -") with this option if you do not want to provide the password in the command line and you want to be prompted for a password in the terminal instead. EXAMPLES save only one filesystem (/dev/sda1) to an archive: fsarchiver savefs /data/myarchive1.fsa /dev/sda1 save two filesystems (/dev/sda1 and /dev/sdb1) to an archive: fsarchiver savefs /data/myarchive2.fsa /dev/sda1 /dev/sdb1 restore the first filesystem from an archive (first = number 0): fsarchiver restfs /data/myarchive2.fsa id=0,dest=/dev/sda1 restore the second filesystem from an archive (second = number 1): fsarchiver restfs /data/myarchive2.fsa id=1,dest=/dev/sdb1 restore two filesystems from an archive (number 0 and 1): fsarchiver restfs /data/arch2.fsa id=0,dest=/dev/sda1 id=1,dest=/dev/sdb1 restore a filesystem from an archive and convert it to reiserfs: fsarchiver restfs /data/myarchive1.fsa id=0,dest=/dev/sda1,mkfs=reiserfs restore a filesystem from an archive and specify extra mkfs options: fsarchiver restfs /data/myarchive1.fsa id=0,dest=/dev/sda1,mkfs=ext4,mkfsopt="-i 256" save the contents of /usr/src/linux to an archive (similar to tar): fsarchiver savedir /data/linux-sources.fsa /usr/src/linux
save a /dev/sda1 to an archive split into volumes of 680MB: fsarchiver savefs -s 680 /data/myarchive1.fsa /dev/sda1 save a filesystem and exclude all files/dirs called 'pagefile.*' fsarchiver savefs /data/myarchive.fsa /dev/sda1 --exclude='pagefile.*' exclude 'share' in both '/usr/share' and '/usr/local/share': fsarchiver savefs /data/myarchive.fsa --exclude=share absolute exclude valid for '/usr/share' but not '/usr/local/share' fsarchiver savefs /data/myarchive.fsa --exclude=/usr/share save a filesystem (/dev/sda1) to an encrypted archive: fsarchiver savefs -c mypassword /data/myarchive1.fsa /dev/sda1 extract an archive made of simple files to /tmp/extract: fsarchiver restdir /data/linux-sources.fsa /tmp/extract show information about an archive and its file systems: fsarchiver archinfo /data/myarchive2.fsa WARNING fsarchiver is still in development, don't use it for critical data yet. AUTHOR fsarchiver was written by Francois Dupoux. It is released under the GPL2 (GNU General Public License version 2). This manpage was written by Ilya Barygin and Francois Dupoux. Sans être anglophone, cette aide sera facilement compréhensible par tous. On notera l ensemble d exemples (noté,en anglais dans le texte, EXAMPLES) qui permettront à chacun de trouver un exemple propre a ses besoins. Autre exemple d utilisation : # Pour utiliser l'archive: (a adapter suivant le besoin et les noms d'archive ) # pour sauver (-j 2 ==> 2 thread / -v ==> verbose) ################################################## fsarchiver savefs /home/data2/sauvegardes-systeme/linux_01-09-13/sdd2-fsarchiver.fsa /dev/sdd2 - j 2 -v
# pour restaurer (id=0 ==> numéro d'ordre d'enregistrement de la partiton / dest ==> partion de destination / la taille de la destination peut être différente) ################################################################################## ############################################################################# fsarchiver restfs /home/data2/sauvegardes-systeme/linux_01-09-13/sdd2-fsarchiver.fsa id=0,dest=/dev/sdd2 FSarchiver avec une interface graphique Depuis peu on trouve l interface qt4-fsarchiver qui permet d utiliser fsarchiver depuis une interface graphique! L interface est également proposée en Anglais,sans parler un seul mot d anglais, chacun reconnaîtra facilement ce que signifie «Partition to save» et «Partition to restore» de plus, il y a de grandes chances que le second fasse l inverse du premier («save» comme «sauver», «sauvegarder» ). Cette interface permettra alors principalement de ne pas avoir à se soucier des options de et paramètres de la ligne de commande.
Conclusion Comme indiqué en début de document, il existe de nombreuses solutions de déploiement. Fsarchiver se présente (sauf depuis peu) pour une utilisation uniquement en ligne de commande qui pourra paraître assez compliqué de prime abord. Avec le recul «savefs» sauvegarde un système, «restfs» restore le système de fichier, «savedir» sauvegarde un dossier (directory) et «restdir»le restaure on ne peut pas dire qu il s agit des commandes les plus compliquées pouvant être rencontrées! De plus, à l utilisation il s avèrera très rapide, même les plus exigent ne peuvent pas demander mieux! $ sudo reboot
Propriété. Jean Paul Loisel 56 Rue Philippe de Girard 59160 Lomme loiseljp@club-internet.fr 07 70 32 35 67 Licence Ce document est distribué en "Public Documentation License". The contents of this Documentation are subject to the Public Documentation License. You may only use this Documentation if you comply with the terms of this License. A copy of the License is available at this mail loiseljp@club-internet.fr. The Original Documentation is " ". The Initial Writer of the Original Documentation is Jean Paul LOISEL 2014. All Rights Reserved. Contributor(s):. Portions created by are Copyright [Insert year(s)]. All Rights Reserved. (Contributor contact(s): [Insert hyperlink/alias]). The text of this chapter may differ slightly from the text of the notices in the files of the Original Documentation. You should use the text of this chapter rather than the text found in the Original Documentation for Your Modifications.