diff --git a/sbin/dump/dump.8 b/sbin/dump/dump.8 index 13a69e42f677..40b257ab03a0 100644 --- a/sbin/dump/dump.8 +++ b/sbin/dump/dump.8 @@ -41,7 +41,7 @@ .Nd filesystem backup .Sh SYNOPSIS .Nm dump -.Op Cm 0123456789BbhfusTdWn Op Ar argument ... +.Op Cm 0123456789BTWabcdfhnsu Op Ar argument ... .Op Ar filesystem .Sh DESCRIPTION .Nm Dump @@ -56,7 +56,11 @@ option below for doing remote backups). A dump that is larger than the output medium is broken into multiple volumes. On most media the size is determined by writing until an -end-of-media indication is returned. +end-of-media indication is returned. This can be enforced +by using the +.Cm a +option. +.Pp On media that cannot reliably return an end-of-media indication (such as some cartridge tape drives) each volume is of a fixed size; @@ -85,8 +89,19 @@ level is 9. The number of dump records per volume. This option overrides the calculation of tape size based on length and density. +.It Cm a +.Dq auto-size . +Bypass all tape length considerations, and enforce writing +until an end-of-media indication is returned. This fits best +for most modern tape drives. Use of this option is particularly +recommended when appending to an existing tape, or using a tape +drive with hardware compression (where you can never be sure about +the compression ratio). .It Cm b Ar blocksize The number of kilobytes per dump record. +.It Cm c +Change the defaults for use with a cartridge tape drive, with a density +of 8000 bpi, and a length of 1700 feet. .It Cm h Ar level Honor the user .Dq nodump @@ -325,10 +340,12 @@ 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. +Currently, +.Xr physio 9 +slices all requests into chunks of 64 KB. Therefore, it is +impossible to use a larger tape blocksize, so +.Nm dump +will prevent this from happening. .Pp .Nm Dump with the diff --git a/sbin/dump/dump.h b/sbin/dump/dump.h index 4b2330e93a3b..0da4c28ec482 100644 --- a/sbin/dump/dump.h +++ b/sbin/dump/dump.h @@ -74,6 +74,7 @@ long tsize; /* tape size in 0.1" units */ long asize; /* number of 0.1" units written on current tape */ int etapes; /* estimated number of tapes */ int nonodump; /* if set, do not honor UF_NODUMP user flags */ +int unlimited; /* if set, write to end of medium */ int notify; /* notify operator flag */ int blockswritten; /* number of blocks written on current tape */ diff --git a/sbin/dump/main.c b/sbin/dump/main.c index 62d1caf04cb5..e100f27f8c38 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -168,11 +168,18 @@ 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"); + /* + * XXX + * physio(9) currently slices all requests to + * 64 KB chunks. So now, if somebody entered + * e.g. 96 KB block size here, he would effectively + * yield one 64 KB and one 32 KB block, which + * restore cannot handle. + * Thus we currently enforce pyhsio(9)'s limit + * here, too. + */ + if ( ntrec > 64 ) { + msg("please choose a blocksize <= 64\n"); exit(X_ABORT); } break; @@ -186,6 +193,10 @@ main(argc, argv) cartridge = 1; break; + case 'a': /* `auto-size', Write to EOM. */ + unlimited = 1; + break; + /* dump level */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': @@ -235,7 +246,7 @@ main(argc, argv) if (blocksperfile) blocksperfile = blocksperfile / ntrec * ntrec; /* round down */ - else { + else if (!unlimited) { /* * Determine how to default tape size and density * @@ -361,7 +372,7 @@ main(argc, argv) anydirskipped = mapdirs(maxino, &tapesize); } - if (pipeout) { + if (pipeout || unlimited) { tapesize += 10; /* 10 trailer blocks */ msg("estimated %ld tape blocks.\n", tapesize); } else { diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c index cc7cc13c8fa2..26aed1339ff6 100644 --- a/sbin/dump/tape.c +++ b/sbin/dump/tape.c @@ -138,7 +138,7 @@ alloctape() * repositioning after stopping, i.e, streaming mode, where the gap is * variable, 0.30" to 0.45". The gap is maximal when the tape stops. */ - if (blocksperfile == 0) + if (blocksperfile == 0 && !unlimited) tenths = writesize / density + (cartridge ? 16 : density == 625 ? 5 : 8); /* @@ -302,7 +302,7 @@ flushtape() asize += tenths; blockswritten += ntrec; blocksthisvol += ntrec; - if (!pipeout && (blocksperfile ? + if (!pipeout && !unlimited && (blocksperfile ? (blocksthisvol >= blocksperfile) : (asize > tsize))) { close_rewind(); startnewtape(0);