Date: Sun, 12 Nov 1995 14:27:57 +0100 (MET) From: Andreas Klemm <andreas@knobel.gun.de> To: hackers@freebsd.org, current@freebsd.org Subject: Diffs to the dump utility, rewritten with respect to your comments Message-ID: <Pine.BSF.3.91.951112135348.4791A-200000@knobel.gun.de>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi !
Here again my diffs for the dump utility. I rewrote my changes
because of your comments (division through zero, same default
dump device as tar). I made the context diffs against the
FreeBSD-stable source of today: Sun Nov 12 14:01:21 MET 1995.
Changes in detail:
main.c - line 167:
abort dump if a blocksize > 32 (K) was chosen using
dump's "b" option, because restore is unable to restore
dumps with blocksizes over 32 K. Someone said here,
there might be a bug in the scsi tape driver. This
should be fixed as soon as possible.
Users/Administrators are now protected from the worst
case situation, that they can't restore their dump if
they choosed a blocksize over 32. Dump does it all fine,
but later, &@&%" ;-) "So this patch prevent's dump from
being a BOFH tool ;-))"
- line 447:
here ends the dump time, needed for calculation of
dumptime and throughput.
- line 460:
report dump time and performance after dump.
check that dumptime isn't zero, that would
cause a division through zero. when calculating
the performance.
dump.h - line 82:
introducnd new variable for dumptime calculation
tend_writing.
dump.8 - line 105:
changed default dump device to /dev/rst0. Now it's
the same as in tar (for Joerg ;-). He convinced me,
that a) not all people have a dump device, where
everything fits on one tape and b) that /dev/rst0
is the standard in tar, too. Ok, you win ;-))
- line 259:
In the example I deceided to dump to the
first connected tape drive, most people will
have only one tape device, so the example becomes
more praxis oriented ;-)
- line 285:
FILES section: changed /dev/rmt8 to /dev/rst0
- line 314:
BUG section: tell the people to use blocksizes
<= 32 K. If they don't follow that, then dump
takes care and aborts ;-) Never do backups, you
can't read ;-)
- line 341:
Updated the history section.
pathnames.h - line 38:
changed default dump device to /dev/rst0
That's it folks, hope you enjoyed it. I hope the verbose comments
help, to incorporate these (partly important) fixes to the source
tree very quickly.
I think the fix that prevents to use blocksizes over 32k, is
really important. Figure out, someone relies on the backup,
that he made on his brand new Tape or DAT ... Let's assume,
he makes two backups, to be save, but he too lazy or
inexperienced, to check, if he can read it in....
If then the system crashes and he is unable to restore his
data, then ..... figure out yourself ! Perhaps this might
be a reason, to "break" the code freeze in this case.
A System, that is unable to read it's own dumps under certain
circumstances without a big warning to the operator is deadly bad ;-)
Think over it twice, it was called FreeBSD-stable the last weeks ;-)
Prevent calling it: "FreeBSD-crashed-unable_to_restore" ;-))
happy weekend :)
Andreas ///
--
andreas@knobel.gun.de /\/\___ Wiechers & Partner Datentechnik GmbH
Andreas Klemm ___/\/\/ - Support Unix - aklemm@wup.de -
\/
ftp://sunsite.unc.edu/pub/Linux/system/Printing/aps-491.tgz
apsfilter - magic print filter 4lpd >>> knobel is powered by FreeBSD <<<
[-- Attachment #2 --]
*** main.c.orig Sun Nov 12 13:41:43 1995
--- main.c Sun Nov 12 13:44:19 1995
***************
*** 167,172 ****
--- 167,179 ----
case 'b': /* blocks per tape write */
ntrec = numarg('b', "number of blocks per write",
1L, 1000L, &argc, &argv);
+ /* XXX restore is unable to restore dumps that
+ were created with a blocksize larger than 32K.
+ Possibly bug in the scsi tape driver. AKL */
+ if ( ntrec > 32 ) {
+ msg("please choose a blocksize <= 32\n");
+ exit(X_ABORT);
+ }
break;
case 'B': /* blocks per output file */
***************
*** 440,445 ****
--- 447,453 ----
(void)dumpino(dp, ino);
}
+ (void)time((time_t *)&(tend_writing)); /* AKL end time */
spcl.c_type = TS_END;
for (i = 0; i < ntrec; i++)
writeheader(maxino - 1);
***************
*** 448,453 ****
--- 456,471 ----
else
msg("DUMP: %ld tape blocks on %d volumes(s)\n",
spcl.c_tapea, spcl.c_volume);
+
+ /* AKL: report dump performance, avoid division through zero */
+ if(tend_writing-tstart_writing == 0)
+ msg("DUMP: finished in %d seconds\n",
+ tend_writing-tstart_writing);
+ else
+ msg("DUMP: finished in %d seconds, throughput %d KBytes/sec\n",
+ tend_writing-tstart_writing,
+ spcl.c_tapea/(tend_writing-tstart_writing));
+
putdumptime();
trewind();
broadcast("DUMP IS DONE!\7\7\n");
*** dump.h.orig Sun Nov 12 13:41:43 1995
--- dump.h Sun Nov 12 13:44:19 1995
***************
*** 79,84 ****
--- 79,85 ----
int blockswritten; /* number of blocks written on current tape */
int tapeno; /* current tape number */
time_t tstart_writing; /* when started writing the first tape block */
+ time_t tend_writing; /* after writing the last tape block AKL */
struct fs *sblock; /* the file system super block */
char sblock_buf[MAXBSIZE];
long dev_bsize; /* block size of underlying disk device */
*** dump.8.orig Sun Nov 12 13:41:43 1995
--- dump.8 Sun Nov 12 13:44:19 1995
***************
*** 102,108 ****
.Ar file
may be a special device file
like
! .Pa /dev/rmt12
(a tape drive),
.Pa /dev/rsd1c
(a disk drive),
--- 102,108 ----
.Ar file
may be a special device file
like
! .Pa /dev/rst0
(a tape drive),
.Pa /dev/rsd1c
(a disk drive),
***************
*** 256,262 ****
.It
Always start with a level 0 backup, for example:
.Bd -literal -offset indent
! /sbin/dump 0uf /dev/nrst1 /usr/src
.Ed
.Pp
This should be done at set intervals, say once a month or once every two months,
--- 256,262 ----
.It
Always start with a level 0 backup, for example:
.Bd -literal -offset indent
! /sbin/dump 0uf /dev/nrst0 /usr/src
.Ed
.Pp
This should be done at set intervals, say once a month or once every two months,
***************
*** 282,288 ****
rotated out of the dump cycle and fresh tapes brought in.
.Sh FILES
.Bl -tag -width /etc/dumpdates -compact
! .It Pa /dev/rmt8
default tape unit to dump to
.It Pa /etc/dumpdates
dump date records
--- 282,288 ----
rotated out of the dump cycle and fresh tapes brought in.
.Sh FILES
.Bl -tag -width /etc/dumpdates -compact
! .It Pa /dev/rst0
default tape unit to dump to
.It Pa /etc/dumpdates
dump date records
***************
*** 311,316 ****
--- 311,320 ----
reels already written just hang around until the entire tape
is written.
.Pp
+ restore(8) is currently unable to restore dumps that were created
+ with a blocksize larger than 32. Workaround for safety reasons:
+ dump aborts with a warning message when choosing a blocksize > 32.
+ .Pp
.Nm Dump
with the
.Cm W
***************
*** 334,336 ****
--- 338,350 ----
A
.Nm dump
command appeared in Version 6 AT&T UNIX.
+ .Pp
+ Additional dump message (similar to Solaris 2)
+ by Andreas Klemm <andreas@knobel.gun.de> reporting
+ .Nm backup time
+ in seconds and
+ .Nm write performance
+ in Kbytes per second. Changed default dump device from
+ the old fashioned rmt8 device to /dev/rst0 (so it's the same
+ as used by tar).
+ Appeared first in FreeBSD 2.2.
*** pathnames.h.orig Sun Nov 12 13:41:43 1995
--- pathnames.h Sun Nov 12 13:44:19 1995
***************
*** 35,41 ****
#include <paths.h>
! #define _PATH_DEFTAPE "/dev/rmt8"
#define _PATH_DTMP "/etc/dtmp"
#define _PATH_DUMPDATES "/etc/dumpdates"
#define _PATH_LOCK "/tmp/dumplockXXXXXX"
--- 35,41 ----
#include <paths.h>
! #define _PATH_DEFTAPE "/dev/rst0" /* AKL */
#define _PATH_DTMP "/etc/dtmp"
#define _PATH_DUMPDATES "/etc/dumpdates"
#define _PATH_LOCK "/tmp/dumplockXXXXXX"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.951112135348.4791A-200000>
