Backup » Historique » Version 11
Laurent GUERBY, 14/04/2016 17:29
1 | 3 | Laurent GUERBY | {{>toc}} |
---|---|---|---|
2 | 1 | Laurent GUERBY | |
3 | 1 | Laurent GUERBY | h1. Backup |
4 | 1 | Laurent GUERBY | |
5 | 1 | Laurent GUERBY | h2. Liens |
6 | 1 | Laurent GUERBY | |
7 | 1 | Laurent GUERBY | * [[Backup_infra]] |
8 | 1 | Laurent GUERBY | * [[Apt_Backports_TTNN]] borg debian packaging |
9 | 6 | Laurent GUERBY | * https://www.reddit.com/r/linux/comments/42feqz/i_asked_here_for_the_optimal_backup_solution_and/ |
10 | 1 | Laurent GUERBY | |
11 | 1 | Laurent GUERBY | h2. BackupPC |
12 | 1 | Laurent GUERBY | |
13 | 1 | Laurent GUERBY | * http://backuppc.sourceforge.net/ |
14 | 1 | Laurent GUERBY | |
15 | 1 | Laurent GUERBY | h2. Attic |
16 | 1 | Laurent GUERBY | |
17 | 1 | Laurent GUERBY | * https://attic-backup.org/ |
18 | 1 | Laurent GUERBY | * https://lists.tetaneutral.net/pipermail/technique/2015-September/001971.html |
19 | 1 | Laurent GUERBY | ** Logiciel de backup : choix de attic |
20 | 1 | Laurent GUERBY | |
21 | 1 | Laurent GUERBY | h2. Borg |
22 | 1 | Laurent GUERBY | |
23 | 1 | Laurent GUERBY | * https://github.com/borgbackup |
24 | 1 | Laurent GUERBY | * http://readthedocs.org/projects/borgbackup/ |
25 | 2 | Laurent GUERBY | * http://puppet.tetaneutral.net/pool/main/b/borgbackup/ |
26 | 2 | Laurent GUERBY | * http://puppet.tetaneutral.net/dists/ |
27 | 1 | Laurent GUERBY | |
28 | 11 | Laurent GUERBY | h2. Borg script |
29 | 11 | Laurent GUERBY | |
30 | 11 | Laurent GUERBY | Pour une machine qui va etre eteinte et rallumée de maniere non controlable. |
31 | 11 | Laurent GUERBY | |
32 | 11 | Laurent GUERBY | <pre> |
33 | 11 | Laurent GUERBY | # crontab -l |
34 | 11 | Laurent GUERBY | @reboot /root/cron-borg.sh |
35 | 11 | Laurent GUERBY | |
36 | 11 | Laurent GUERBY | |
37 | 11 | Laurent GUERBY | |
38 | 11 | Laurent GUERBY | # cat /root/cron-borg.sh |
39 | 11 | Laurent GUERBY | #!/bin/bash |
40 | 11 | Laurent GUERBY | export LANG=en_US.UTF-8 |
41 | 11 | Laurent GUERBY | mkdir -p /root/borg >& /dev/null |
42 | 11 | Laurent GUERBY | |
43 | 11 | Laurent GUERBY | sleep 300 |
44 | 11 | Laurent GUERBY | echo === start === $(date) >> /root/borg/cron.log |
45 | 11 | Laurent GUERBY | |
46 | 11 | Laurent GUERBY | NICK=myhost |
47 | 11 | Laurent GUERBY | REPO=ssh://USER@MACHINE:PORT/some/where/borg/${NICK}-repo |
48 | 11 | Laurent GUERBY | export BORG_PASSPHRASE=lalalala |
49 | 11 | Laurent GUERBY | |
50 | 11 | Laurent GUERBY | if [ -f /root/borg/stamp ]; then |
51 | 11 | Laurent GUERBY | STAMP=$(cat /root/borg/stamp) |
52 | 11 | Laurent GUERBY | borg break-lock $REPO |
53 | 11 | Laurent GUERBY | else |
54 | 11 | Laurent GUERBY | STAMP=$(date '+%Y%m%dT%H%M%S') |
55 | 11 | Laurent GUERBY | if [ -f /root/borg/previous-stamp ]; then |
56 | 11 | Laurent GUERBY | PREVIOUS_STAMP=$(cat /root/borg/previous-stamp) |
57 | 11 | Laurent GUERBY | if [ "${STAMP%T*}" = "${PREVIOUS_STAMP%T*}" ]; then |
58 | 11 | Laurent GUERBY | echo === delay === $(date) >> /root/borg/cron.log |
59 | 11 | Laurent GUERBY | exit 0 |
60 | 11 | Laurent GUERBY | fi |
61 | 11 | Laurent GUERBY | fi |
62 | 11 | Laurent GUERBY | echo $STAMP > /root/borg/stamp |
63 | 11 | Laurent GUERBY | fi |
64 | 11 | Laurent GUERBY | |
65 | 11 | Laurent GUERBY | |
66 | 11 | Laurent GUERBY | borg create --compression lz4 --stats --verbose --exclude /root/borg --exclude-caches --one-file-system ${REPO}::${NICK}-$STAMP / >> /root/borg/log-$STAMP 2>> /root/borg/err-$STAMP |
67 | 11 | Laurent GUERBY | |
68 | 11 | Laurent GUERBY | if [ $? -eq 0 ]; then |
69 | 11 | Laurent GUERBY | mv -f /root/borg/stamp /root/borg/previous-stamp >& /dev/null |
70 | 11 | Laurent GUERBY | rm -f /root/borg/stamp >& /dev/null |
71 | 11 | Laurent GUERBY | fi |
72 | 11 | Laurent GUERBY | |
73 | 11 | Laurent GUERBY | |
74 | 11 | Laurent GUERBY | echo === done === $(date) >> /root/borg/cron.log |
75 | 11 | Laurent GUERBY | </pre> |
76 | 11 | Laurent GUERBY | |
77 | 1 | Laurent GUERBY | h2. Migration Attic vers Borg |
78 | 1 | Laurent GUERBY | |
79 | 7 | Laurent GUERBY | * https://github.com/borgbackup/borg/pull/231 |
80 | 4 | Mehdi Abaakouk | * old: https://chiliproject.tetaneutral.net/projects/git-tetaneutral-net/repository/puppet-backup |
81 | 4 | Mehdi Abaakouk | * new: https://chiliproject.tetaneutral.net/projects/git-tetaneutral-net/repository/puppetmaster/revisions/master/entry/modules/ttnn/manifests/backup.pp |
82 | 1 | Laurent GUERBY | ** git history BackupPC => Attic => Borg |
83 | 1 | Laurent GUERBY | |
84 | 4 | Mehdi Abaakouk | <pre> |
85 | 5 | Laurent GUERBY | # apt-get -t jessie-backports install borgbackup |
86 | 4 | Mehdi Abaakouk | $ cd /backup/attic/ |
87 | 4 | Mehdi Abaakouk | $ borg upgrade <repo> |
88 | 4 | Mehdi Abaakouk | $ borg check --repair <repo> |
89 | 4 | Mehdi Abaakouk | $ mv <repo> ../borg/ |
90 | 4 | Mehdi Abaakouk | $ chown -R backupinfra: /backup/borg/<repo> |
91 | 4 | Mehdi Abaakouk | </pre> |
92 | 4 | Mehdi Abaakouk | |
93 | 8 | Laurent GUERBY | Dans le module puppet, le changement le plus important est le parametre compression explicite pour correspondre au défaut de attic create : |
94 | 4 | Mehdi Abaakouk | |
95 | 4 | Mehdi Abaakouk | <pre> |
96 | 8 | Laurent GUERBY | attic create ... <repo> -> borg create --compression zlib,6 ... <repo> |
97 | 4 | Mehdi Abaakouk | </pre> |
98 | 4 | Mehdi Abaakouk | |
99 | 4 | Mehdi Abaakouk | Sinon le prochain backup sera non compressé, et aucun nouveau chucks ne correspondra aux anciens -> perte de la dedup. "zlib,6" étant le niveau de compression de attic. |
100 | 9 | Laurent GUERBY | |
101 | 9 | Laurent GUERBY | https://github.com/jborg/attic/issues/299 |
102 | 10 | Laurent GUERBY | http://borgbackup.readthedocs.org/en/stable/usage.html#environment-variables |
103 | 9 | Laurent GUERBY | <pre> |
104 | 9 | Laurent GUERBY | export ATTIC_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes |
105 | 9 | Laurent GUERBY | </pre> |