[comp.sys.sun] How big will tonight's dump be

das@harvard.harvard.edu (David Steffens) (01/28/89)

olling@tcgould.tn.cornell.edu (Cliff Olling) asks:
> Is there a better way to determine dump size than dumping to /dev/null
> before doing the real thing?

The following is a fragment of a Bourne shell script that I use to
estimate dump sizes on a 4/280 running SunOS4.0.0.  It assumes the
following shell variables have been set appropriately:

	LEVEL	the dump level to be estimated
	DENS	tape density in bits per inch ("d" argument for dump)
	SIZE	tape length in feet ("s" argument for dump)
	FILSYS	the file system to be estimated

echo yes | /etc/dump ${LEVEL}fds /dev/null $DENS $SIZE $FILSYS 2>&1 | (
	: this delay guarantees "dump" will appear in the "ps" listing
	sleep 2
	set `ps | grep " dump" | grep -v grep`
	DUMP_PID=$1
	while read LINE
	do
		echo $LINE

		set $LINE
		case $2 in
		estimated)
			kill -INT $DUMP_PID
			break
			;;
		*)
			continue
			;;
		esac
	done
)
----
{harvard,mit-eddie,think}!eplunix!das		David Allan Steffens
243 Charles St., Boston, MA 02114		Eaton-Peabody Laboratory
(617) 573-3748					Mass. Eye & Ear Infirmary

mangler@csvax.caltech.edu (Don Speck) (02/09/89)

Bugs in your script to estimate dump sizes:
    DENS should be *bytes* per inch, not bits.

    "echo yes | /etc/dump" is meaningless, because dump doesn't read stdin;
	it opens /dev/tty.

    killing the first "dump" pid presented by "ps" may leave some
	processes running (depending on the sort order of "ps"; all
	but one "dump" process will be ignoring interrupts, and
	there's a narrow window where ALL of them ignore interrupts)
	or (worse) it may kill processes dumping another disk.

Try this instead:

set `(/etc/dump ${LEVEL}fds - $DENS $SIZE $FILSYS | exit) 2>&1 | grep estimate`

which causes dump to exit with a write error.  $3 gets set to the number
of kilobytes, $7 is the number of tapes.

Either approach seems very crude, and leads me to wonder at the real goal
behind this.  Are you trying to calculate how many filesystems fit on one
tape?  The minimum dump level that will fit on one tape?  Whether you have
enough tapes to proceed?

rsd@zf60d.dal.utexas.edu (Shane Davis) (02/15/89)

>    "echo yes | /etc/dump" is meaningless, because dump doesn't read stdin;
>    it opens /dev/tty.

If anyone's interested, I have patched /etc/dump to use stdin rather than
/dev/tty. This was necessary to allow backup operators to log into one
system	and run a shell script that uses rsh to perform dumps of all our
fileservers, rather than having to log into 8 or 9 different machines each
time. Not sure if I have a script of the adb session, but the binary has a
second patch that causes dump to use the service "shmtf/tcp" rather than
"shell/tcp" when using a tape drive on a remote host. This patch was made
so that we could use a custom rshd for remote backups. That second patch
is no problem to get around, though.

--Shane Davis
  VM and UNIX systems programmer, UT-Dallas Academic Computer Ctr.
  SHANE@UTDALVM1{.BITNET|.dal.utexas.edu}
  rsd@engc1.dal.utexas.edu