Hallo!
Ich hab mich seit dem Sargerelease dazu entschieden, Debian auch zuhause als Desktopsystem zu benutzen. Soweit installiert und tut schon ganz prächtig.
Nun die Frage - da ich öfters mal am System rumspiel (und nicht immer genau weiß was ich verbreche) würd ich gerne Backups vom kompletten System machen, nen Platz auf ner extra Partition könnt ich freimachen (FAT32).
Bedingung ist einfaches Recovery ohne Neuinstallation etc.
Gruß Dani
PS: Wie kann ich denn ein einzelnes Archiv mit nem Passwort versehen per Script? Zip kann ich nich mit nem < password.txt versehen.
Linuxbackup lokal
Re: Linuxbackup lokal
Ich verwende folgendes Skript. Mit Verschlüsselung, mit Dateiname-Rotation, mit Kopieren auf FTP Server, dennoch simpel genug, dass es fehlerfrei funktioniert.
dies hier kommt in /etc/cron.daily:
und das hier ist das Skript /root/bin/backup:
Dieses File sagt, welche files nicht gesichert werden brauchen (/etc/backup.skip):
dies hier kommt in /etc/cron.daily:
Code: Select all
#!/bin/bash
PARAMS="/backup /chroot /etc /home /opt /var"
DAY=`date +%d`
WEEKDAY=`date +%w`
if [ "${DAY}" = "01" ]; then
/root/bin/backup monthly ${PARAMS}
elif [ "${WEEKDAY}" = "0" ]; then
/root/bin/backup weekly ${PARAMS}
else
/root/bin/backup daily ${PARAMS}
fi
Code: Select all
#!/bin/bash
#
# Funktionsprinzip:
# Skript legt ein Timestampfile an: daily, weekly, monthly oder full
# Beim naechsten Backup werden dann alle files gesichert, die seit dem letzten
# uebergeordneten Timestamp geaendert wurden.
# D.h. backup daily ... sichert alles, was sich seit dem letzten neuesten weekly, monthly
# oder full backup geaendert hat.
if [ $# -lt 3 ]; then
echo Usage:
echo $0 '{daily | weekly | monthly | full} destination_dir list_of_directories'
exit 1
fi
TYPE=$1
shift
BACKUPDIR=$1
shift
DIRLIST=$*
BACKUPSTATEDIR=/var/state/backup # hier werden die timestamps abgelegt
COMPRESS="gzip --best" # auch bzip2 moeglich fuer noch bessere Komprimierung oder cat fuer gar keine
CRYPT="mcrypt -k geheim"
POSTFIX=.cpio.gz.mc # anhaengsel an Dateiname
SKIPFILE=/etc/backup.skip
# evtl BACKUPSTATEDIR erzeugen
if [ ! -d "${BACKUPSTATEDIR}" ]; then
mkdir -p "${BACKUPSTATEDIR}"
fi
if [ ! -d "${BACKUPSTATEDIR}" ]; then
echo Problem creating ${BACKUPSTATEDIR}
exit 1
fi
if [ ! -d "${BACKUPDIR}" ]; then
echo ${BACKUPDIR} does not exist or is not a directory
exit 1
fi
# in Abhaengigkeit vom Backup Type das Timestampfile bestimmen.
# immer das neueste nehmen
if [ "${TYPE}" = "daily" ]; then
TIMESTAMPFILE=`ls -t "${BACKUPSTATEDIR}/weekly"
"${BACKUPSTATEDIR}/monthly"
"${BACKUPSTATEDIR}/full"
2>/dev/null | head -1`
DATE=`date "+%d"`
elif [ "${TYPE}" = "weekly" ]; then
TIMESTAMPFILE=`ls -t "${BACKUPSTATEDIR}/monthly"
"${BACKUPSTATEDIR}/full"
2>/dev/null | head -1`
DATE=`date "+%V"`
elif [ "${TYPE}" = "monthly" ]; then
TIMESTAMPFILE=`ls -t "${BACKUPSTATEDIR}/full"
2>/dev/null | head -1`
DATE=`date "+%m"`
fi
if [ -z "${TYPE}" ]; then
TYPE=full
fi
# sollte es noch gar kein Timestampfile geben, dann ein full backup machen
if [ -z "${TIMESTAMPFILE}" -o "${TYPE}" = "full" ]; then
TIMESTAMPFILE="${BACKUPSTATEDIR}/full"
TIMESTAMPCMD=
TYPE=full
# DATE=`date "+%Y_%m_%d"`
DATE=
else
TIMESTAMPCMD="-newer ${TIMESTAMPFILE}"
fi
# Timestampfile: alle Dateien, die ab jetzt erzeugt oder geaendert werden, werden beim
# *naechsten* Backup gesichert.
touch $BACKUPSTATEDIR/now
# Liste aller Dateien erstellen, die neuer als das Timestampfile sind
# falls ${TIMESTAMPCMD} leer ist, werden alle Dateien gelistet
find ${DIRLIST} ${TIMESTAMPCMD} -depth | grep -E -v -f "${SKIPFILE}" > "${BACKUPSTATEDIR}/${TYPE}${DATE}.files"
# das Backup ausfuehren
BACKUPFILE="${BACKUPDIR}/${TYPE}${DATE}${POSTFIX}"
echo -n "Backup: ${BACKUPFILE}; "
( cat "${BACKUPSTATEDIR}/${TYPE}${DATE}.files" | cpio -o -H newc | ${COMPRESS} | ${CRYPT} > "${BACKUPFILE}" ) 2>&1
# Timestampfile *dieses* Backups erzeugen
mv "${BACKUPSTATEDIR}/now" "${BACKUPSTATEDIR}/${TYPE}"
ncftpput -u username -p passwort backup00.serverkompetenz.de /server2 "${BACKUPFILE}"
Code: Select all
^/backup/
^/chroot/mysql/tmp/
^/chroot/mysql/var/db/
^/chroot/mysql/var/tmp/
^/chroot/web/opt/jakarta-tomcat[0-9.-]*/webapps/*
^/chroot/web/opt/jakarta-tomcat[0-9.-]*/work/
^/chroot/web/opt/jakarta-tomcat[0-9.-]*/logs/
^/chroot/web/proc/
^/chroot/web/tmp/
^/chroot/web/var/tmp/
^/home/
^/lost+found
^/mnt/
^/proc/
^/tmp/
^/var/cache/
^/var/state/
^/var/tmp/
Re: Linuxbackup lokal
Das hört sich stark von Rootserver nach lokal an. Ich suche eher etwas um das Lokale OS zu sichern und leicht wieder herstellen zu können. Also das Thema Rootserver mal außen vor :D
Re: Linuxbackup lokal
partimage + gpg
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
