Taking a backup at 5 am (4.2BSD)

Johan Wide'n johanw at ttds.UUCP
Wed Nov 28 03:45:27 AEST 1984


If you take backups in single user mode this might be of interest.

We take backups with /etc/dump. It is possible to get a reasonably
errorfree dump in multi user mode if the system activity is low.
As our systems can be quite active even at a very odd hour, we prefer
to take backups in single user mode.

Here is a crude attempt to take a backup 'automatically' in single user mode
during the night. We mount a tape in the evening, log in as root and say:

	# cd /etc
	# at 0500 startbackup

Here is the file /etc/startbackup:
*********************************************
	#! /bin/sh
	cp /dev/null /makebackup
	shutdown -r +5 'Automatic backup'
*********************************************

shutdown -r causes a reboot.

We have added the following lines to /etc/rc:
*********************************************
		*)
			echo "Unknown error in reboot" > /dev/console
			exit 1
			;;
		esac
	+       if [ -r /makebackup ]
	+       then
	+           rm -f /makebackup
	+           /etc/dobackup </dev/console >/dev/console 2>&1
	+       fi
	else
		date >/dev/console
	fi
	rm -f /etc/nologin
*********************************************

Here is /etc/dobackup:
*********************************************
	#! /bin/sh
	mt rew
	  /etc/dump 9udf 6250 /dev/nrmt8 /dev/rhp0h
	  /etc/dump 9udf 6250 /dev/nrmt8 /dev/rhp0g
	  /etc/dump 9udf 6250 /dev/nrmt8 /dev/rhp0a
	mt rew
	mt offline
*********************************************

There are several problems with this approach:

	All dumps must fit on one tape.

	When several dumps are put on one tape there is no check that their
	combined length does not exceed the length of the tape.

	If something goes wrong the system will stay in single user mode
	until an operator intervenes.

There is another problem:

	When 'at' starts a
		shutdown -r
	the root partition (/dev/rhp0a) will not be properly sync'd.
	That is: fsck will find an error on the root partition.
	I'm not sure why this happens.

We would like to hear of other approaches to taking a dump without
shutting the system down during the day.

mcvax!enea!ttds!johanw          Johan Widen



More information about the Comp.unix.wizards mailing list