Outils pour utilisateurs

Outils du site


informatique:installation_d_obnam

Installation d'Obnam

Obnam n'est plus maintenu : https://blog.liw.fi/posts/2017/08/13/retiring_obnam/ !!!

⇒ Migration à faire vers Borg

Présentation

TO DO

Installation

Je vais suivre le tutoriel sur le site d'obnam.org. On commence par installer, dans mon cas sur Debian8 - Jessie :

# apt-get install obnam

Cliquez pour afficher ⇲

Cliquez pour masquer ⇱

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  fuse libfuse2 python-cliapp python-crypto python-ecdsa python-fuse python-larch
  python-paramiko python-six python-tracing python-ttystatus
Suggested packages:
  libjs-query libjs-underscore python-crypto-dbg python-crypto-doc libjs-jquery
The following NEW packages will be installed:
  fuse libfuse2 obnam python-cliapp python-crypto python-ecdsa python-fuse python-larch
  python-paramiko python-six python-tracing python-ttystatus
0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,686 kB of archives.
After this operation, 5,382 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://ftp.debian.org/debian/ jessie/main libfuse2 amd64 2.9.3-15+deb8u2 [135 kB]
Get:2 http://ftp.debian.org/debian/ jessie/main fuse amd64 2.9.3-15+deb8u2 [70.7 kB]
Get:3 http://ftp.debian.org/debian/ jessie/main python-tracing all 0.8-1 [33.8 kB]
Get:4 http://ftp.debian.org/debian/ jessie/main python-cliapp all 1.20140719-1 [80.8 kB]
Get:5 http://ftp.debian.org/debian/ jessie/main python-larch all 1.20131130-1 [78.4 kB]
Get:6 http://ftp.debian.org/debian/ jessie/main python-ttystatus all 0.23-1 [15.1 kB]
Get:7 http://ftp.debian.org/debian/ jessie/main python-crypto amd64 2.6.1-5+deb8u1 [256 kB]
Get:8 http://ftp.debian.org/debian/ jessie/main python-six all 1.8.0-1 [12.6 kB]
Get:9 http://ftp.debian.org/debian/ jessie/main python-ecdsa all 0.11-1 [35.1 kB]
Get:10 http://ftp.debian.org/debian/ jessie/main python-paramiko all 1.15.1-1 [107 kB]
Get:11 http://ftp.debian.org/debian/ jessie/main python-fuse amd64 2:0.2.1-10 [40.2 kB]
Get:12 http://ftp.debian.org/debian/ jessie/main obnam amd64 1.8-1 [822 kB]
Fetched 1,686 kB in 0s (5,055 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libfuse2:amd64.
(Reading database ... 15238 files and directories currently installed.)
Preparing to unpack .../libfuse2_2.9.3-15+deb8u2_amd64.deb ...
Unpacking libfuse2:amd64 (2.9.3-15+deb8u2) ...
Selecting previously unselected package fuse.
Preparing to unpack .../fuse_2.9.3-15+deb8u2_amd64.deb ...
Unpacking fuse (2.9.3-15+deb8u2) ...
Selecting previously unselected package python-tracing.
Preparing to unpack .../python-tracing_0.8-1_all.deb ...
Unpacking python-tracing (0.8-1) ...
Selecting previously unselected package python-cliapp.
Preparing to unpack .../python-cliapp_1.20140719-1_all.deb ...
Unpacking python-cliapp (1.20140719-1) ...
Selecting previously unselected package python-larch.
Preparing to unpack .../python-larch_1.20131130-1_all.deb ...
Unpacking python-larch (1.20131130-1) ...
Selecting previously unselected package python-ttystatus.
Preparing to unpack .../python-ttystatus_0.23-1_all.deb ...
Unpacking python-ttystatus (0.23-1) ...
Selecting previously unselected package python-crypto.
Preparing to unpack .../python-crypto_2.6.1-5+deb8u1_amd64.deb ...
Unpacking python-crypto (2.6.1-5+deb8u1) ...
Selecting previously unselected package python-six.
Preparing to unpack .../python-six_1.8.0-1_all.deb ...
Unpacking python-six (1.8.0-1) ...
Selecting previously unselected package python-ecdsa.
Preparing to unpack .../python-ecdsa_0.11-1_all.deb ...
Unpacking python-ecdsa (0.11-1) ...
Selecting previously unselected package python-paramiko.
Preparing to unpack .../python-paramiko_1.15.1-1_all.deb ...
Unpacking python-paramiko (1.15.1-1) ...
Selecting previously unselected package python-fuse.
Preparing to unpack .../python-fuse_2%3a0.2.1-10_amd64.deb ...
Unpacking python-fuse (2:0.2.1-10) ...
Selecting previously unselected package obnam.
Preparing to unpack .../archives/obnam_1.8-1_amd64.deb ...
Unpacking obnam (1.8-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libfuse2:amd64 (2.9.3-15+deb8u2) ...
Setting up fuse (2.9.3-15+deb8u2) ...
update-initramfs: deferring update (trigger activated)
Setting up python-tracing (0.8-1) ...
Setting up python-cliapp (1.20140719-1) ...
Setting up python-larch (1.20131130-1) ...
Setting up python-ttystatus (0.23-1) ...
Setting up python-crypto (2.6.1-5+deb8u1) ...
Setting up python-six (1.8.0-1) ...
Setting up python-ecdsa (0.11-1) ...
Setting up python-paramiko (1.15.1-1) ...
Setting up python-fuse (2:0.2.1-10) ...
Setting up obnam (1.8-1) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Processing triggers for initramfs-tools (0.120+deb8u2) ...

Configuration

On peut faire un fichier de configuration, il est optionnel mais permet de ne pas retaper tous les arguments à chaque fois.

# vim ~/.obnam.conf
 
# cat ~/.obnam.conf 
[config]
repository = /mnt/bkp/
log = /var/log/obnam.log

Tests de backups

Premier backup

On peut sauvegarder tout le home d'un utilisateur, par exemple :

# obnam backup --repository="/mnt/bkp/" /home/simon/
Backed up 14245 files (of 14245 found), uploaded 218.0 MiB in 1h11m11s at 52.4 KiB/s average speed

(Le dossier /mnt/bkp/ est un montage via sshfs, ça ralenti le backup!)

# cd /mnt/bkp/
/mnt/bkp# obnam generations
2	2017-02-19 18:19:12 .. 2017-02-19 19:29:43 (14245 files, 236801863 bytes) 

On peut lancer un autre backup sans rien changer, juste pour voir. Ça va très vite!

# obnam backup --repository="/mnt/bkp/" /home/simon/
Backed up 0 files (of 14245 found), uploaded 0.0 B in 56s at 0.0 B/s average speed

Si on rajoute un/des fichier(s), et qu'on relance un backup :

# obnam backup --repository="/mnt/bkp/" /home/simon/
Backed up 2 files (of 14246 found), uploaded 0.0 B in 51s at 0.0 B/s average speed

On voit qu'on a plusieurs “générations” :

/mnt/bkp# obnam generations
2	2017-02-19 18:19:12 .. 2017-02-19 19:29:43 (14245 files, 236801863 bytes) 
36	2017-02-19 20:16:22 .. 2017-02-19 20:16:39 (14245 files, 236801863 bytes) 
70	2017-02-19 20:18:11 .. 2017-02-19 20:18:24 (14246 files, 236801863 bytes) 

Backup du dossier /var/www/

# obnam backup --repository="/mnt/bkp/" /var/www/
Backed up 48803 files (of 48803 found), uploaded 311.0 MiB in 4h21m3s at 20.3 KiB/s average speed
 
# ls -al /mnt/bkp/
total 32
drwxrwxr-x 1  549  549 4096 Feb 20 08:29 .
drwxr-xr-x 3 root root 4096 Feb 19 18:11 ..
drwx------ 1  549  549 4096 Feb 20 12:50 114327624274822128
drwx------ 1  549  549 4096 Feb 20 12:50 chunklist
drwx------ 1  549  549 4096 Feb 20 12:50 chunks
drwx------ 1  549  549 4096 Feb 20 12:50 chunksums
drwx------ 1  549  549 4096 Feb 20 08:29 clientlist
drwx------ 1  549  549 4096 Feb 20 08:29 metadata
 
# obnam backup --repository="/mnt/bkp/" /var/www/
Backed up 277 files (of 48987 found), uploaded 974.0 KiB in 4m31s at 3.6 KiB/s average speed

Alias et script

Alias

On peut créer un alias dans /root/.bashrc :

alias backup='obnam backup /home/mon-user/ /var/ /etc/ /autre/dossier/'

Script

TO DO

Automatisation

TO DO

Manipuler les backups

Monter les backups

root@Marvin:/home/simon# mkdir /tmp/backups
root@Marvin:/home/simon# obnam mount --to /tmp/backups
root@Marvin:/home/simon# ls -al /tmp/backups/
total 28
drwxr-xr-x 22 root root 4096 Jul  2 13:19 .
drwxrwxrwt 10 root root 4096 Jul  4 09:46 ..
drwxr-xr-x 22 root root 4096 Jun 29 19:13 23750
drwxr-xr-x 22 root root 4096 Jun 29 21:33 23830
drwxr-xr-x 22 root root 4096 Jul  2 13:19 24357
lrwxr-xr-x 22 root root 4096 Jul  2 13:19 latest -> 24357
-r--r--r-- 22 root root 4096 Jul  2 13:19 .pid

sources : https://nos-oignons.net/wiki-admin/Proc%C3%A9dures/Manipuler_les_sauvegardes/

Erreurs et problèmes rencontrés

Couldn't create lock ...

# backup 
00h00m06s 1 files 0 B scanned: locking clientERROR: R681AEX: Couldn't create lock 114327624274822128/lock: timeout
$ man obnam 
(...)
       ·      force-lock removes a lock file for a client in the repository.  You should only force a lock if you are sure no-one  is  ac‐
              cessing that client's data in the repository.  A dangling lock might happen, for example, if obnam loses its network connec‐
              tion to the backup repository.
(...)
# obnam force-lock
# backup
# backup 
00h00m12s 1 files 0 B scanned: starting new generation
(...)

À essayer

  • Faire des modifications puis restaurer et vérifier que tout est bien comme avant.
  • Envoyer le backup dans un dossier encfs pour le chiffrement.
  • Évaluer tout ce qu'on veut sauvegarder sur un serveur et mettre tout dans un script.

Sources

informatique/installation_d_obnam.txt · Dernière modification : 2020/08/09 13:03 de 127.0.0.1