.\" 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
.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
.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
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
#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 <sys/param.h>
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;
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
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) {
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);
(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);
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);
#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);