diff options
author | iedowse <iedowse@FreeBSD.org> | 2002-03-01 20:54:23 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2002-03-01 20:54:23 +0000 |
commit | 5a6428cea6f4a4d6872e985d0e1411bd4ad7724f (patch) | |
tree | ad865239425663a58f0f0be68b276ee16e793072 /sbin | |
parent | 7cc2d2db6809fa23e9c07ba52626b3d033763d5e (diff) | |
download | FreeBSD-src-5a6428cea6f4a4d6872e985d0e1411bd4ad7724f.zip FreeBSD-src-5a6428cea6f4a4d6872e985d0e1411bd4ad7724f.tar.gz |
Add a new "-S" flag to dump to allow it just print out dump estimate
size and then exit.
PR: bin/35450
Submitted by: Mark Hannon <markhannon@optushome.com.au>
Obtained from: NetBSD
MFC after: 1 week
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dump/dump.8 | 7 | ||||
-rw-r--r-- | sbin/dump/main.c | 18 |
2 files changed, 20 insertions, 5 deletions
diff --git a/sbin/dump/dump.8 b/sbin/dump/dump.8 index a6362c1..0191da1 100644 --- a/sbin/dump/dump.8 +++ b/sbin/dump/dump.8 @@ -33,7 +33,7 @@ .\" @(#)dump.8 8.3 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd July 9, 2001 +.Dd March 1, 2002 .Dt DUMP 8 .Os .Sh NAME @@ -42,7 +42,7 @@ .Nd filesystem backup .Sh SYNOPSIS .Nm -.Op Fl 0123456789acknu +.Op Fl 0123456789acknSu .Op Fl B Ar records .Op Fl b Ar blocksize .Op Fl D Ar dumpdates @@ -194,6 +194,9 @@ If this amount is exceeded, prompts for a new tape. It is recommended to be a bit conservative on this option. The default tape length is 2300 feet. +.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 T Ar date Use the specified date as the starting time for the dump instead of the time determined from looking in diff --git a/sbin/dump/main.c b/sbin/dump/main.c index 666b65f..e1fc40d 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -99,6 +99,7 @@ main(argc, argv) char *map; int ch; int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1; + int just_estimate = 0; ino_t maxino; char *tmsg; time_t t; @@ -119,9 +120,9 @@ main(argc, argv) obsolete(&argc, &argv); #ifdef KERBEROS -#define optstring "0123456789aB:b:cd:f:h:kns:T:uWwD:" +#define optstring "0123456789aB:b:cd:f:h:kns:ST:uWwD:" #else -#define optstring "0123456789aB:b:cd:f:h:ns:T:uWwD:" +#define optstring "0123456789aB:b:cd:f:h:ns:ST:uWwD:" #endif while ((ch = getopt(argc, argv, optstring)) != -1) #undef optstring @@ -182,6 +183,10 @@ main(argc, argv) tsize = numarg("tape size", 1L, 0L) * 12 * 10; break; + case 'S': /* exit after estimating # of tapes */ + just_estimate = 1; + break; + case 'T': /* time of last dump */ spcl.c_ddate = unctime(optarg); if (spcl.c_ddate < 0) { @@ -420,6 +425,13 @@ main(argc, argv) tapesize, fetapes); } + /* + * If the user only wants an estimate of the number of + * tapes, exit now. + */ + if (just_estimate) + exit(0); + /* * Allocate tape buffer. */ @@ -508,7 +520,7 @@ usage() #ifdef KERBEROS "k" #endif - "nu] [-B records] [-b blocksize] [-D dumpdates]\n" + "nSu] [-B records] [-b blocksize] [-D dumpdates]\n" " [-d density] [-f file ] [-h level] [-s feet] " "[-T date] filesystem\n" " dump [-W | -w]\n"); |