0

I want to backup my root dir with Tar but getting this error:

beende mit fehlerstatus aufgrund vorheriger fehler

In English:

Exiting with failure status due to previous errors

Here is my code:

#!/bin/bash
DATE=$(date +%Y-%m-%d-%H%M%S)
BACKUP_DIR="/mnt/disk/public/Backup"
SOURCE="/"
EXCLUDE="--exclude=/mnt/disk/public"
tar -vzcpf $BACKUP_DIR/backup-$DATE.tar.gz $SOURCE $EXCLUDE

What is the error here?

4
  • 2
    Your --exclude option might be being ignored (and parsed as a path) because it follows the source. You should move it to before the other options, i.e. tar $EXCLUDE -vzcpf ....
    – Flup
    Commented Oct 4, 2016 at 12:50
  • I have it with tar EXCLUDE... but no change. But I get the same error!
    – fteinz
    Commented Oct 4, 2016 at 14:13
  • 5
    What other error messages is tar displaying? You may need to exclude some pseudo-filesystems such as /sys, /proc, and /dev. Commented Oct 4, 2016 at 16:16
  • The answer depends on what the full output on stdout and stderr is.
    – Alexander
    Commented Jul 11, 2017 at 14:45

1 Answer 1

0

The error means that tar is unable to add some files to the tarball.

In fact you are backing up everything from / which is certain to result to an error.

Try to replace the EXCLUDE variable with this:

EXCLUDE="--exclude=dev --exclude=mnt --exclude=proc --exclude=run --exclude=sys --exclude=tmp"

and omit the -v flag so you can reduce the amount of output messages and pinpoint the error.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .