Backup: Difference between revisions

From My Mnemonic Rhyme
Jump to navigation Jump to search
>Homaar
 
(No difference)

Latest revision as of 14:29, 8 March 2016

TAR

tar -cvpzf /backup/backup$(date +%d%m%y).tar.gz --exclude=/backup --exclude=/proc --exclude=/dev --exclude=/sys --exclude=/mnt --exclude=/lost+found --exclude=/tmp  --exclude=/mnt --exclude=/var/lib--exclude=/var/tmp --exclude=/run /

ftplicity bzw. duply

ALTE VERSION VON HEISE:

1.) Downloaden, entpacken und und dupy nach /usr/local/bin/ verschieben.

1.1.) ggf. Firewall anpassen

ufw allow from 127.0.0.1 to 178.254.4.154 port 21

1.2.) benötigte Pakete installieren

apt-get install ncftp duplicity

2.) Profil anlegen

#: duply full create

Congratulations. You just created the profile 'full'.
The initial config file has been created as 
'/root/.duply/full/conf'.
You should now adjust this config file to your needs.

IMPORTANT:
  Copy the _whole_ profile folder after the first backup to a safe place.
  It contains everything needed to restore your backups. You will need 
  it if you have to restore the backup from another system (e.g. after a 
  system crash). Keep access to these files restricted as they contain 
  _all_ informations (gpg data, ftp data) to access and modify your backups.

  Repeat this step after _all_ configuration changes. Some configuration 
  options are crucial for restoration.

3.) /root/.duply/full/conf anpassen

GPG_PW='static_key'
TARGET='ftp://user:pass@backup.1blu.de:21'
SOURCE='/'
MAX_AGE=1W
MAX_FULL_BACKUPS=3
MAX_FULLS_WITH_INCRS=1

4.) /root/.duply/full/exclude anpassen

:~# cat .duply/full/exclude 
# although called exclude, this file is actually a globbing file list
# duplicity accepts some globbing patterns, even including ones here
# here is an example, this incl. only 'dir/bar' except it's subfolder 'foo'
# - dir/bar/foo
# + dir/bar
# - **
# for more details see duplicity manpage, section File Selection
# http://duplicity.nongnu.org/duplicity.1.html#sect9
+ /home
+ /etc
+ /var/www
+ /root
- **

5.) Full Backup

duply full backup

6.) Cronjobs

#daily ftp backup
00 4 * * * root duply full pre_full_post
00 5 * * * root duply full backup_verify_purge --force

Sehr alt / nicht brauchbar ;-)

Sichern:

1. #> cp -ax / /irgendwo/Backup
2. #> tar -cvlpzf /irgendwo/Backup.tar.gz /
(statt z: j = bzip2, Z = compress)
3. #> dump -0u -f /irgendwo/Backup.dump /
(-0u: das ist eine Null, kein großes O)

Wiederherstellen:

1. #> cp -ax /irgendwo/Backup /
2. #> tar -xvzpf /irgendwo/Backup.tar.gz
3. #> restore -rf /irgendwo/Backup.dump

siehe auch:
#> man cp
#> man tar
#> man dump
#> man restore

Grundsätzlich würde ich Dir dump/restore empfehlen, wenn Du nix anderes als ext2/3 sichern mußt.

Ganze Maschine sichern

Achtung auf Ausschlüsse aufpassen!

tar cvpzf backup.tgz --exclude=/proc --exclude=/dev --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /

tar --atime-preserve --ignore-failed-read --numeric-owner --same-owner --exclude=sysbackup-25.01.2006.tar.bz2 -cjlvpf sysbackup-25.01.2006.tar.bz2 ./