diff options
author | Stephan A. Rickauer <stephan@cvs.openbsd.org> | 2014-05-30 20:48:22 +0000 |
---|---|---|
committer | Stephan A. Rickauer <stephan@cvs.openbsd.org> | 2014-05-30 20:48:22 +0000 |
commit | 613ec2f0dee2109c3ad6780cceda1b69ca824b84 (patch) | |
tree | 0b90c53c70b645c4b6845c60ad88c5849a7deb40 | |
parent | 633eb54660517b6271bd25540df8882fc294dcaa (diff) |
Add option -S to have dump(8) only estimate backup size and number of tapes
required (from NetBSD).
ok beck@, krw@ and sthen@
-rw-r--r-- | sbin/dump/dump.8 | 9 | ||||
-rw-r--r-- | sbin/dump/main.c | 15 |
2 files changed, 19 insertions, 5 deletions
diff --git a/sbin/dump/dump.8 b/sbin/dump/dump.8 index 59f442d4a2b..e5e0dd7c7de 100644 --- a/sbin/dump/dump.8 +++ b/sbin/dump/dump.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: dump.8,v 1.45 2013/04/04 10:47:21 zhuk Exp $ +.\" $OpenBSD: dump.8,v 1.46 2014/05/30 20:48:21 stephan Exp $ .\" $NetBSD: dump.8,v 1.17 1997/06/05 11:15:06 lukem Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 @@ -31,7 +31,7 @@ .\" .\" @(#)dump.8 8.1 (Berkeley) 6/16/93 .\" -.Dd $Mdocdate: April 4 2013 $ +.Dd $Mdocdate: May 30 2014 $ .Dt DUMP 8 .Os .Sh NAME @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm dump .Bk -words -.Op Fl 0123456789acnuWw +.Op Fl 0123456789acnSuWw .Op Fl B Ar records .Op Fl b Ar blocksize .Op Fl d Ar density @@ -203,6 +203,9 @@ notify all operators in the group .Dq operator by means similar to a .Xr wall 1 . +.It Fl S +Display an estimate of the backup size and the number of tapes +required, and exit without actually performing the dump. .It Fl s Ar feet Attempt to calculate the amount of tape needed at a particular density. diff --git a/sbin/dump/main.c b/sbin/dump/main.c index f81d0a3d1f7..a5cd99e4821 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.48 2014/05/27 12:35:40 krw Exp $ */ +/* $OpenBSD: main.c,v 1.49 2014/05/30 20:48:21 stephan Exp $ */ /* $NetBSD: main.c,v 1.14 1997/06/05 11:13:24 lukem Exp $ */ /*- @@ -95,6 +95,7 @@ main(int argc, char *argv[]) time_t t; int dirlist; char *toplevel, *str, *mount_point = NULL; + int just_estimate = 0; spcl.c_date = (int64_t)time(NULL); @@ -111,7 +112,7 @@ main(int argc, char *argv[]) usage(); obsolete(&argc, &argv); - while ((ch = getopt(argc, argv, "0123456789aB:b:cd:f:h:ns:T:uWw")) != -1) + while ((ch = getopt(argc, argv, "0123456789aB:b:cd:f:h:ns:ST:uWw")) != -1) switch (ch) { /* dump level */ case '0': case '1': case '2': case '3': case '4': @@ -159,6 +160,10 @@ main(int argc, char *argv[]) tsize = numarg("tape size", 1L, 0L) * 12 * 10; break; + case 'S': /* estimate blocks and # of tapes */ + just_estimate = 1; + break; + case 'T': /* time of last dump */ str = strptime(optarg, "%a %b %e %H:%M:%S %Y", &then); then.tm_isdst = -1; @@ -477,6 +482,12 @@ main(int argc, char *argv[]) } /* + * Exit if user wants an estimate of blocks and # of tapes only. + */ + if (just_estimate) + exit(X_FINOK); + + /* * Allocate tape buffer. */ if (!alloctape()) |