From 144a6db136ca266241860aadb1af8b2702df97fd Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Mon, 22 Nov 1999 19:08:47 +0000 Subject: [PATCH] 'S' size estimation option to dump. --- CHANGES | 7 ++++++- THANKS | 3 ++- dump/dump.8.in | 13 +++++++++--- dump/main.c | 56 ++++++++++++++++++++++++++++++++------------------ 4 files changed, 54 insertions(+), 25 deletions(-) diff --git a/CHANGES b/CHANGES index 1b98399..453a177 100644 --- a/CHANGES +++ b/CHANGES @@ -1,10 +1,15 @@ -$Id: CHANGES,v 1.20 1999/11/21 15:39:45 tiniou Exp $ +$Id: CHANGES,v 1.21 1999/11/22 19:08:47 tiniou Exp $ Changes between versions 0.4b10 and 0.4b11 (released ????????????????) ====================================================================== 1. Added a '--enable-kerberos' to configure. +2. Added a 'S' option to dump which determines the amount of space + that is needed to perform the dump without actually doint it, similar + to the Sun's ufsdump 'S' option. Patch contributed by Rob Cermak + . + Changes between versions 0.4b9 and 0.4b10 (released November 21, 1999) ====================================================================== diff --git a/THANKS b/THANKS index b43b7b8..87d85e2 100644 --- a/THANKS +++ b/THANKS @@ -1,4 +1,4 @@ -$Id: THANKS,v 1.10 1999/11/21 02:24:45 tiniou Exp $ +$Id: THANKS,v 1.11 1999/11/22 19:08:47 tiniou Exp $ Dump and restore were written by the people of the CSRG at the University of California, Berkeley. @@ -23,6 +23,7 @@ suggested various improvements. Here is a partial list of them (if I have forgotten someone, please complain): Stephen Carr sgcarr@civeng.adelaide.edu.au +Rob Cermak cermak@ahab.rutgers.edu Abhijit Dasgupta abhijit@ans.net Jeremy Fitzhardinge jeremy@goop.org Eirik Fuller eirik@netcom.com diff --git a/dump/dump.8.in b/dump/dump.8.in index 3fa63c1..bb75033 100644 --- a/dump/dump.8.in +++ b/dump/dump.8.in @@ -30,7 +30,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dump.8.in,v 1.4 1999/10/30 22:55:51 tiniou Exp $ +.\" $Id: dump.8.in,v 1.5 1999/11/22 19:08:50 tiniou Exp $ .\" .Dd __DATE__ .Dt DUMP 8 @@ -40,7 +40,7 @@ .Nd ext2 filesystem backup .Sh SYNOPSIS .Nm dump -.Op Fl 0123456789acknu +.Op Fl 0123456789acknSu .Op Fl B Ar records .Op Fl b Ar blocksize .Op Fl d Ar density @@ -51,7 +51,7 @@ .Op Fl T Ar date .Ar filesystem .Nm dump -.Op Fl 0123456789acknu +.Op Fl 0123456789acknSu .Op Fl B Ar records .Op Fl b Ar blocksize .Op Fl d Ar density @@ -218,6 +218,13 @@ prompts for a new tape. It is recommended to be a bit conservative on this option. The default tape length is 2300 feet. .ne 1i +.It Fl S +Size estimate. Determine the amount of space +that is needed to perform the dump without +actually doing it, and display the estimated +number of blocks it will take. This is useful +with incremental dumps to determine how many +volumes of media will be needed. .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/dump/main.c b/dump/main.c index 5e8f79f..263945a 100644 --- a/dump/main.c +++ b/dump/main.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.8 1999/11/21 16:01:47 tiniou Exp $"; + "$Id: main.c,v 1.9 1999/11/22 19:08:50 tiniou Exp $"; #endif /* not lint */ #include @@ -94,6 +94,7 @@ int dokerberos = 0; /* Use Kerberos authentication */ long dev_bsize = 1; /* recalculated below */ long blocksperfile; /* output blocks per file */ char *host = NULL; /* remote host (if any) */ +int sizest = 0; /* return size estimate only */ #ifdef __linux__ char *__progname; @@ -151,9 +152,9 @@ main(int argc, char *argv[]) obsolete(&argc, &argv); #ifdef KERBEROS -#define optstring "0123456789aB:b:cd:f:h:kL:Mns:T:uWw" +#define optstring "0123456789aB:b:cd:f:h:kL:Mns:ST:uWw" #else -#define optstring "0123456789aB:b:cd:f:h:L:Mns:T:uWw" +#define optstring "0123456789aB:b:cd:f:h:L:Mns:ST:uWw" #endif while ((ch = getopt(argc, argv, optstring)) != -1) #undef optstring @@ -237,6 +238,10 @@ main(int argc, char *argv[]) tsize = numarg("tape size", 1L, 0L) * 12 * 10; break; + case 'S': + sizest = 1; /* return size estimate only */ + break; + case 'T': /* time of last dump */ spcl.c_ddate = unctime(optarg); if (spcl.c_ddate < 0) { @@ -402,26 +407,30 @@ main(int argc, char *argv[]) strncpy(tape, tapeprefix, NAME_MAX); tape[NAME_MAX - 1] = '\0'; - msg("Date of this level %c dump: %s", level, + if (!sizest) { + + msg("Date of this level %c dump: %s", level, #ifdef __linux__ - spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date)); + spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date)); #else - spcl.c_date == 0 ? "the epoch\n" : ctime(&spcl.c_date)); + spcl.c_date == 0 ? "the epoch\n" : ctime(&spcl.c_date)); #endif - msg("Date of last level %c dump: %s", lastlevel, + msg("Date of last level %c dump: %s", lastlevel, #ifdef __linux__ - spcl.c_ddate == 0 ? "the epoch\n" : ctime4(&spcl.c_ddate)); + spcl.c_ddate == 0 ? "the epoch\n" : ctime4(&spcl.c_ddate)); #else - spcl.c_ddate == 0 ? "the epoch\n" : ctime(&spcl.c_ddate)); + spcl.c_ddate == 0 ? "the epoch\n" : ctime(&spcl.c_ddate)); #endif - msg("Dumping %s ", disk); - if (dt != NULL) - msgtail("(%s) ", dt->fs_file); - if (host) - msgtail("to %s on host %s\n", tape, host); - else - msgtail("to %s\n", tape); - msg("Label: %s\n", labelstr); + msg("Dumping %s ", disk); + if (dt != NULL) + msgtail("(%s) ", dt->fs_file); + if (host) + msgtail("to %s on host %s\n", tape, host); + else + msgtail("to %s\n", tape); + msg("Label: %s\n", labelstr); + + } /* end of size estimate */ #ifdef __linux__ retval = dump_fs_open(disk, &fs); @@ -487,7 +496,8 @@ main(int argc, char *argv[]) (void)signal(SIGINFO, statussig); #endif - msg("mapping (Pass I) [regular files]\n"); + if (!sizest) + msg("mapping (Pass I) [regular files]\n"); #ifdef __linux__ if (directory[0] == 0) anydirskipped = mapfiles(maxino, &tapesize); @@ -497,11 +507,17 @@ main(int argc, char *argv[]) anydirskipped = mapfiles(maxino, &tapesize); #endif - msg("mapping (Pass II) [directories]\n"); + if (!sizest) + msg("mapping (Pass II) [directories]\n"); while (anydirskipped) { anydirskipped = mapdirs(maxino, &tapesize); } + if (sizest) { + printf("%ld\n", tapesize + 10); + exit(X_STARTUP); + } /* stop here for size estimate */ + if (pipeout || unlimited) { tapesize += 10; /* 10 trailer blocks */ msg("estimated %ld tape blocks.\n", tapesize); @@ -666,7 +682,7 @@ usage(void) #ifdef KERBEROS "k" #endif - "Mnu] [-B records] [-b blocksize] [-d density]\n" + "MnSu] [-B records] [-b blocksize] [-d density]\n" "\t%s [-f file] [-h level] [-s feet] [-T date] filesystem\n" "\t%s [-W | -w]\n", __progname, white, __progname); exit(X_STARTUP); -- 2.39.2