HOWTO: Backuplösung mit Backup2l und FTP-Server

Backup, Restore und Transfer von Daten
rot
Posts: 45
Joined: 2004-03-20 12:44
 

HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by rot »

Hi,

ich "liebe" backup2l und konnte mich nicht damit abfinden, dass ein automatischer Abgleich mit einem FTP-Server nicht funktioniert. Rsync stand mir nicht zur Verfügung, also habe ich eine andere Lösung gefunden. Und die möchte ich Euch nicht vorenthalten. Kommentare ausdrücklich erwünscht, wenn keine Bedenken auftauchen, wäre dieses dann ein Vorschlag für die FAQ.

-----

Anleitung für SuSE 9.1, getestet auf Strato-Server, dürfte aber auch bei 1+1 & Co. funktionieren

BACKUP-LÃ?SUNG auf FTP-Server mit backup2l und sitecopy



1. backup2l installieren und einrichten
2. sitecopy installieren und einrichten
3. Cron-Job anpassen


1. backup2l installieren und einrichten
---------------------------------------

Wir arbeiten als root.

Zunächst legen wir ein Backup-Verzeichnis an:

Code: Select all

# mkdir /backup
# chmod 700 /backup
Jetzt laden wir backup2l von http://sourceforge.net/projects/backup2l/ herunter, z. B. so:

Code: Select all

# wget http://voxel.dl.sourceforge.net/sourceforge/backup2l/backup2l_1.3.tar.gz
Und installieren:

Code: Select all

# tar -xzf backup2l_1.3.tar.gz
# cd backup2l-1.3
# ./install-sh
Bitte bei allen Abfragen mit "ja" (y) antworten.

Wir bearbeiten die Konfigurationsdatei:

Code: Select all

# vi /etc/backup2l.conf
Hier nehmen wir folgende Ã?nderungen vor (< = entfernen, > = reinschreiben):

Code: Select all

Zeile 25:
< SRCLIST=(/etc /root /home /var/mail /usr/local)
> SRCLIST=(/boot /etc /home /root /var/lib/mysql /var/log /var/spool/mail /var/spool/cron /var/mail /usr/local)

Zeile 49:
< BACKUP_DIR="/disk2/backup"
> BACKUP_DIR="/backup"

Zeile 110:
< UNCONFIGURED=1
> # UNCONFIGURED=1 

2. sitecopy installieren und einrichten
---------------------------------------

Wir arbeiten nun zunächst als beschränkter Nutzer.
Aktuelle Programmversion herunterladen (zurzeit die 0.14-2):

Code: Select all

# wget http://www.lyra.org/sitecopy/sitecopy-0.14.2.tar.gz
Und installieren:

Code: Select all

# tar -xzf sitecopy-0.14.2.tar.gz
# cd sitecopy-0.14.2
# ./configure
# make
# su
# make install
Falls am Schluss Fehlermeldungen auftreten von wegen ,,t-ru.mgo nicht gefunden o. ä.: Einfach ignorieren, die Installation hat trotzdem funktioniert.

Konfigurationsdatei anlegen (wir bleiben root):

Code: Select all

# mkdir -m 700 /root/.sitecopy
# touch /root/.sitecopyrc
# chmod 600 /root/.sitecopyrc
# vi /root/.sitecopyrc
Wichtig sind die Zugriffsrechte auf diese Datei: Die sollte nur root lesen können, da der Login für den FTP-Server in Klartext steht!

Inhalt dieser Konfigurationsdatei:

Code: Select all

site backup
  server <backupserver>
  remote /backup
  local /backup
  username <nutzername>
  password <passwort>
Jetzt auf dem FTP-Server einloggen und das Verzeichnis /backup anlegen:

Code: Select all

# ftp <backupserver>
ftp> mkdir backup
ftp> bye
Jetzt initialisieren wir Sitecopy:

Code: Select all

# /usr/local/bin/sitecopy --init backup

3. Cron-Job anpassen
----------------------

Code: Select all

# vi /etc/cron.daily/zz-backup2l
Inhalt der Datei wie nachfolgend ändern:

Code: Select all

#!/bin/bash

# The following command invokes 'backup2l' with the default configuration
# file (/etc/backup2l.conf).
#
# (Re)move it or this entire script if you do not want automatic backups.
#
# Redirect its output if you do not want automatic e-mails after each backup.

PATH=$PATH:/usr/local/bin
! which backup2l > /dev/null || nice -19 backup2l -b
/usr/local/bin/sitecopy -u backup
Bzw. wenn Du keine tägliche E-Mail erhalten möchtest, die dir den Abgleich mit dem FTP-Server anzeigt (samt Status), dann:

Code: Select all

#!/bin/bash

# The following command invokes 'backup2l' with the default configuration
# file (/etc/backup2l.conf).
#
# (Re)move it or this entire script if you do not want automatic backups.
#
# Redirect its output if you do not want automatic e-mails after each backup.

PATH=$PATH:/usr/local/bin
! which backup2l > /dev/null || nice -19 backup2l -b
/usr/local/bin/sitecopy -u backup > /dev/null

Nun wird jede Nacht (bei Strato gegen 4:14 Uhr) ein Backup angelegt und der Backup-Server mit dem Backup synchronisiert (d. h. neue Dateien hochgeladen, obsolete Dateien werden automatisch gelöscht).
piero
Posts: 12
Joined: 2004-02-10 00:57
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by piero »

schöner ansatz :)

auf debian systemen ab sarge (testing) kann man sich das installieren per hand ersparen:

Code: Select all

apt-get install backup2l sitecopy
sollte alles notwendige installieren.

mir geht vor allem das stoppen/starten der datenbank server ab.
vor einem backup sollte die datenbank auf jedenfall gestoppt werden, da es sonst leicht passieren kann das dein backup unbrauchbar ist.

ich stoppe das mail system auch da es bei mir auf mysql basiert (seine userdaten daraus authentifiziert) .. stoppt man die datenbank obwohl postfix läuft und jemand kommt auf die idee eine mail zu versenden oder zu empfangen gibts ansonsten ärger ..

hierzu folgende sektionen wie folgt abändern /etc/backup2l.conf:
(auf debian systemen ..)

Code: Select all

PRE_BACKUP ()
{
    echo "  running pre-backup:"

    # On a Debian system, the following statements dump a machine-readable list
of
    # all installed packages to a file.
    echo "  writing dpkg selections to /root/dpkg-selections.log..."
    dpkg --get-selections | diff - /root/dpkg-selections.log > /dev/null || dpkg
 --get-selections > /root/dpkg-selections.log

    echo "   stopping mail server"
    /etc/init.d/postfix stop

    echo "   shutting down mysql and postgresql .."
    /etc/init.d/mysql stop
    /etc/init.d/postgresql stop

}

# This user-defined bash function is executed after a backup is made
POST_BACKUP ()
{
    # e. g., restart some mail/db server if its files are to be backup'ed
    #echo "  post-backup: nothing to do"

    echo  "  starting up databases (mysql and postgres)"
    /etc/init.d/mysql start
    /etc/init.d/postgresql start

    echo "   starting mail server"
    /etc/init.d/postfix start
}

[edit:
stop/start von postfix aufgrund von problemen wenn mysql nicht läuft.
dies ist IMHO nur dann notwendig wenn postfix sich mit hilfe von mysql authentifiziert.
]
Anonymous
 

Gutes HOWTO, bei mir aber ein Fehler: Value too large

Post by Anonymous »

Hallo, erstmal danke für das tolle HOWTO, ist wirklich nützlich, jedoch erhalte ich folgende eine Fehlermeldung beim entscheidenen Upload der Datendatei auf den BAckupserver per FTP:

sitecopy: Warning on `/backup/all.1.tar.gz':
Could not examine file. - Value too large for defined data type

Warum lädt er den file all.1.tar.gz nicht hoch ? ich weiss, er ist ca. 2000 MB gross, aber was nützt mir ein Backupsystem, wenn er dieses nicht hochlädt. Kurz zum System: Ist Debian Woody 3 auf einem Strato RootServer.

Weiss jemand Rat ?

Cronjob Fehlermail an Root:

Code: Select all

/etc/cron.daily/zz-backup2l:
backup2l v1.3 by Gundolf Kiefer

Thu Dec  9 06:25:08 CET 2004

Running pre-backup procedure...
  running pre-backup:
  writing dpkg selections to /root/dpkg-selections.log...
diff: /root/dpkg-selections.log: No such file or directory
   shutting down mysql and postgresql ..
Stopping MySQL database server: mysqld.

Removing old backups...

Preparing full backup <all.1>...
find: /var/spool/mail: No such file or directory
  80471 / 80471 file(s), 2510 / 2510 dir(s), 3.4GB / 3.4GB (uncompressed)
  skipping: 0 file(s), 0 dir(s), 0 B (uncompressed)

Creating archive using 'DRIVER_TAR_GZ'...
  tar: /home/www/web1/html/cbs/chat/data/chat/chatcenter.log: file changed as we read it
  tar: /home/www/web1/html/cbs/sessions/sess_5fd0881b6e599e3ce373b34a72d65dcb: Cannot stat: No such file or directory
  tar: /home/www/web1/html/cbs/sessions/sess_606c8b6ccc9abddf34c5357be0784975: Cannot stat: No such file or directory
  tar: /home/www/web1/html/cbs/sessions/sess_76c53b652784db142aa7f91d2e9c4aa4: Cannot stat: No such file or directory
  tar: /var/log/apache/rewrite.log: file changed as we read it
  tar: Error exit delayed from previous errors
Checking TOC of archive file (< real file, > archive entry)...
  45435,45436d45434
  < /home/www/web1/html/cbs/sessions/sess_5fd0881b6e599e3ce373b34a72d65dcb
  < /home/www/web1/html/cbs/sessions/sess_606c8b6ccc9abddf34c5357be0784975
  45439d45436
  < /home/www/web1/html/cbs/sessions/sess_76c53b652784db142aa7f91d2e9c4aa4
Creating check file for <all.1>...
all.1.tar.gz: File too large

Running post-backup procedure...
  starting up databases (mysql and postgres)
Starting MySQL database server: mysqld.
Checking for crashed MySQL tables in the background.

Thu Dec  9 06:35:35 CET 2004


Summary
=======

Backup       Date       Time  |  Size   | Skipped  Files+D |  New  Obs. | Err.
------------------------------------------------------------------------------
all.1        2004-12-09 06:25 |    2.1G |       0    82981 |82981     0 |    3

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda3              75G  6.5G   67G   9% /
sitecopy: Warning on `/backup/all.1.tar.gz':
Could not examine file. - Value too large for defined data type
sitecopy: Updating site `backup' (on backup.serverkompetenz.de in /backup/)
Uploading all.1.check: [..] done.
Uploading all.1.new.gz: [..............................................................................] done.
Uploading all.1.skipped.gz: [..] done.
Uploading all.1.list.gz: [..............................................................................] done.
Uploading all.1.obsolete.gz: [..] done.
Uploading all.1.error.gz: [..] done.
sitecopy: Update completed successfully.

Inhalt der sitecopyrc:

Code: Select all

site backup
server backup.serverkompetenz.de
remote /backup
local /backup
username xxxusernam
password xxxpasswort


Inhalt der backup2l.conf

Code: Select all

##################################################
# Configuration file for backup2l                #
##################################################


# Define the backup2l version for which the configuration file is written.
# This way, future versions can automatically warn if the syntax has changed.
FOR_VERSION=1.3


##################################################
# Volume identification

# This is the prefix for all output files;
# multiple volumes can be handled by using different configuration files
VOLNAME="all"



##################################################
# Source files

# List of directories to make backups of.
# All paths MUST be absolute and start with a '/'!
#SRCLIST=(/etc /root /home /var/mail /usr/local)
SRCLIST=(/boot /etc /home /root /var/lib/mysql /var/log /var/spool/mail /var/spool/cron /var/mail /usr/local)

# The following expression specifies the files not to be archived.
# See the find(1) man page for further info. It is discouraged to
# use anything different from conditions (e. g. actions) as it may have
# unforeseeable side effects.

# This example skips all files and directories with a path name containing
# '.nobackup' and all .o files:
SKIPCOND=(-path "*.nobackup*" -o -name "*.o")

# If you want to exclude several directories use the following expression:
# SKIPCOND=(-path '/path1' -o -path '/path1/*' -o -path '/path2' -o -path '/path2/*')



##################################################
# Destination

# Mount point of backup device (optional)
#BACKUP_DEV="/disk2"

# Destination directory for backups;
# it must exist and must not be the top-level of BACKUP_DEV
#BACKUP_DIR="/disk2/backup"
BACKUP_DIR="/backup"


##################################################
# Backup parameters

# Number of levels of differential backups (1..9)
MAX_LEVEL=3

# Maximum number of differential backups per level (1..9)
MAX_PER_LEVEL=8

# Maximum number of full backups (1..9)
MAX_FULL=2

# For differential backups: number of generations to keep per level;
# old backups are removed such that at least GENERATIONS * MAX_PER_LEVEL
# recent versions are still available for the respective level
GENERATIONS=1

# If the following variable is 1, a check file is automatically generated
CREATE_CHECK_FILE=1



##################################################
# Pre-/Post-backup functions

# This user-defined bash function is executed before a backup is made
PRE_BACKUP () 
{ 
    echo "  running pre-backup:" 

    # On a Debian system, the following statements dump a machine-readable list of 
    # all installed packages to a file. 
    echo "  writing dpkg selections to /root/dpkg-selections.log..." 
    dpkg --get-selections | diff - /root/dpkg-selections.log > /dev/null || dpkg  --get-selections > /root/dpkg-selections.log 


    echo "   shutting down mysql and apache .." 
    /etc/init.d/mysql stop 
    /etc/init.d/apache stop
}

    # This user-defined bash function is executed after a backup is made 
POST_BACKUP () 
{ 
    # e. g., restart some mail/db server if its files are to be backup'ed 
    #echo "  post-backup: nothing to do" 

    echo  "  starting up databases (mysql and apache)" 
    /etc/init.d/mysql start
    /etc/init.d/apache start

} 




##################################################
# Misc.

# Create a backup when invoked without arguments?
AUTORUN=0

# Size units
SIZE_UNITS=""    # set to "B", "K", "M" or "G" to obtain unified units in summary list

# Remove this line after the setup is finished.
#UNCONFIGURED=1
# UNCONFIGURED=1

# Archive driver for new backups (optional, default = "DRIVER_TAR_GZ")
# CREATE_DRIVER="DRIVER_MY_AFIOZ"



##################################################
# User-defined archive drivers (optional)

# The remainder of this file demonstrates how user-defined archive drivers can be added.
# The example shows a modified version of the "afioz" driver with some additional parameters
# one may want to pass to afio in order to tune the speed, archive size etc. .
# An archive driver consists of a bash function named
# "DRIVER_<your-driver-name>" implementing the (sometimes simple) operations "-test", "-suffix",
# "-create", "-toc", and "-extract".

# If you do not want to write your own archive driver, you can remove the remainder of this file.

# USER_DRIVER_LIST="DRIVER_MY_AFIOZ"  # uncomment to register the driver(s) below (optional)

DRIVER_MY_AFIOZ ()
{
    case $1 in
        -test)
            # This function should check whether all prerequisites are met, especially if all
            # required tools are installed. This prevents backup2l to fail in inconvenient
            # situations, e. g. during a backup or restore operation. If everything is ok, the
            # string "ok" should be returned. Everything else is interpreted as a failure.
            require_tools afio
                # The function 'require_tools' checks for the existence of all tools passed as
                # arguments. If one of the tools is not found by which(1), an error message is
                # displayed and the function does not return.
            echo "ok"
            ;;
        -suffix)
            # This function should return the suffix of backup archive files. If the driver
            #ädoes not create a file (e. g. transfers the backup data immediately to a tape
            # or network device), an empty string has to be returned. backup2l uses this suffix
            # to select a driver for unpacking. If a user-configured driver supports the same
            # suffix as a built-in driver, the user driver is preferred (as in this case).
            echo "afioz"
            ;;
        -create)        # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            # This function is called to create a backup file. The argument $3 is the full file
            # name of the archive file including path and suffix. $4 contains a list of files
            # (full pathname) to be backed up. Directories are not contained, they are handled
            # by backup2l directly without using the driver. All output to stderr should be
            # directed to stdout ("2>&1").
            afio -Zo -G 9 -M 30m -T 2k $3 < $4 2>&1
                # This line passes some additional options to afio (see afio(1)):
                # '-G 9' maximizes the compression by gzip.
                # '-M 30m' increases the size of the internal file buffer. Larger files have to
                #     be compressed twice.
                # '-T 2k' prevents the compression of files smaller than 2k in order to save time.
            ;;
        -toc)           # Arguments: $2 = BID, $3 = archive file name
            # This function is used to validate the correct generation of an archive file.
            # The output is compared to the list file passed to the '-create' function.
            # Any difference is reported as an error.
            afio -Zt $3 | sed 's#^#/#'
                # The sed command adds a leading slash to each entry.
            ;;
        -extract)       # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            # This function is called by backup2l's restore procedure for each archive.
            # It is extremely important that only those files contained in $4 are restored.
            # Otherwise it may happen that files are overwritten by incorrect (e. g. older)
            # versions of the same file.
            afio -Zinw $4 $3 2>&1
            ;;
    esac
}
[/quote]
piero
Posts: 12
Joined: 2004-02-10 00:57
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by piero »

so wie das aussieht hat er es schon hochgeladen, es ist nur eine warnung das er es nicht untersuchen konnte .. aber warum, keine ahnung ...

hab auch nen strato rootserver, aber mit sarge.

meine backup2l config was zu sichern ist:
SRCLIST=(/etc /root /home /srv /usr/local /usr/src /var/lib/mysql /var/lib/postgres)

ich habe unter /srv alle hostingsachen etc abgelegt, da ich virtuelle user habe. pass dies entsprechend an.

ich würde dir empfehlen über SKIPCOND die session directories anzugeben. diese zu sichern macht wenig sinn.

ich würde erstmal versuchen die anderen fehler von tar loszuwerden...
birdie501
Posts: 19
Joined: 2003-04-22 14:58
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by birdie501 »

Hallo,

hab das jetzt mal so installiert. Wie kann ich das denn mal maunell testen? Habe mal das sitecopy -u backup ausgeführt und dann aber nur ne Meldung erhalten, dass sich nichts geändert hätte.

Dann würde ich gerne nur Voll Backups machen. Wie muss ich das denn dann in der Konfig einstellen?

Danke.

Grüße
michaelengl
Posts: 22
Joined: 2004-04-29 23:35
 

ist die Anweisung ein Backup des kompletten Servers?

Post by michaelengl »

Hallo ROT,

ist die Anweisung ein Backup des kompletten Servers?
Eventuell auch Confixx und alle Datenbanken, oder muß nochwas beachtet werden?

Michael
willi
Posts: 24
Joined: 2004-10-26 10:28
Contact:
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by willi »

@michaelengl

Hallo,

da confixx im root-verzeichnis installiert ist (bei mir ist das so), und oben in der SRC-List /root steht, sollte auch das Confixx-Verzeichnis mit gesichert werden, ansonsten kannst du die noch von Hand in die SRC-List hinzufügen.

Willi
i6t2yc
Posts: 8
Joined: 2004-11-09 14:59
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by i6t2yc »

bin auch bei strato aber bei mir will der wohl nich so wirklich nen update machen:


# /usr/bin/sitecopy -u backup
sitecopy: Aktualisieren der Site `backup' (auf backup.serverkompetenz.de in /backup/)
sitecopy: Nichts zu tun - keine Ã?nderungen vorgefunden.
michaelengl
Posts: 22
Joined: 2004-04-29 23:35
 

Confixx OK aber alle MYSQL Daten

Post by michaelengl »

Vielen Dank, Confixx läuft unter root aber was muß gesichert werden, wenn auch die MySQL DB gesichert werden soll bei Strato bzw. gibts etwas zu beachten?

Gruss
Michael
rot
Posts: 45
Joined: 2004-03-20 12:44
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by rot »

i6T2yC wrote:# /usr/bin/sitecopy -u backup
sitecopy: Aktualisieren der Site `backup' (auf backup.serverkompetenz.de in /backup/)
sitecopy: Nichts zu tun - keine Ã?nderungen vorgefunden.
Das heißt schlichterdings, dass kein Abgleich erforderlich ist, weil die angegebenen Verzeichnisse bereits synchronisiert sind. Du kannst das ja mit ftp überprüfen.
Falls du feststellst, dass keine Synchronität herrscht, hast du irgend etwas falsch gemacht.
aysal
Posts: 15
Joined: 2005-01-16 18:15
 

sitecopy und große Dateien

Post by aysal »

Ich habe auch das Problem, dass hier (Strato) sitecopy mit einer großen backupdatei (5 GB) nicht klappen will

sitecopy: Warning on `/home/sichern/backups/filesystem/linux_full_2005-02-06.1.dar':
Konnte Datei nicht untersuchen. - Der Wert ist zu groß fÃ?Å?r den definierten Datentyp

Die Datei wird auch nicht hochgeladen.

Hat jemand eine Idee?

Ender
mchenzi
Posts: 19
Joined: 2003-03-03 08:55
Location: Würzburg
 

Probleme mit backup2l Vers. 1.4

Post by mchenzi »

Hallo ich hab mal die Backuplösung auf meinem 1und1 server installiert. Ich bekomme aber immer die Meldungen:

md5sum: write error: No space left on device

Wenn also mal einer eine antwort eis oder das selbe Problem hat wärs schön mal input zu bekommen.

Ps. auf der Platte sind ca. 3GB verbraucht von 80GB also kann ein 3GB backup nicht die Platte füllen.
Anonymous
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by Anonymous »

Hallo, wie ist es wenn es soweit ist und man möchte das ganze auf das neu aufgesetzte system zurück sichern. Wie geht man vor ???

Blöde frage aber bevor man was falsches macht lieber eine frage zu viel als zu wenig. :roll:

gruss
coco
rothgar
Posts: 8
Joined: 2003-04-07 14:10
Location: Jena
Contact:
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by rothgar »

@mchenzi

schau mal ob du nicht in eine kleine Partition schreibst:

poste mal ein " fdisk -l " und ein " mount -l " und schreibe uns mal wo du die Backups ablegst.

Martin
phpman
Posts: 66
Joined: 2003-11-02 23:06
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by phpman »

Hallo zusammen,

funktioniert diese lösung auch auf nem 1&1 RootServer hat das schon jemand getestet?

In welcher Art muss das Script geändert werden damit das Prolem mit einer Evtl. defekten mySQL Database nicht auftritt?

Gruß, PHPman
wogab
Posts: 27
Joined: 2005-02-20 15:30
Location: Dortmund
 

Backup zurückspielen

Post by wogab »

Hallo,

ich möcht´s nochmal von vorn aufgreifen:

1. ich installiere auf meinem 1und1 Server debian sarge minimalsystem.
2. ich installiere vor allem anderen die vorgenannte Backuplösung.
3. ich führe sitecopy -u backup aus.
4. nun installiere ich meine System: apache2 PHP4 und PHP5 MySql und so weiter und so weiter...
5. ich baue meine Websites auf und so weiter und so weiter.
6. immer wieder zwischen durch: sitecopy -u backup ...

Und nun der Tag X: Festplatte defekt - wird zügig ausgetauscht.
Jetzt also wieder Punkt 1. und 2. ausführen.
Dann backup zurückspielen - richtig?
Wie spiele ich das backup zurück???

MfG
Wolfgang
charlie
Posts: 78
Joined: 2002-09-30 23:36
Contact:
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by charlie »

Hi,

@wogab Na ich würde den all.*.tar endpacken da sind dann alle deine gesicherten Verzeichnisse drin.

was mir noch fehlt ist eine Verschlüsselung so das nicht jeder sofort auf das BackUp zugreifen kann, wenn es mal abhanden kommen sollte.

Es ist ja scheinbar möglich eigenen Treiber zu integrieren.
##################################################
# User-defined archive drivers (optional)

# The remainder of this file demonstrates how user-defined archive drivers can be added.
# The example shows a modified version of the "afioz" driver with some additional parameters
# one may want to pass to afio in order to tune the speed, archive size etc. .
# An archive driver consists of a bash function named
# "DRIVER_<your-driver-name>" implementing the (sometimes simple) operations "-test", "-suffix",
# "-create", "-toc", and "-extract".

# If you do not want to write your own archive driver, you can remove the remainder of this file.

# USER_DRIVER_LIST="DRIVER_MY_AFIOZ" # uncomment to register the driver(s) below (optional)

DRIVER_MY_AFIOZ ()
{
case $1 in
-test)
# This function should check whether all prerequisites are met, especially if all
# required tools are installed. This prevents backup2l to fail in inconvenient
# situations, e. g. during a backup or restore operation. If everything is ok, the
# string "ok" should be returned. Everything else is interpreted as a failure.
require_tools afio

.....
Wenn einer Ahnung von pgp oder gpg mit asymmetrischer Verschlüsselung hat, müsste man kein Passwort in der .conf hinterlegen.

mfg
charlie
mchenzi
Posts: 19
Joined: 2003-03-03 08:55
Location: Würzburg
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by mchenzi »

Lieber spät als nie. habe die Nachricht erst jetzt gesehen. Hatte keine Zeit mich um das zu kümmern.

Jetzt mal das Problem mit der größe (2 postings weiter oben)

# mount -l
/dev/hda1 on / type ext3 (rw) []
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
/dev/hda5 on /usr type xfs (rw) []
/dev/hda6 on /var type xfs (rw,usrquota) []
/dev/hda7 on /home type xfs (rw,usrquota) []
tmpfs on /tmp type tmpfs (rw)
tmpfs on /dev/shm type tmpfs (rw,size=20M)
# fdisk -l

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 66 530113+ 83 Linux
/dev/hda2 67 321 2048287+ 82 Linux swap
/dev/hda4 322 9729 75569760 5 Extended
/dev/hda5 322 959 5124703+ 83 Linux
/dev/hda6 960 1597 5124703+ 83 Linux
/dev/hda7 1598 9729 65320258+ 83 Linux


Habe heute auch eine komische email bekommen mit Returncode2. Muss jetzt mal die nächsten Tage das ganze unter Kontrolle bringen.

Danke schonmal für eure Antworten.
mchenzi
Posts: 19
Joined: 2003-03-03 08:55
Location: Würzburg
 

noch ein Problem mit Sitecopy

Post by mchenzi »

Hallo
Das mit dem Platz habe ich hinbekommen. Verzeichniss backup war natürlich nicht auf hda7 sondern hda0. Da war fast kein Platz. Ging eine Zeit bis ich mehr Daten hatte...

Jetzt bekomme ich noch eine Fehlermeldung

Code: Select all

sitecopy: Updating site `backup' (on backup89.pureserver.info in /backup/)
sitecopy: Error: Could not read response line: connection was closed by server.
Kann mir da jemand helfen??
Anonymous
 

Passwort für GZIP-Archive?

Post by Anonymous »

Hi,

erstmal vielen Dank an rot für das wirklich gute HOWTO.

Von Linux habe ich nicht viel Ahnung, konnte aber trotzdem anhand der Anleitung das Backup für unseren Webserver einrichten.

Hier wurde bereits bzgl. einer Verschlüsselung angefragt. Mir würde ein Passwort-geschütztes Archiv ausreichen. Ist es möglich, die erstellen tar.gzip-Archive mit einem Passwort zu versehen?

Danke & Grüße,

Sven
pic
Posts: 8
Joined: 2004-11-12 13:26
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by pic »

Hallo,

was genau muss ich einstellen damit ich jeden sonntag ein full backup bekomme und in der zwischen zeit halt ein differentielles.

Aufbewahrt sollen nur die full backups für 6 Wochen werden.

Bisherige Einstellung die ich auch schon ein paar mal verändert habe aber nicht zum erfolg gebracht haben

# Backup parameters

MAX_LEVEL=1
MAX_PER_LEVEL=6
MAX_FULL=8
GENERATIONS=1

Weiß jmd. Rat?
Anonymous
 

Backupdateien zu groß

Post by Anonymous »

Hier hatten ja einige das Problem mit zu großen Dateien für sitecopy.
Hier im Thread habe ich irgendwie keine Lösung gefunden und hab im Web weitergesucht.

1. Lösung
sitecopy configure ändern (empfohlen)
statt ./configure

Code: Select all

export CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
./configure
bei mir hats geholfen für dateigröße 2,8 Gb

2. Lösung (nicht getestet)
in der backup2l.conf statt dem Standard Driver den "DRIVER_TAR_GZ_SPLIT" einbinden -> siehe Kommentare in der Datei

so wie es aussieht werden die Backupfiles dann in 700MB parts gesplittet

Wenn die Backupfiles so groß sind dauert es doch eine ganze Weile bis es abgeschlossen ist und daher ist die Variante mit dem stoppen von MYSQL nicht so gut, zumindest wenn fast alle Webseiten mit Datenbanken laufen ;-)

Deshalb vieleicht besser im PRE_Backup

Code: Select all

	 mysqldump --compress -u root -p****** --all-databases > /****/mysql_backup/alle_datenbanken.sql"
und dieses Verzeichnis mit ins Backup einschließen.

Byby Landschaf
tobias111
Posts: 78
Joined: 2002-12-02 20:19
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by tobias111 »

rot wrote:Hi,



3. Cron-Job anpassen
----------------------

Code: Select all

# vi /etc/cron.daily/zz-backup2l
Inhalt der Datei wie nachfolgend ändern:

Code: Select all

#!/bin/bash

# The following command invokes 'backup2l' with the default configuration
# file (/etc/backup2l.conf).
#
# (Re)move it or this entire script if you do not want automatic backups.
#
# Redirect its output if you do not want automatic e-mails after each backup.

PATH=$PATH:/usr/local/bin
! which backup2l > /dev/null || nice -19 backup2l -b
/usr/local/bin/sitecopy -u backup
Bzw. wenn Du keine tägliche E-Mail erhalten möchtest, die dir den Abgleich mit dem FTP-Server anzeigt (samt Status), dann:

Code: Select all

#!/bin/bash

# The following command invokes 'backup2l' with the default configuration
# file (/etc/backup2l.conf).
#
# (Re)move it or this entire script if you do not want automatic backups.
#
# Redirect its output if you do not want automatic e-mails after each backup.

PATH=$PATH:/usr/local/bin
! which backup2l > /dev/null || nice -19 backup2l -b
/usr/local/bin/sitecopy -u backup > /dev/null
das versteh ich nicht ganz: an welche email-adresse wird der report geschickt, wenn ich nicht "> /dev/null" ranhänge? ich krieg nämlich an "root" nichts... am liebsten wär's mir, wenn ich eine normale email-adresse angeben könnte..
cyber-shadow
Posts: 8
Joined: 2005-08-30 11:25
 

Verschlüsselung

Post by cyber-shadow »

Ich habe mir mal einen Treiber basierend auf DRIVER_TAR_GZ_SPLIT gebaut, der das Backup gleich noch mit Hilfe eines Passworts mit AES verschlüsselt. Vielleicht kann ihn ja jemand brauchen... Oder womöglich gibt's Verbesserungsvorschläge? ;)

Code: Select all

DRIVER_TAR_GZ_AES_SPLIT ()
{
    case $1 in
        -test)
            require_tools tar split cat openssl
            echo "ok"
            ;;
        -suffix)
            echo "tgz_aes_split"
            ;;
        -create)        # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            mkdir -p ${3}
            tar cz -T $4 --no-recursion | openssl enc -aes-256-cbc -e -pass file:/root/.backup2l-pass -salt | split --bytes=725100100 - ${3}/part_
            ;;
        -toc)           # Arguments: $2 = BID, $3 = archive file name
            cat ${3}/part_* | openssl enc -aes-256-cbc -d -pass file:/root/.backup2l-pass | tar tz | sed 's#^#/#'
            ;;
        -extract)       # Arguments: $2 = BID, $3 = archive file name, $4 = file list file
            cat ${3}/part_* | openssl enc -aes-256-cbc -d -pass file:/root/.backup2l-pass | tar xz --same-permission --same-owner -T $4 2>&1
            ;;
    esac
}
Natürlich muss noch eine Datei /root/.backup2l-pass (die nur von root lesbar ist) angelegt werden, die das Passwort enthält.

EDIT: pass:Geheimes_Passwort durch file:/root/.backup2l-pass ersetzt. Erschien mir dann doch sicherer. ;)
Anonymous
 

Re: HOWTO: Backuplösung mit Backup2l und FTP-Server

Post by Anonymous »

Hallo,

erstmal Dankeschön für das tolle Tutorial es hat alles wunderbar geklappt aber nun habe ich eine kleine Frage !

1. Nach der Einrichtung des Systems (Backup und Sitecopy) habe ich keinen Neustart des Servers gemacht sind die Ã?nderungen trotzdem Aktiv !

2. Nun möchte ich die Daten des Home Verzeichnisses Sichern im moment mach ich ein .tar datei daraus und kopiere diese in den Ordner Backup und Synchronisere mit dem Backupserver, kann man das irgendwie automatisieren das er jeden abend alle daten in den backup ordnerhaut und dann Synchornisiert ?

so das wars erstmal hoffe ich wurde verstanden danke im vorraus für jede edenkliche Hilfe.

mfg
Küppers
Post Reply