Liebes Forum, ich möchte für ein externes Backup (USB) von zwei Borg-Repositories das Script aus dem Wiki Backup mit RSYNC verwenden, Leider funktioniert es hinten und vorne nicht. Das Umfeld ist: HD (gpt/ext4) von localhost(Kubuntu 20.04), USB-Laufwerk (gpt/ext4) via USB 3 angedockt, HD (gpt/ext4) via SSH (Ubuntu Server 20.04). HD von localhost und USB sind gemountet via /media/sabe/.. und haben den gleichen Owner. Das Skript ist hat folgende Berechtigung: 600. Es ist so angepasst:
# Simple backup with rsync # local-mode, tossh-mode, fromssh-mode SOURCES=(/media/sabe/BackUp/rechner1_backup/borg laika@192.168.120.xx:/media/hd_backup/server_backup/borg ) TARGET="/media/sabe/Verbatim" # edit or comment with "#" #LISTPACKAGES=listdebianpackages # local-mode and tossh-mode MONTHROTATE=monthrotate # use DD instead of YYMMDD RSYNCCONF=(--delete) MOUNTPOINT="/media/sabe/Verbatim" # check local mountpoint MAILREC="backup@meinedomain" SSHUSER="laika" FROMSSH="192.168.120.xx" #TOSSH="tossh-server" SSHPORT=22 ### do not edit ### MOUNT="/bin/mount"; FGREP="/bin/fgrep"; SSH="/usr/bin/ssh" LN="/bin/ln"; ECHO="/bin/echo"; DATE="/bin/date"; RM="/bin/rm" DPKG="/usr/bin/dpkg"; AWK="/usr/bin/awk"; MAIL="/usr/bin/mail" CUT="/usr/bin/cut"; TR="/usr/bin/tr"; RSYNC="/usr/bin/rsync" LAST="last"; INC="--link-dest=$TARGET/$LAST" LOG=$0.log $DATE > $LOG if [ "${TARGET:${#TARGET}-1:1}" != "/" ]; then TARGET=$TARGET/ fi if [ "$LISTPACKAGES" ] && [ -z "$FROMSSH" ]; then $ECHO "$DPKG --get-selections | $AWK '!/deinstall|purge|hold/'|$CUT -f1 | $TR '\n' ' '" >> $LOG $DPKG --get-selections | $AWK '!/deinstall|purge|hold/'|$CUT -f1 |$TR '\n' ' ' >> $LOG 2>&1 fi if [ "$MOUNTPOINT" ]; then MOUNTED=$($MOUNT | $FGREP "$MOUNTPOINT"); fi if [ -z "$MOUNTPOINT" ] || [ "$MOUNTED" ]; then if [ -z "$MONTHROTATE" ]; then TODAY=$($DATE +%y%m%d) else TODAY=$($DATE +%d) fi if [ "$SSHUSER" ] && [ "$SSHPORT" ]; then S="$SSH -p $SSHPORT -l $SSHUSER"; fi for SOURCE in "${SOURCES[@]}" do if [ "$S" ] && [ "$FROMSSH" ] && [ -z "$TOSSH" ]; then $ECHO "$RSYNC -e \"$S\" -avR \"$FROMSSH:$MOUNTPOINT$SOURCE\" ${RSYNCCONF[@]} $TARGET$TODAY $INC" >> $LOG $RSYNC -e "$S" -avR "$FROMSSH:\"$MOUNTPOINT$SOURCE\"" "${RSYNCCONF[@]}" "$TARGET"$TODAY $INC >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi fi if [ "$S" ] && [ "$TOSSH" ] && [ -z "$FROMSSH" ]; then $ECHO "$RSYNC -e \"$S\" -avR \"$MOUNTPOINT$SOURCE\" ${RSYNCCONF[@]} \"$TOSSH:$TARGET$TODAY\" $INC " >> $LOG $RSYNC -e "$S" -avR "$MOUNTPOINT$SOURCE" "${RSYNCCONF[@]}" "$TOSSH:\"$TARGET\"$TODAY" $INC >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi fi if [ -z "$S" ]; then $ECHO "$RSYNC -avR \"$MOUNTPOINT$SOURCE\" ${RSYNCCONF[@]} $TARGET$TODAY $INC" >> $LOG $RSYNC -avR "$MOUNTPOINT$SOURCE" "${RSYNCCONF[@]}" "$TARGET"$TODAY $INC >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi fi done if [ "$S" ] && [ "$TOSSH" ] && [ -z "$FROMSSH" ]; then $ECHO "$SSH -p $SSHPORT -l $SSHUSER $TOSSH $LN -nsf $TARGET$TODAY $TARGET$LAST" >> $LOG $SSH -p $SSHPORT -l $SSHUSER $TOSSH "$LN -nsf \"$TARGET\"$TODAY \"$TARGET\"$LAST" >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi fi if ( [ "$S" ] && [ "$FROMSSH" ] && [ -z "$TOSSH" ] ) || ( [ -z "$S" ] ); then $ECHO "$LN -nsf $TARGET$TODAY $TARGET$LAST" >> $LOG $LN -nsf "$TARGET"$TODAY "$TARGET"$LAST >> $LOG 2>&1 if [ $? -ne 0 ]; then ERROR=1 fi fi else $ECHO "$MOUNTPOINT not mounted" >> $LOG ERROR=1 fi $DATE >> $LOG if [ -n "$MAILREC" ]; then if [ $ERROR ];then $MAIL -s "Error Backup $LOG" $MAILREC < $LOG else $MAIL -s "Backup $LOG" $MAILREC < $LOG fi fi
Das Ergebnis ist deprimierend:
Mi 20. Okt 22:49:43 CEST 2021 /usr/bin/rsync -e "/usr/bin/ssh -p 22 -l lynvia" -avR "192.168.120.xx:/media/sabe/Verbatim/media/sabe/BackUp/rechner1_backup" --delete /media/sabe/Verbatim/20 --link-dest=/media/sabe/Verbatim/last Warning: Permanently added '192.168.120.xx' (ECDSA) to the list of known hosts. receiving incremental file list rsync: link_stat "/media/sabe/Verbatim/media/sabe/BackUp/rechner1_backup" failed: No such file or directory (2) sent 8 bytes received 126 bytes 4.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1677) [Receiver=3.1.3] rsync: [Receiver] write error: Broken pipe (32) /usr/bin/rsync -e "/usr/bin/ssh -p 22 -l lynvia" -avR "192.168.120.xx:/media/sabe/Verbatimlaikaa@192.168.120.xx:/media/hd_backup/server_backup_borg" --delete /media/sabe/Verbatim/20 --link-dest=/media/sabe/Verbatim/last receiving incremental file list rsync: link_stat "/media/sabe/Verbatimlaika@192.168.120.xx:/media/hd_backup/server_backup_borg" failed: No such file or directory (2) sent 8 bytes received 146 bytes 7.16 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1677) [Receiver=3.1.3] rsync: [Receiver] write error: Broken pipe (32) /bin/ln -nsf /media/sabe/Verbatim/20 /media/sabe/Verbatim/last Mi 20. Okt 22:50:37 CEST 2021
Es scheint überhaupt nichts zu funktionieren außer das Mailen. Wo kann ich anfangen? Ist das Skript überhaupt in der Lage parallel sowohl von localhost, als auch von SSH-Server Backups zu transferieren? Hat jemand einen Tipp? Bin um jeden Rat dankbar! Joon