.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: dump.8.in,v 1.21 2001/03/18 15:35:44 stelian Exp $
+.\" $Id: dump.8.in,v 1.22 2001/03/20 20:15:43 stelian Exp $
.\"
.Dd __DATE__
.Dt DUMP 8
.Nd ext2 filesystem backup
.Sh SYNOPSIS
.Nm dump
-.Op Fl 0123456789ackMnSuz
+.Op Fl 0123456789ackMnSu
.Op Fl B Ar records
.Op Fl b Ar blocksize
.Op Fl d Ar density
.Op Fl L Ar label
.Op Fl s Ar feet
.Op Fl T Ar date
+.Op Fl z Ar compression level
.Ar file-to-dump
.Nm dump
.Op Fl W Li \&| Fl w
but prints only recognized filesystems in
.Pa /etc/fstab
which need to be dumped.
-.It Fl z
+.It Fl z Ar compression level
Compress every block to be written on the tape using zlib library. This
option will work only when dumping to a file or pipe or, when dumping
to a tape drive, if the tape drive is capable of writing variable
length blocks. You will need at least the 0.4b22 version of restore in
order to extract compressed tapes. Tapes written using compression will
-not be compatible with the BSD tape format.
+not be compatible with the BSD tape format. The (optional) parameter
+specifies the compression level zlib will use. The default compression
+level is 2.
.El
.Pp
.Nm Dump
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.37 2001/03/20 10:02:48 stelian Exp $";
+ "$Id: main.c,v 1.38 2001/03/20 20:15:43 stelian Exp $";
#endif /* not lint */
#include <config.h>
long blocksperfile; /* output blocks per file */
char *host = NULL; /* remote host (if any) */
int sizest = 0; /* return size estimate only */
-int compressed = 0; /* use zlib to compress the output */
+int compressed = 0; /* use zlib to compress the output, compress level 1-9 */
long long bytes_written = 0; /* total bytes written */
long uncomprblks = 0;/* uncompressed blocks written */
#endif
"Mns:ST:uWw"
#ifdef HAVE_ZLIB
- "z"
+ "z::"
#endif
)) != -1)
#undef optstring
exit(X_FINOK); /* do nothing else */
#ifdef HAVE_ZLIB
case 'z':
- compressed = 1;
+ compressed = 2;
+ if (optarg)
+ compressed = numarg("compress level", 1L, 9L);
break;
#endif /* HAVE_ZLIB */
msg("Label: %s\n", spcl.c_label);
+ if (compressed)
+ msg("Compressing output at compression level %d\n", compressed);
+
#if defined(SIGINFO)
(void)signal(SIGINFO, statussig);
#endif
long tapekb = bytes_written / 1024;
double rate = .0005 + (double) spcl.c_tapea / tapekb;
msg("Wrote %ldKB uncompressed, %ldKB compressed,"
- " compression ratio %1.3f\n",
+ " %1.3f:1\n",
spcl.c_tapea, tapekb, rate);
}
#ifdef HAVE_ZLIB
"z"
#endif
- "] [-B records] [-b blocksize] [-d density]\n"
- "\t%s [-e inode#] [-f file] [-h level] [-s feet] [-T date] filesystem\n"
- "\t%s [-W | -w]\n", __progname, white, __progname);
+ "] [-B records] [-b blocksize]\n"
+ "\t%s [-d density] [-e inode#] [-f file] [-h level] [-s feet]\n"
+ "\t%s [-T date] [-z zlevel] filesystem\n"
+ "\t%s [-W | -w]\n",
+ __progname, white, white, __progname);
exit(X_STARTUP);
}
#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.36 2001/03/20 10:02:48 stelian Exp $";
+ "$Id: tape.c,v 1.37 2001/03/20 20:15:59 stelian Exp $";
#endif /* not lint */
#include <config.h>
if (compressed) {
double rate = .0005 + (double) blocks / (double) volkb;
msg("Volume %d %ldKB uncompressed, %ldKB compressed,"
- " compression ratio %1.3f\n",
+ " %1.3f:1\n",
tapeno, blocks, volkb, rate);
}
}
char *buffer;
#ifdef HAVE_ZLIB
struct tapebuf *comp_buf = NULL;
- int compresult, complevel = 6, do_compress = 0;
+ int compresult, do_compress = 0;
unsigned long worklen;
#endif /* HAVE_ZLIB */
struct slave_results returns;
#ifdef HAVE_ZLIB
/*
- * The first NR_SLAVE blocks are not compressed.
* When writing a compressed dump, each block is
* written from struct tapebuf with an 4 byte prefix
* followed by the data. This can be less than
* length read to the compressed length in the header
* to verify that the read was good. Blocks which don't
* compress well are written uncompressed.
+ * The first block written by each slave is not compressed.
*/
if (compressed) {
worklen = TP_BSIZE + writesize;
if (do_compress)
compresult = compress2(comp_buf->buf, &worklen,
- (char *)slp->tblock[0], writesize, complevel);
+ (char *)slp->tblock[0], writesize, compressed);
if (compresult == Z_OK && worklen <= writesize-32) {
/* write the compressed buffer */
comp_buf->length = worklen;