]> git.wh0rd.org - dump.git/commitdiff
Added Helmut Jarausch patch for restoring from multiple CD + examples.
authorStelian Pop <stelian@popies.net>
Wed, 12 Sep 2001 10:21:48 +0000 (10:21 +0000)
committerStelian Pop <stelian@popies.net>
Wed, 12 Sep 2001 10:21:48 +0000 (10:21 +0000)
CHANGES
dump.spec
dump/tape.c
examples/dump_on_cd/README [new file with mode: 0644]
examples/dump_on_cd/dump_userinfo.sh [new file with mode: 0755]
examples/dump_on_cd/start_dump.sh [new file with mode: 0755]
examples/dump_on_cd/verify_dump.sh [new file with mode: 0755]
restore/main.c
restore/restore.8.in
restore/restore.h
restore/tape.c

diff --git a/CHANGES b/CHANGES
index 328ead11a93926aef16c2c1aaeb3f3bb7642b376..3906dbbf87e6e2b4b84546f5e485f5909885e1aa 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.137 2001/09/12 09:02:51 stelian Exp $
+$Id: CHANGES,v 1.138 2001/09/12 10:21:48 stelian Exp $
 
 Changes between versions 0.4b23 and 0.4b24 (released ?????????????)
 ===================================================================
 
 Changes between versions 0.4b23 and 0.4b24 (released ?????????????)
 ===================================================================
@@ -40,6 +40,12 @@ Changes between versions 0.4b23 and 0.4b24 (released ?????????????)
 9.     Updated the RPM spec file following the RedHat changes 
        (dynamically linked binaries now in /usr/sbin etc).
 
 9.     Updated the RPM spec file following the RedHat changes 
        (dynamically linked binaries now in /usr/sbin etc).
 
+10.    Added a patch from Helmut Jarausch <jarausch@igpm.rwth-aachen.de>
+       which enables restore to recognise multi volume compressed dumps
+       done on CD. Included his scripts for dump (which pipe the dump
+       output directly into cdrecord) and restore. There is now 
+       possible to to backups to CD on the fly!
+
 Changes between versions 0.4b22 and 0.4b23 (released July 20, 2001)
 ===================================================================
 
 Changes between versions 0.4b22 and 0.4b23 (released July 20, 2001)
 ===================================================================
 
index e7d4a25cc75cdabf942c7badedcf9350e571dd08..02bce2ff6424961399a2e1e5a011e26b9b687f54 100644 (file)
--- a/dump.spec
+++ b/dump.spec
@@ -108,7 +108,7 @@ rm -rf %{buildroot}
 %files
 %defattr(-,root,root)
 %doc CHANGES COPYRIGHT KNOWNBUGS MAINTAINERS README REPORTING-BUGS THANKS TODO
 %files
 %defattr(-,root,root)
 %doc CHANGES COPYRIGHT KNOWNBUGS MAINTAINERS README REPORTING-BUGS THANKS TODO
-%doc dump.lsm
+%doc dump.lsm examples
 %attr(0664,root,disk)  %config(noreplace) %{_sysconfdir}/dumpdates
 %attr(0755,root,root)  /usr/sbin/dump
 /usr/sbin/rdump
 %attr(0664,root,disk)  %config(noreplace) %{_sysconfdir}/dumpdates
 %attr(0755,root,root)  /usr/sbin/dump
 /usr/sbin/rdump
index 644ed8a2ba92ab6a555598b1c234086f6f34cf4c..45535ea692e1c3adfbf9fd6b0dc3ca9ebb18cd88 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.56 2001/09/12 09:02:51 stelian Exp $";
+       "$Id: tape.c,v 1.57 2001/09/12 10:21:49 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
@@ -1122,6 +1122,7 @@ doslave(int cmd, int slave_number, int first)
                if (compressed && do_compress) {
                        comp_buf->length = bufsize;
                        worklen = TP_BSIZE + writesize;
                if (compressed && do_compress) {
                        comp_buf->length = bufsize;
                        worklen = TP_BSIZE + writesize;
+                       compresult = 1;
 #ifdef HAVE_ZLIB
                        if (!bzipflag) {
                                compresult = compress2(comp_buf->buf, 
 #ifdef HAVE_ZLIB
                        if (!bzipflag) {
                                compresult = compress2(comp_buf->buf, 
diff --git a/examples/dump_on_cd/README b/examples/dump_on_cd/README
new file mode 100644 (file)
index 0000000..ae04ce5
--- /dev/null
@@ -0,0 +1,53 @@
+                    Experimental dump to CDROMs
+                    ===========================
+
+Starting with dump/restore version 0.4b24 or later versions of 
+dump/restore you can dump to CDROMs.
+
+You need a (successfully installed) CD-writing software like
+  cdrecord (tested with versions 1.11a04 onwards)
+
+These scripts use the new switch ('V') to restore
+which signals a multi-volume (non-tape) medium like CDROMs
+
+I have used the shell scripts below to generate/verify the dump
+
+YOU MUST MODIFY these - especially
+
+- adapt FS to the filesystem to be dumped
+- UserExit to the path to the user exit function like UserInfo below
+- FiFo     to the path to a named pipe (better not on the same filesystem)
+- your cd device(s)  ( I have /dev/cdrom a symlink to /dev/sr0 and
+                              /dev/cdrw  a symlink to /dev/sr1 )
+- your path to cdrecord and
+- - cdrecord's dev parameter must be adapted to your CD burner
+- - cdrecord's fs (= input fifo size), use less than 64m if you
+    are short of memory
+- - cdrecord's speed parameter : this parameter not only depends on the
+    capabilities of your CD burner BUT also on the speed of your CPU !!!
+    With the dump -z6 compression on a 900 MHz Pentium III I had no problems
+    with speed=4 which is the maximum speed for my burner.
+    It looks as if at least speed=6 would be possible on a 900 MHz Pentium III.
+    If speed is to large, cdrecord's input fifo gets empty (as
+    shown by cdrecord) and then you have a buffer underrun.
+
+- replace the wayplay command with something which alerts you if you
+  have to change CDROMS
+
+- for restore or verification  replace /dev/cdrom by something
+  which applies for you (device for the CDreader)
+
+
+DON'T FORGET  to generate a boot-CD which has the 0.4b24 restore
+  or a newer version of restore on board
+
+I prefer timos_Rescue_Cd_Set-0.6.1  see  http://rescuecd.sourceforge.net
+
+
+Please Cc bug-reports to  jarausch@igpm.rwth-aachen.de
+
+-----------------------------------------------------------------
+This file and the scripts were slightly edited when the 
+Helmut Jarausch patch was integrated in dump-0.4b24.
+                                               Stelian.
+
diff --git a/examples/dump_on_cd/dump_userinfo.sh b/examples/dump_on_cd/dump_userinfo.sh
new file mode 100755 (executable)
index 0000000..9096048
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+# $1 = filename
+# $2 = sequence number
+
+wavplay -q /root/alert.wav
+num=$[$2+1]
+echo "insert next CD (number $num) "
+read -p "CD number $num ready? " Ans
+
+xterm -hold -T cdrecord_$num -e \
+  /usr/local/bin/cdrecord dev=0,1,0 fs=64m  \
+    -v speed=4 -eject -pad -data $1  &
diff --git a/examples/dump_on_cd/start_dump.sh b/examples/dump_on_cd/start_dump.sh
new file mode 100755 (executable)
index 0000000..df98c0a
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+if [ `id -u` != 0 ]; then 
+  echo "root priviledges are required"
+  exit 1
+fi
+Level=0
+Label=`date -I`
+#CD_Cap=650
+CD_Cap=700
+eval Cap=$(($CD_Cap*1024))
+FS=/
+UserExit=/root/dump_userinfo.sh
+FiFo=/tmp/dump.fifo
+rm -f $FiFo
+mkfifo $FiFo
+xterm -T cdrecord_1 -hold -e cdrecord dev=0,1,0 fs=64m \
+    -v speed=4 -eject -pad -data $FiFo &
+
+/sbin/dump -z6 -b64 -B$Cap -F $UserExit \
+ -$Level -L $Label -f $FiFo  $FS
+
+wavplay -q /root/alert.wav
+rm -f $FiFo
+
diff --git a/examples/dump_on_cd/verify_dump.sh b/examples/dump_on_cd/verify_dump.sh
new file mode 100755 (executable)
index 0000000..2b19702
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+if [ `id -u` != 0 ]; then 
+  echo "root priviledges are required"
+  exit 1
+fi
+cd /
+/sbin/restore -V -b64 -C -f /dev/cdrom
index 3feca826338866a97364a94d7555baa6538e1624..8368548dbc6d404e7466b490a949e3807f59adbf 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.28 2001/08/14 13:11:58 stelian Exp $";
+       "$Id: main.c,v 1.29 2001/09/12 10:21:49 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
@@ -81,7 +81,7 @@ static const char rcsid[] =
 #include "extern.h"
 
 int    bflag = 0, cvtflag = 0, dflag = 0, vflag = 0, yflag = 0;
 #include "extern.h"
 
 int    bflag = 0, cvtflag = 0, dflag = 0, vflag = 0, yflag = 0;
-int    hflag = 1, mflag = 1, Mflag = 0, Nflag = 0, zflag = 0;
+int    hflag = 1, mflag = 1, Mflag = 0, Nflag = 0, Vflag = 0, zflag = 0;
 int    uflag = 0;
 int    dokerberos = 0;
 char   command = '\0';
 int    uflag = 0;
 int    dokerberos = 0;
 char   command = '\0';
@@ -162,7 +162,7 @@ main(int argc, char *argv[])
 #ifdef USE_QFA
                "Q:"
 #endif
 #ifdef USE_QFA
                "Q:"
 #endif
-               "Rrs:tT:uvxX:y")) != -1)
+               "Rrs:tT:uvVxX:y")) != -1)
                switch(ch) {
                case 'b':
                        /* Change default tape blocksize. */
                switch(ch) {
                case 'b':
                        /* Change default tape blocksize. */
@@ -243,6 +243,9 @@ main(int argc, char *argv[])
                case 'v':
                        vflag = 1;
                        break;
                case 'v':
                        vflag = 1;
                        break;
+               case 'V':
+                       Vflag = 1;
+                       break;
                case 'X':
                        if( !strcmp(optarg,"-") ) {
                                use_stdin("-X");
                case 'X':
                        if( !strcmp(optarg,"-") ) {
                                use_stdin("-X");
@@ -525,12 +528,12 @@ usage(void)
 
        (void)fprintf(stderr,
          "usage:\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n",
 
        (void)fprintf(stderr,
          "usage:\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n\t%s%s\n",
-         __progname, " -C [-c" kerbflag "Mvy] [-b blocksize] [-D filesystem] [-f file] [-F script] [-s fileno]",
-         __progname, " -i [-ch" kerbflag "mMuvy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno]",
-         __progname, " -r [-c" kerbflag "Muvy] [-b blocksize] [-f file] [-F script] [-s fileno] [-T directory]",
-         __progname, " -R [-c" kerbflag "Muvy] [-b blocksize] [-f file] [-F script] [-s fileno] [-T directory]",
-         __progname, " -t [-ch" kerbflag "Muvy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]",
-         __progname, " -x [-ch" kerbflag "mMuvy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]");
+         __progname, " -C [-c" kerbflag "MvVy] [-b blocksize] [-D filesystem] [-f file] [-F script] [-s fileno]",
+         __progname, " -i [-ch" kerbflag "mMuvVy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno]",
+         __progname, " -r [-c" kerbflag "MuvVy] [-b blocksize] [-f file] [-F script] [-s fileno] [-T directory]",
+         __progname, " -R [-c" kerbflag "MuvVy] [-b blocksize] [-f file] [-F script] [-s fileno] [-T directory]",
+         __progname, " -t [-ch" kerbflag "MuvVy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]",
+         __progname, " -x [-ch" kerbflag "mMuvVy] [-b blocksize] [-f file] [-F script] " qfaflag "[-s fileno] [-X filelist] [file ...]");
        exit(1);
 }
 
        exit(1);
 }
 
index 96d91a8c164c969f94e42a03c63c557464f41c30..b13346acefeb872713c0b441de642023b89328d2 100644 (file)
@@ -29,7 +29,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\"    $Id: restore.8.in,v 1.16 2001/07/18 13:12:33 stelian Exp $
+.\"    $Id: restore.8.in,v 1.17 2001/09/12 10:21:49 stelian Exp $
 .\"
 .Dd __DATE__
 .Dt RESTORE 8
 .\"
 .Dd __DATE__
 .Dt RESTORE 8
@@ -40,7 +40,7 @@
 .Sh SYNOPSIS
 .Nm restore
 .Fl C
 .Sh SYNOPSIS
 .Nm restore
 .Fl C
-.Op Fl ckMvy
+.Op Fl ckMvVy
 .Op Fl b Ar blocksize
 .Op Fl D Ar filesystem
 .Op Fl f Ar file
 .Op Fl b Ar blocksize
 .Op Fl D Ar filesystem
 .Op Fl f Ar file
@@ -49,7 +49,7 @@
 .Op Fl T Ar directory
 .Nm restore
 .Fl i
 .Op Fl T Ar directory
 .Nm restore
 .Fl i
-.Op Fl chkmMNuvy
+.Op Fl chkmMNuvVy
 .Op Fl b Ar blocksize
 .Op Fl f Ar file
 .Op Fl F Ar script
 .Op Fl b Ar blocksize
 .Op Fl f Ar file
 .Op Fl F Ar script
@@ -58,7 +58,7 @@
 .Op Fl T Ar directory
 .Nm restore
 .Fl R
 .Op Fl T Ar directory
 .Nm restore
 .Fl R
-.Op Fl ckMNuvy
+.Op Fl ckMNuvVy
 .Op Fl b Ar blocksize
 .Op Fl f Ar file
 .Op Fl F Ar script
 .Op Fl b Ar blocksize
 .Op Fl f Ar file
 .Op Fl F Ar script
@@ -66,7 +66,7 @@
 .Op Fl T Ar directory
 .Nm restore
 .Fl r
 .Op Fl T Ar directory
 .Nm restore
 .Fl r
-.Op Fl ckMNuvy
+.Op Fl ckMNuvVy
 .Op Fl b Ar blocksize
 .Op Fl f Ar file
 .Op Fl F Ar script
 .Op Fl b Ar blocksize
 .Op Fl f Ar file
 .Op Fl F Ar script
@@ -74,7 +74,7 @@
 .Op Fl T Ar directory
 .Nm restore
 .Fl t
 .Op Fl T Ar directory
 .Nm restore
 .Fl t
-.Op Fl chkMNuvy
+.Op Fl chkMNuvVy
 .Op Fl b Ar blocksize
 .Op Fl f Ar file
 .Op Fl F Ar script
 .Op Fl b Ar blocksize
 .Op Fl f Ar file
 .Op Fl F Ar script
@@ -85,7 +85,7 @@
 .Op file ...
 .Nm restore
 .Fl x
 .Op file ...
 .Nm restore
 .Fl x
-.Op Fl chkmMNuvy
+.Op Fl chkmMNuvVy
 .Op Fl b Ar blocksize
 .Op Fl f Ar file
 .Op Fl F Ar script
 .Op Fl b Ar blocksize
 .Op Fl f Ar file
 .Op Fl F Ar script
@@ -433,6 +433,8 @@ The
 (verbose)
 flag causes it to type the name of each file it treats
 preceded by its file type.
 (verbose)
 flag causes it to type the name of each file it treats
 preceded by its file type.
+.It Fl V
+Enables reading multi-volume non-tape mediums like CDROMs.
 .It Fl X Ar filelist
 Read list of files to be listed or extracted from the text file
 .Ar filelist
 .It Fl X Ar filelist
 Read list of files to be listed or extracted from the text file
 .Ar filelist
index 81dfdc75d5a5e0c95e463619ee1af6fa82604659..8e353800ca816b0e78c3b50754f8c69c0589155e 100644 (file)
@@ -5,7 +5,7 @@
  *     Stelian Pop <pop@noos.fr>, 1999-2000
  *     Stelian Pop <pop@noos.fr> - Alcôve <www.alcove.fr>, 2000
  *
  *     Stelian Pop <pop@noos.fr>, 1999-2000
  *     Stelian Pop <pop@noos.fr> - Alcôve <www.alcove.fr>, 2000
  *
- *     $Id: restore.h,v 1.17 2001/08/13 16:17:52 stelian Exp $
+ *     $Id: restore.h,v 1.18 2001/09/12 10:21:49 stelian Exp $
  */
 
 /*
  */
 
 /*
@@ -57,6 +57,7 @@ extern int    dflag;          /* print out debugging info */
 extern int     hflag;          /* restore heirarchies */
 extern int     mflag;          /* restore by name instead of inode number */
 extern int     Mflag;          /* multi-volume restore */
 extern int     hflag;          /* restore heirarchies */
 extern int     mflag;          /* restore by name instead of inode number */
 extern int     Mflag;          /* multi-volume restore */
+extern int     Vflag;          /* multi-volume on a single device like CDROM */
 extern int     Nflag;          /* do not write the disk */
 extern int     uflag;          /* unlink symlink targets */
 extern int     vflag;          /* print out actions taken */
 extern int     Nflag;          /* do not write the disk */
 extern int     uflag;          /* unlink symlink targets */
 extern int     vflag;          /* print out actions taken */
index fb5c816e974ad6c3a6406d8d7d6282dece01fb97..344ca3b46fadd47079622653e5fcc07f19ac47d4 100644 (file)
@@ -46,7 +46,7 @@
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.46 2001/08/16 15:24:22 stelian Exp $";
+       "$Id: tape.c,v 1.47 2001/09/12 10:21:49 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
@@ -1492,6 +1492,9 @@ readtape_comprfile(char *buf)
 
        /* read the block prefix */
        ret = read_a_block(mt, tapebuf, PREFIXSIZE, &rl);
 
        /* read the block prefix */
        ret = read_a_block(mt, tapebuf, PREFIXSIZE, &rl);
+
+       if (Vflag && (ret == 0 || rl < PREFIXSIZE  ||  tpb->length == 0))
+               ret = 0;
        if (ret <= 0)
                goto readerr;
 
        if (ret <= 0)
                goto readerr;
 
@@ -1932,7 +1935,9 @@ setmagtapein(void) {
                        magtapein = ioctl(mt, MTIOCGET, (char *)&mt_stat) == 0;
        }
 
                        magtapein = ioctl(mt, MTIOCGET, (char *)&mt_stat) == 0;
        }
 
-       Vprintf(stdout,"Input is from %s\n", magtapein? "tape": "file/pipe");
+       Vprintf(stdout,"Input is from %s\n", 
+                       magtapein ? "tape" :
+                       Vflag ? "multi-volume (no tape)" : "file/pipe");
 }
 
 /*
 }
 
 /*