Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Mar 2001 18:26:05 -0600
From:      Mike Meyer <mwm@mired.org>
To:        Juan Fco Rodriguez Hervella <jrh@it.uc3m.es>
Cc:        questions@freebsd.org
Subject:   Re: Dump
Message-ID:  <15042.33053.642556.853168@guru.mired.org>
In-Reply-To: <79130894@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help

--tzQKebTumo
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit

Juan Fco Rodriguez Hervella <jrh@it.uc3m.es> types:
> I have read in the "man dump" the following:
> 
> << Dump requires operator intervention on these conditions: end of tape,
> end
> of dump, tape write error, tape open error or disk read error (if there
> is more than a threshold of 32).  In addition to alerting all operators
> implied by the -n key, dump interacts with the operator on dump's
> control terminal at times when dump can no longer proceed, or if
> something is
> grossly wrong.  All questions dump poses must be answered by typing
>  ``yes'' or ``no'', appropriately. >>
>  
> I suppose that this is the problem, but I can not know how solve it

I suspect that that's the problem. In particular, you need a "-a"
instead of "-B XXXXXX". I've included a copy of the script I use for
this if you want to try that.

Most of the configurable stuff is documented at the top; you'll
probably want to set WEEKLYEXTRA to "" until you're comfortable with
the script, and decide what you want to do then. I have it burn a CD
of the weekly backups after the weeklies are done.

The configurable stuff that's not documented in the top is in
/etc/fstab. Set the sixth (freq) field of each file system to control
how often it's dumped. 0 means never dump it, 1 means every day, 2 is
every two days, and so on.

I keep meaning to tweak this into distributable form and write docs,
but just haven't done it yet. If you like it, bug me about it, and
that may provide the incentive I need to finish the thing.

	<mike



--tzQKebTumo
Content-Type: text/plain
Content-Description: Backup script for use from Cron.
Content-Disposition: inline;
	filename="backup"
Content-Transfer-Encoding: 7bit

#!/bin/sh
# Run backups to disk, in both weekly and daily levels.

# Configurable items:
TOP=/jazz		# Top of the backup tree
WEEKLYON=1		# Day to do weekly dumps, Monday(1)-Sunday(7)
DAILYLEVEL=8		# Level for daily dumps
			# I leave one level above it for emergency dumps
WEEKLYLEVEL=5		# Level for weekly dumps
			# Leave room below for monthlies later.
DUMPER=/sbin/dump	# Path to Unix dump command
DUMPFLAGS=-ua		# Flags for dump; -u to update /etc/dumpdates
			# -a to disable sizing tests
WEEKLYEXTRA="/home/mwm/bin/cd-backup $TOP/$WEEKLYLEVEL" # CDs once a week.

# Figure out what we're going to dump
if test $# -eq 1
  then
    DL=`$DUMPER -W | sed -e 1d -e 's/.*(//' -e 's/).*//'`    
    LEVEL=$1
  else
    # Get the file systems to dump
    DL=`$DUMPER -w | sed -e 1d -e 's/.*(//' -e 's/).*//'`
    case `date +%u` in
	    $WEEKLYON) LEVEL=$WEEKLYLEVEL ;;
	    *) LEVEL=$DAILYLEVEL ;;

    esac
    echo
    echo "Doing daily backups:"
    if test -z "$DL"
	then
	    echo
	    echo "No file systems need to be backed up"
	    exit
    fi
fi

# Sort them so we dump the largest first
DUMPLIST=`df $DL | sed -e 1d | awk ' { print $3, $6 } ' | sort -rn | awk ' { print $2 } '`

# Get an output directory
OUTDIR=$TOP/$LEVEL/`date +%Y-%m-%d`
mkdir -p $OUTDIR

# Now dump the, skiping root
dumproot=0
for fs in $DUMPLIST
  do
    if test "$fs" = "/"
      then
	dumproot=1
      else
	echo
	echo Dumping $fs:
	$DUMPER $DUMPFLAGS$LEVEL -f - $fs | gzip -9 > $OUTDIR$fs.dump.gz
    fi
  done

# Always dump root last, so we get the up-to-date /etc/dumpdates
if test $dumproot = 1
  then
    echo
    echo Dumping root:
    $DUMPER $DUMPFLAGS$LEVEL -f - / | gzip -9 > $OUTDIR/root.dump.gz
  fi

# Finally, if there is some extra weekly task to perform, *do* it.
if test "x$LEVEL" = "x$WEEKLYLEVEL" -a  "x$WEEKLYEXTRA" != "x"
    then
	$WEEKLYEXTRA
    fi

# How much space left on the output device?
sync
echo
df -k $TOP

--tzQKebTumo
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit




--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

--tzQKebTumo--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15042.33053.642556.853168>