summaryrefslogtreecommitdiffstats
path: root/sbin/dump
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1995-11-18 18:00:43 +0000
committerjoerg <joerg@FreeBSD.org>1995-11-18 18:00:43 +0000
commit23c0dfac90b2ba18799e6bd7ba89e47bc9521800 (patch)
tree1ee3c2b171fd54126862370e801a7a1a6cc7091e /sbin/dump
parent39bf0372f9f49e45f2a318ed51c8f74beae187a8 (diff)
downloadFreeBSD-src-23c0dfac90b2ba18799e6bd7ba89e47bc9521800.zip
FreeBSD-src-23c0dfac90b2ba18799e6bd7ba89e47bc9521800.tar.gz
Andreas Klemm's patch set for dump(8), with some minor (cosmetic)
changes and one addition by me. . Use reasonable defaults for the tape drive (/dev/rst0) instead of something we actually don't have. . Add a summary line displaying the alapsed time and the total throughput. . Replace "rmt" for the remote location of rmt(8) by "/etc/rmt", since this is the historical protocol, and relying on the $PATH causes a big pain. Make it adjustable via an environmental variable though. Reviewed by: joerg (for Andreas' part) Submitted by: andreas@knobel.gun.de (Andreas Klemm)
Diffstat (limited to 'sbin/dump')
-rw-r--r--sbin/dump/dump.827
-rw-r--r--sbin/dump/dump.h1
-rw-r--r--sbin/dump/dumprmt.c5
-rw-r--r--sbin/dump/main.c36
-rw-r--r--sbin/dump/pathnames.h4
5 files changed, 56 insertions, 17 deletions
diff --git a/sbin/dump/dump.8 b/sbin/dump/dump.8
index 810b706..2176fe3 100644
--- a/sbin/dump/dump.8
+++ b/sbin/dump/dump.8
@@ -102,10 +102,10 @@ Write the backup to
.Ar file
may be a special device file
like
-.Pa /dev/rmt12
+.Pa /dev/rst0
(a tape drive),
-.Pa /dev/rsd1c
-(a disk drive),
+.Pa /dev/rfd1
+(a floppy disk drive),
an ordinary file,
or
.Ql Fl
@@ -122,6 +122,12 @@ or
.Nm dump
writes to the named file on the remote host using
.Xr rmt 8 .
+The default path name of the remote
+.Xr rmt 8
+program is
+.Pa /etc/rmt ;
+this can be overridden by the environment variable
+.Ev RMT .
.It Cm d Ar density
Set tape density to
.Ar density .
@@ -256,7 +262,7 @@ to minimize the number of tapes follows:
.It
Always start with a level 0 backup, for example:
.Bd -literal -offset indent
-/sbin/dump 0uf /dev/nrst1 /usr/src
+/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,
@@ -280,9 +286,15 @@ used, also on a cyclical basis.
.Pp
After several months or so, the daily and weekly tapes should get
rotated out of the dump cycle and fresh tapes brought in.
+.Sh ENVIRONMENT
+The environment variable
+.Ev RMT
+will be used to determine the pathname of the remote
+.Xr rmt 8
+program.
.Sh FILES
.Bl -tag -width /etc/dumpdates -compact
-.It Pa /dev/rmt8
+.It Pa /dev/rst0
default tape unit to dump to
.It Pa /etc/dumpdates
dump date records
@@ -311,6 +323,11 @@ Each reel requires a new process, so parent processes for
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 on some tape drives. This is likely
+a bug in the tape driver. Workaround for safety reasons:
+dump aborts with an error message when choosing a blocksize > 32.
+.Pp
.Nm Dump
with the
.Cm W
diff --git a/sbin/dump/dump.h b/sbin/dump/dump.h
index f74e83f..8cdddfc 100644
--- a/sbin/dump/dump.h
+++ b/sbin/dump/dump.h
@@ -79,6 +79,7 @@ int notify; /* notify operator flag */
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 */
struct fs *sblock; /* the file system super block */
char sblock_buf[MAXBSIZE];
long dev_bsize; /* block size of underlying disk device */
diff --git a/sbin/dump/dumprmt.c b/sbin/dump/dumprmt.c
index 22acbfd..48d07d4 100644
--- a/sbin/dump/dumprmt.c
+++ b/sbin/dump/dumprmt.c
@@ -113,6 +113,7 @@ void
rmtgetconn()
{
register char *cp;
+ register const char *rmt;
static struct servent *sp = NULL;
static struct passwd *pwd = NULL;
#ifdef notdef
@@ -143,8 +144,10 @@ rmtgetconn()
rmtpeer = ++cp;
} else
tuser = pwd->pw_name;
+ if ((rmt = getenv("RMT")) == NULL)
+ rmt = _PATH_RMT;
rmtape = rcmd(&rmtpeer, (u_short)sp->s_port, pwd->pw_name, tuser,
- _PATH_RMT, (int *)0);
+ rmt, (int *)0);
size = ntrec * TP_BSIZE;
if (size > 60 * 1024) /* XXX */
size = 60 * 1024;
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index 995dee0..fdccb9e 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -77,7 +77,7 @@ static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 4/15/94";
int notify = 0; /* notify operator flag */
int blockswritten = 0; /* number of blocks written on current tape */
int tapeno = 0; /* current tape number */
-int density = 0; /* density in bytes/0.1" */
+int density = 0; /* density in bytes/0.1" " <- this is for hilit19 */
int ntrec = NTREC; /* # tape blocks in each tape record */
int cartridge = 0; /* Assume non-cartridge tape */
long dev_bsize = 1; /* recalculated below */
@@ -167,6 +167,13 @@ main(argc, argv)
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 a bug in the scsi tape driver. */
+ if ( ntrec > 32 ) {
+ msg("please choose a blocksize <= 32\n");
+ exit(X_ABORT);
+ }
break;
case 'B': /* blocks per output file */
@@ -236,6 +243,7 @@ main(argc, argv)
* 9-track 6250 bpi (625 bytes/.1") 2300 ft.
* cartridge 8000 bpi (100 bytes/.1") 1700 ft.
* (450*4 - slop)
+ * hilit19 hits again: "
*/
if (density == 0)
density = cartridge ? 100 : 160;
@@ -362,12 +370,12 @@ main(argc, argv)
fetapes =
( tapesize /* blocks */
* TP_BSIZE /* bytes/block */
- * (1.0/density) /* 0.1" / byte */
+ * (1.0/density) /* 0.1" / byte " */
+
tapesize /* blocks */
* (1.0/ntrec) /* streaming-stops per block */
- * 15.48 /* 0.1" / streaming-stop */
- ) * (1.0 / tsize ); /* tape / 0.1" */
+ * 15.48 /* 0.1" / streaming-stop " */
+ ) * (1.0 / tsize ); /* tape / 0.1" " */
} else {
/* Estimate number of tapes, for old fashioned 9-track
tape */
@@ -375,12 +383,12 @@ main(argc, argv)
fetapes =
( tapesize /* blocks */
* TP_BSIZE /* bytes / block */
- * (1.0/density) /* 0.1" / byte */
+ * (1.0/density) /* 0.1" / byte " */
+
tapesize /* blocks */
* (1.0/ntrec) /* IRG's / block */
- * tenthsperirg /* 0.1" / IRG */
- ) * (1.0 / tsize ); /* tape / 0.1" */
+ * tenthsperirg /* 0.1" / IRG " */
+ ) * (1.0 / tsize ); /* tape / 0.1" " */
}
etapes = fetapes; /* truncating assignment */
etapes++;
@@ -440,14 +448,24 @@ main(argc, argv)
(void)dumpino(dp, ino);
}
+ (void)time((time_t *)&(tend_writing));
spcl.c_type = TS_END;
for (i = 0; i < ntrec; i++)
writeheader(maxino - 1);
if (pipeout)
- msg("DUMP: %ld tape blocks\n",spcl.c_tapea);
+ msg("%ld tape blocks\n", spcl.c_tapea);
else
- msg("DUMP: %ld tape blocks on %d volumes(s)\n",
+ msg("%ld tape blocks on %d volumes(s)\n",
spcl.c_tapea, spcl.c_volume);
+
+ /* report dump performance, avoid division through zero */
+ if (tend_writing - tstart_writing == 0)
+ msg("finished in less than a second\n");
+ else
+ msg("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");
diff --git a/sbin/dump/pathnames.h b/sbin/dump/pathnames.h
index e4dff53..a9c3f82 100644
--- a/sbin/dump/pathnames.h
+++ b/sbin/dump/pathnames.h
@@ -35,8 +35,8 @@
#include <paths.h>
-#define _PATH_DEFTAPE "/dev/rmt8"
+#define _PATH_DEFTAPE "/dev/rst0"
#define _PATH_DTMP "/etc/dtmp"
#define _PATH_DUMPDATES "/etc/dumpdates"
#define _PATH_LOCK "/tmp/dumplockXXXXXX"
-#define _PATH_RMT "rmt"
+#define _PATH_RMT "/etc/rmt"
OpenPOWER on IntegriCloud