From: Stelian Pop Date: Mon, 11 Oct 1999 13:08:02 +0000 (+0000) Subject: Version 0.4b7. X-Git-Tag: release_0_4b7 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=8d4197bb9ba5bbcef21409231ed8903b0cac353a;p=dump.git Version 0.4b7. --- diff --git a/CHANGES b/CHANGES index 7e9b617..5695986 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,53 @@ -Changes between versions 0.4b5 and 0.4b6 -======================================== +Changes between versions 0.4b6 and 0.4b7 (released October 8, 1999) +=================================================================== + +1. Removed the 'k' flag from the restore 'about' text if kerberos + was not compiled in. + +2. Prototyped (f)setflags from e2fsprogs and corrected the calls + to them (fsetflags takes a char*, setflags an open fd!). + +3. (f)setflags is called only if the flags aren't empty. If the + file is a special file, a warning is printed, because changing + flags implies opening the device. Normally, a special file + should not have any flag... (Debian bug #29775, patch provided + by Abhijit Dasgupta ). + +4. Made possible to dump a file system not mentioned in /etc/fstab. + (Debian bug #11904, patch provided by Eirik Fuller ). + +5. Changed the default behaviour to not create dumpdates + unless 'u' option is specified. Removed the old "debian-patch" + which provided the same thing. (Debian bug #38136, #33818). + +6. Removed all those dump*announce, since they were getting old... + +7. Added warning messages if dumpdates does not exist and + when an inferior level dump does not exist (except for a level 0 + dump). + +8. Debugged the glob calls in interactive mode: restore used a + dirent struct which was different from the /usr/include/dirent.h + one (this used to work, is it a glibc2 change?), so none of the + compat glob (which used /usr/include/dirent.h) or the system glob + worked. Restore use now the system dirent (and the system + DT_* constants), which are compatible with BSD ones. + +9. Added a configure flag (--with-dumpdatespath) to specify + the location of dumpdates file. By default, it is + /etc/dumpdates. + +10. Added the "AUTHOR" and "AVAILABILITY" sections and + included the current date/version in man pages. + +11. Corrected the estimation of remaining time when + the operator doesn't change the tapes quickly enough. This + was an old bug, I thought I corrected it, and discovered + that in fact it was corrected in two different places, so + the results canceled each other... + +Changes between versions 0.4b5 and 0.4b6 (released October 1, 1999) +=================================================================== 1. Integrated multiple patches from RedHat, Debian and SuSE: @@ -14,13 +62,19 @@ Changes between versions 0.4b5 and 0.4b6 - workaround egcs bug (RedHat bugs #4281 and #2989). - wire $(OPT) throughout Makefile's. -2. Fix some compile warnings, prototype all functions. +2. Upgrade the dump revision to 1, making possible to dump filesystems + made with e2fsprogs-1.15 or newer. Nothing seems to break... -3. Use glibc err/glob instead of internal compatibility +3. Fix some compile warnings, prototype all functions. + +4. Use glibc err/glob instead of internal compatibility routines (only if available). -Changes between versions 0.4b4 and 0.4b5 -======================================== +5. Fix a compile error on Linux 2.2.7 / libc5 (5.4.44) (patch provided + by Bernhard Sadlowski ). + +Changes between versions 0.4b4 and 0.4b5 (released September 22, 1999) +====================================================================== 1. Integrated the changes from FreeBSD-3.1-RELEASE (mostly bug fixes, buffer overruns, dump has now an "automatic @@ -37,8 +91,8 @@ Changes between versions 0.4b4 and 0.4b5 4. Corrected the long standing bug when dumping multiple tapes. This works for me, needs further testing. -Changes between versions 0.4b3 and 0.4b4 -======================================== +Changes between versions 0.4b3 and 0.4b4 (released January 17, 1997) +==================================================================== 1. Dump now runs correctly on kernels 2.1.x Fix made by Gerald Peters diff --git a/MCONFIG.in b/MCONFIG.in index 7bb0410..4c73eda 100644 --- a/MCONFIG.in +++ b/MCONFIG.in @@ -2,6 +2,9 @@ VPATH= $(srcdir) top_builddir= @top_builddir@ +VERSION= dump 0.4b7 +DATE= October 8, 1999 + AR= @AR@ CC= @CC@ INSTALL= @INSTALL@ @@ -24,6 +27,7 @@ INSTALLMAN= $(INSTALL) -o $(MANOWNER) -g $(MANGRP) -m $(MANMODE) BINDIR= /sbin MANDIR= /usr/man/man8 +DUMPDATESPATH= @DUMPDATESPATH@ # # Global include directories # diff --git a/Makefile.in b/Makefile.in index 68e861e..34152c7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,7 +4,7 @@ top_srcdir= @top_srcdir@ @MCONFIG@ RM= @RM@ -SUBDIRS= compat/lib common dump restore @RMTDIR@ +SUBDIRS= compat/lib compat/include common dump restore @RMTDIR@ all clean install dep depend realclean distclean:: for i in $(SUBDIRS); do \ diff --git a/THANKS b/THANKS index 427f2cf..092b0c5 100644 --- a/THANKS +++ b/THANKS @@ -9,7 +9,8 @@ Kevin Layer added the comparison code in restore. Doug Paul helped me to make dump able to backup 2GB+ filesystems. -David Frey (the Debian dump maintainer) and the people +David Frey (the old Debian dump maintainer), +Bdale Garbee (the new Debian dump maintainer) and the people from Red Hat Software provided lots of patches. Stelian Pop is now the current maintainer (since @@ -19,7 +20,8 @@ Thanks to people who reported problems with the port, sent patches, and suggested various improvements. Here is a partial list of them (if I have forgotten someone, please complain): -Bdale Garbee ndale@gag.com +Abhijit Dasgupta abhijit@ans.net +Eirik Fuller eirik@netcom.com Henry Katz hkatz@hkatz.dialup.access.net Klaus Kudielka kkudielk@cacofonix.nt.tuwien.ac.at Florian La Roche florian@jurix.jura.uni-sb.de diff --git a/TODO b/TODO index 33b773f..1fdb8e3 100644 --- a/TODO +++ b/TODO @@ -5,3 +5,25 @@ 2. Make dump able to backup several directories and/or files in one invocation, like the SunOS version. + +3. Verify that dump works correctly on rev 1 ext2fses (need success + reports) + +4. More documentation? Examples, crontab? + +5. Verify that dump works with kerberos authentification (this + was ported from *BSD and was not tested - in fact, this + wasn't even compiled in!). Need success reports for this. + +6. Explore and correct dump problems on a 4GB+ filesystem. + +7. Clean-up the code by removing all those #ifdef _BSD, + since nobody would ever re-compile this on a BSD system. + Since the tape format is the same, the native BSD + restore can be used to restore tapes... + +8. Reimplement the ext2 specific code in a "backend" and + make the dump code more generic. This would allow creation + of other backends for other filesystems. Implementing a + (v)fat backend should be quite easy, as for BSD ffs (we + already have the code for this). diff --git a/common/dumprmt.c b/common/dumprmt.c index b7cf041..6a79d07 100644 --- a/common/dumprmt.c +++ b/common/dumprmt.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)dumprmt.c 8.3 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id: dumprmt.c,v 1.3 1999/10/11 12:59:16 stelian Exp $"; + "$Id: dumprmt.c,v 1.4 1999/10/11 13:08:06 stelian Exp $"; #endif /* not lint */ #ifdef __linux__ diff --git a/compat/include/Makefile.in b/compat/include/Makefile.in new file mode 100644 index 0000000..9c2e02b --- /dev/null +++ b/compat/include/Makefile.in @@ -0,0 +1,24 @@ +top_srcdir= @top_srcdir@ +srcdir= @srcdir@ + +@MCONFIG@ + +all:: pathnames.h + +pathnames.h: pathnames.h.in + sed -e "s|__DUMPDATES__|$(DUMPDATESPATH)|g" $< > $@ + +install:: + +clean:: + $(RM) -f \#* *~ core pathnames.h + +distclean:: clean + $(RM) -f Makefile Makefile.old .depend + +# +++ Dependency line eater +++ +# +# Makefile dependencies follow. This must be the last section in +# the Makefile.in file +# + diff --git a/compat/include/bsdcompat.h b/compat/include/bsdcompat.h index 421e4cf..7a3b11e 100644 --- a/compat/include/bsdcompat.h +++ b/compat/include/bsdcompat.h @@ -8,6 +8,7 @@ #include #include +#include #define __dead volatile @@ -107,7 +108,9 @@ struct dinode { * This is the 4.4BSD directory entry structure */ #define DIRBLKSIZ DEV_BSIZE +#ifndef MAXNAMLEN #define MAXNAMLEN 255 +#endif struct direct { __u32 d_ino; @@ -121,19 +124,6 @@ struct direct { char d_name[MAXNAMLEN + 1]; }; -/* - * File types - */ -#define DT_UNKNOWN 0 -#define DT_FIFO 1 -#define DT_CHR 2 -#define DT_DIR 4 -#define DT_BLK 6 -#define DT_REG 8 -#define DT_LNK 10 -#define DT_SOCK 12 -#define DT_WHT 14 - /* * Convert between stat structure types and directory types. */ diff --git a/compat/include/compaterr.h b/compat/include/compaterr.h index a45bb98..3aed6ba 100644 --- a/compat/include/compaterr.h +++ b/compat/include/compaterr.h @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * @(#)err.h 8.1 (Berkeley) 6/2/93 - * $Id: compaterr.h,v 1.1 1999/10/11 12:59:17 stelian Exp $ + * $Id: compaterr.h,v 1.2 1999/10/11 13:08:06 stelian Exp $ */ #ifndef _ERR_H_ diff --git a/compat/include/pathnames.h b/compat/include/pathnames.h deleted file mode 100644 index 3e4194a..0000000 --- a/compat/include/pathnames.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Ported to Linux's Second Extended File System as part of the - * dump and restore backup suit - * Remy Card , 1994-1997 - * Stelian Pop , 1999 - * - */ - -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)pathnames.h 8.1 (Berkeley) 6/5/93 - */ - -#include - -#define _PATH_DEFTAPE "/dev/st0" -#define _PATH_DTMP "/etc/dtmp" -#define _PATH_DUMPDATES "/etc/dumpdates" -#define _PATH_LOCK "/tmp/dumplockXXXXXX" -#define _PATH_RMT "/etc/rmt" /* path on remote host */ diff --git a/compat/include/pathnames.h.in b/compat/include/pathnames.h.in new file mode 100644 index 0000000..1679565 --- /dev/null +++ b/compat/include/pathnames.h.in @@ -0,0 +1,50 @@ +/* + * Ported to Linux's Second Extended File System as part of the + * dump and restore backup suit + * Remy Card , 1994-1997 + * Stelian Pop , 1999 + * + */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)pathnames.h 8.1 (Berkeley) 6/5/93 + */ + +#include + +#define _PATH_DEFTAPE "/dev/st0" +#define _PATH_DTMP "/etc/dtmp" +#define _PATH_DUMPDATES "__DUMPDATES__" +#define _PATH_LOCK "/tmp/dumplockXXXXXX" +#define _PATH_RMT "/etc/rmt" /* path on remote host */ diff --git a/compat/lib/compaterr.c b/compat/lib/compaterr.c index a77f1ba..d882068 100644 --- a/compat/lib/compaterr.c +++ b/compat/lib/compaterr.c @@ -42,7 +42,7 @@ #if defined(LIBC_RCS) && !defined(lint) static const char rcsid[] = - "$Id: compaterr.c,v 1.1 1999/10/11 12:59:17 stelian Exp $"; + "$Id: compaterr.c,v 1.2 1999/10/11 13:08:07 stelian Exp $"; #endif /* LIBC_RCS and not lint */ #include diff --git a/configure b/configure index 754af59..096ebde 100755 --- a/configure +++ b/configure @@ -11,8 +11,6 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: -ac_help="$ac_help - --enable-dumpdates-patch apply the dumpdates patch from Debian" ac_help="$ac_help --enable-debug include debugging code" ac_help="$ac_help @@ -39,6 +37,8 @@ ac_help="$ac_help --with-mangrp=group select group for manual pages" ac_help="$ac_help --with-manmode=MODE select mode for manual pages" +ac_help="$ac_help + --with-dumpdatespath=path select path for dumpdates file" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -1269,21 +1269,6 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -# Check whether --enable-dumpdates-patch or --disable-dumpdates-patch was given. -if test "${enable_dumpdates_patch+set}" = set; then - enableval="$enable_dumpdates_patch" - if test "$enableval" = "yes" -then - if test "$PATCH" = ":" - then - { echo "configure: error: The patch program was not found on your system" 1>&2; exit 1; } - fi - (cd $srcdir; $PATCH -p < debian-patch) -fi - -fi - - # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" @@ -1459,8 +1444,20 @@ echo "MANMODE defaults to $MANMODE" fi +# Check whether --with-dumpdatespath or --without-dumpdatespath was given. +if test "${with_dumpdatespath+set}" = set; then + withval="$with_dumpdatespath" + echo "$ac_t""DUMPDATESPATH is $withval" 1>&6 +DUMPDATESPATH=$withval +else + DUMPDATESPATH="/etc/dumpdates" +echo "DUMPDATESPATH defaults to $DUMPDATESPATH" + +fi + + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1464: checking how to run the C preprocessor" >&5 +echo "configure:1461: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1475,13 +1472,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1492,13 +1489,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1502: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1509,13 +1506,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1516: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1541,17 +1538,17 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "ext2fs/ext2fs.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for ext2fs/ext2fs.h""... $ac_c" 1>&6 -echo "configure:1545: checking for ext2fs/ext2fs.h" >&5 +echo "configure:1542: checking for ext2fs/ext2fs.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1555: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1552: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1574,7 +1571,7 @@ ext2fs_h=no fi echo $ac_n "checking for ext2fs_open in -lext2fs""... $ac_c" 1>&6 -echo "configure:1578: checking for ext2fs_open in -lext2fs" >&5 +echo "configure:1575: checking for ext2fs_open in -lext2fs" >&5 ac_lib_var=`echo ext2fs'_'ext2fs_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1582,7 +1579,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lext2fs -lcom_err $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1621,12 +1618,12 @@ fi for ac_func in err errx verr verrx vwarn vwarnx warn warnx realpath glob do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1625: checking for $ac_func" >&5 +echo "configure:1622: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1675,12 +1672,12 @@ done echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1679: checking for ANSI C header files" >&5 +echo "configure:1676: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1688,7 +1685,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1689: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1705,7 +1702,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1723,7 +1720,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1744,7 +1741,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1755,7 +1752,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1779,12 +1776,12 @@ EOF fi echo $ac_n "checking for quad_t""... $ac_c" 1>&6 -echo "configure:1783: checking for quad_t" >&5 +echo "configure:1780: checking for quad_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_quad_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1812,12 +1809,12 @@ EOF fi echo $ac_n "checking for u_quad_t""... $ac_c" 1>&6 -echo "configure:1816: checking for u_quad_t" >&5 +echo "configure:1813: checking for u_quad_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_u_quad_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1952,7 +1949,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "MCONFIG Makefile common/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/configure.in b/configure.in index b6037a0..a66f628 100644 --- a/configure.in +++ b/configure.in @@ -19,22 +19,6 @@ AC_CHECK_TOOL(PATCH, patch, :) AC_PROG_CC AC_PROG_INSTALL -dnl -dnl Handle --enable-dumpdates-patch -dnl -AC_ARG_ENABLE([dumpdates-patch], -[ --enable-dumpdates-patch apply the dumpdates patch from Debian], -if test "$enableval" = "yes" -then - if test "$PATCH" = ":" - then - AC_MSG_ERROR(The patch program was not found on your system) - fi - (cd $srcdir; $PATCH -p < debian-patch) -fi -, -) - dnl dnl Handle --enable-debug dnl @@ -207,6 +191,18 @@ echo "MANMODE defaults to $MANMODE" )dnl AC_SUBST(MANMODE) +dnl +dnl set $(DUMPDATESPATH) from --with-dumpdatespath +dnl +AC_ARG_WITH([dumpdatespath], +[ --with-dumpdatespath=path select path for dumpdates file], +AC_MSG_RESULT(DUMPDATESPATH is $withval) +DUMPDATESPATH=$withval, +DUMPDATESPATH="/etc/dumpdates" +echo "DUMPDATESPATH defaults to $DUMPDATESPATH" +)dnl +AC_SUBST(DUMPDATESPATH) + dnl dnl Check for Ext2fs headers and libraries dnl @@ -242,4 +238,4 @@ test -d compat/lib || mkdir compat/lib dnl dnl Output files dnl -AC_OUTPUT(MCONFIG Makefile common/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE) +AC_OUTPUT(MCONFIG Makefile common/Makefile compat/include/Makefile compat/lib/Makefile dump/Makefile restore/Makefile $RMTMAKEFILE) diff --git a/debian-patch b/debian-patch deleted file mode 100644 index b0349f2..0000000 --- a/debian-patch +++ /dev/null @@ -1,178 +0,0 @@ ---- dump/dump.h.orig Sun Dec 15 22:14:30 1996 -+++ dump/dump.h Wed Dec 25 16:11:06 1996 -@@ -40,6 +40,9 @@ - * @(#)dump.h 8.2 (Berkeley) 4/28/95 - */ - -+/* /etc/dumpdates will not be created, when not already here (Bug#3806). -+ David Frey */ -+ - #define MAXINOPB (MAXBSIZE / sizeof(struct dinode)) - #define MAXNINDIR (MAXBSIZE / sizeof(daddr_t)) - -@@ -195,8 +198,8 @@ - int nddates; /* number of records (might be zero) */ - int ddates_in; /* we have read the increment file */ - struct dumpdates **ddatev; /* the arrayfied version */ --void initdumptimes __P((void)); --void getdumptime __P((void)); -+void initdumptimes __P((int)); -+void getdumptime __P((int)); - void putdumptime __P((void)); - #define ITITERATE(i, ddp) \ - for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i]) ---- dump/itime.c.orig Sun Dec 15 22:14:30 1996 -+++ dump/itime.c Wed Dec 25 16:18:15 1996 -@@ -4,6 +4,8 @@ - * Remy Card , 1994, 1995, 1996 - * - */ -+/* /etc/dumpdates will not be created, when not already here (Bug#3806). -+ David Frey */ - - /*- - * Copyright (c) 1980, 1993 -@@ -88,7 +90,8 @@ - static void readdumptimes __P((FILE *)); - - void --initdumptimes() -+initdumptimes(createdumpdates) -+int createdumpdates; - { - FILE *df; - -@@ -101,22 +104,26 @@ - /* - * Dumpdates does not exist, make an empty one. - */ -- msg("WARNING: no file `%s', making an empty one\n", dumpdates); -- if ((df = fopen(dumpdates, "w")) == NULL) { -- quit("cannot create %s: %s\n", dumpdates, -- strerror(errno)); -- /* NOTREACHED */ -+ if (createdumpdates) { -+ msg("WARNING: no file `%s', making an empty one\n", dumpdates); -+ if ((df = fopen(dumpdates, "w")) == NULL) { -+ quit("cannot create %s: %s\n", dumpdates, -+ strerror(errno)); -+ /* NOTREACHED */ -+ } -+ (void) fclose(df); -+ if ((df = fopen(dumpdates, "r")) == NULL) { -+ quit("cannot read %s even after creating it: %s\n", -+ dumpdates, strerror(errno)); -+ /* NOTREACHED */ -+ } - } -+ } -+ if (df != NULL) { -+ (void) flock(fileno(df), LOCK_SH); -+ readdumptimes(df); - (void) fclose(df); -- if ((df = fopen(dumpdates, "r")) == NULL) { -- quit("cannot read %s even after creating it: %s\n", -- dumpdates, strerror(errno)); -- /* NOTREACHED */ -- } - } -- (void) flock(fileno(df), LOCK_SH); -- readdumptimes(df); -- (void) fclose(df); - } - - static void -@@ -148,7 +155,8 @@ - } - - void --getdumptime() -+getdumptime(createdumpdates) -+int createdumpdates; - { - register struct dumpdates *ddp; - register int i; -@@ -162,7 +170,9 @@ - spcl.c_ddate = 0; - lastlevel = '0'; - -- initdumptimes(); -+ initdumptimes(createdumpdates); -+ if (ddp == NULL) -+ return; - /* - * Go find the entry with the same name for a lower increment - * and older date ---- dump/main.c.orig Sun Dec 15 22:14:30 1996 -+++ dump/main.c Wed Dec 25 16:09:26 1996 -@@ -4,6 +4,8 @@ - * Remy Card , 1994, 1995, 1996 - * - */ -+/* /etc/dumpdates will not be created, when not already here (Bug#3806). -+ David Frey */ - - /*- - * Copyright (c) 1980, 1991, 1993, 1994 -@@ -331,7 +333,7 @@ - spcl.c_level = level - '0'; - spcl.c_type = TS_TAPE; - if (!Tflag) -- getdumptime(); /* /etc/dumpdates snarfed */ -+ getdumptime(uflag); /* /etc/dumpdates snarfed */ - - msg("Date of this level %c dump: %s", level, - #ifdef __linux ---- dump/optr.c.orig Sun Dec 15 22:14:30 1996 -+++ dump/optr.c Wed Dec 25 16:09:26 1996 -@@ -4,6 +4,8 @@ - * Remy Card , 1994, 1995, 1996 - * - */ -+/* /etc/dumpdates will not be created, when not already here (Bug#3806). -+ David Frey */ - - /*- - * Copyright (c) 1980, 1988, 1993 -@@ -534,22 +536,24 @@ - { - register int i; - register struct fstab *dt; -- register struct dumpdates *dtwalk; -+ register struct dumpdates *dtwalk=NULL; - char *lastname, *date; - int dumpme; - time_t tnow; - - (void) time(&tnow); - getfstab(); /* /etc/fstab input */ -- initdumptimes(); /* /etc/dumpdates input */ -- qsort((char *) ddatev, nddates, sizeof(struct dumpdates *), datesort); -- -- if (arg == 'w') -- (void) printf("Dump these file systems:\n"); -- else -+ initdumptimes(0); /* /etc/dumpdates input */ -+ if (*ddatev != NULL) -+ { -+ qsort((char *) ddatev, nddates, sizeof(struct dumpdates *), datesort); -+ -+ if (arg == 'w') -+ (void) printf("Dump these file systems:\n"); -+ else - (void) printf("Last dump(s) done (Dump '>' file systems):\n"); -- lastname = "??"; -- ITITERATE(i, dtwalk) { -+ lastname = "??"; -+ ITITERATE(i, dtwalk) { - if (strncmp(lastname, dtwalk->dd_name, - sizeof(dtwalk->dd_name)) == 0) - continue; -@@ -568,6 +572,7 @@ - dt ? dt->fs_file : "", - dtwalk->dd_level, - date); -+ } - } - } - diff --git a/dump-0.2.announce b/dump-0.2.announce deleted file mode 100644 index 9ddec37..0000000 --- a/dump-0.2.announce +++ /dev/null @@ -1,41 +0,0 @@ - - Finally... The public test version of my port of the 4.4BSD dump -and restore programs to Linux is now available on tsx-11.mit.edu in the -directory /pub/linux/packages/ext2fs. - - This port understands the Ext2fs structure and is able to backup -and restore Linux Ext2 filesystems. This is a test version and I have only -made minimal testing so do not rely too much on it for your backups. - - This version of dump contains all the BSD features and also includes -some enhancements over the previous test versions: - - it is possible to backup a subtree instead of a whole filesystem, - - some bugs have been fixed :-) - - dump is now able to backup filesystems bigger than 2 GB, - - the dump format is now compatible with 4.3BSD. This means that you - can restore Linux dumps on BSD based operating systems and you can - restore BSD dumps on Linux. I have made some tests with FreeBSD - and SunOS 4.1.3 and this works fine. I am interested in reports - about other BSD based operating systems. - - I am not sure that multi-volume dumps are Ok. If you use them, please -send me a bug (or success :-) report. - - The dump format is *not* compatible with the previous test versions -(versions 0.0 and 0.1), which were distributed as private test versions. If -you have backups made by dump 0.0 or 0.1, restore 0.2 will not be able to -read them. - - You need the latest ext2fs programs source distribution to compile dump -and restore because I have used Theodore T'so's Ext2fs library. The latest -version (0.5b) of these programs is available on tsx-11.mit.edu in the -directory /pub/linux/packages/ext2fs. If you want to build ELF binaries, you -also need to get my ELF patch on ftp.ibp.fr in /pub/linux/ELF/patches. - - I'd like to thank all the people who have used the private test -versions of dump and restore. I have appreciated their feedback that has -helped me to improve dump and restore. - --- -Remy Card -Remy.Card@freenix.fr diff --git a/dump-0.2a.announce b/dump-0.2a.announce deleted file mode 100644 index 130ac8a..0000000 --- a/dump-0.2a.announce +++ /dev/null @@ -1,27 +0,0 @@ - - I have received bug reports about dump telling that dump receives -unexpected signals when dump directories (in pass III). I have tried to -reproduce the problem and it appears that this may be caused by an optimization -problem in some versions of gcc. Dump works fine when compiled with -optimization by gcc 2.6.2 but it fails when compiled by gcc 2.6.3: - - either it gets an unexpected signal (SIGFPE), - - or it issues warnings ``Warning: dumpdirino called with file type - 040000'' and does not dump directories. - - I am not courageous enough to study the assembly code generated by -gcc (yet :-), so I have modified the Makefiles to compile dump without -optimizations. I have also fixed a few minor bugs and removed some printf's -that I had added during my tests. I will study the assembly code generated -by gcc soon and fix the problem. - - The fixed version (numbered 0.2a) is now available on tsx-11.mit.edu -in the directory /pub/linux/packages/ext2fs. Please get it if you are using -dump and restore. - - Thanks to Daniel Veillard , Bob Snyder -, and Florian La Roche for -their reports and their help! - --- -Remy Card -Remy.Card@freenix.fr diff --git a/dump-0.2b.announce b/dump-0.2b.announce deleted file mode 100644 index b378ec4..0000000 --- a/dump-0.2b.announce +++ /dev/null @@ -1,28 +0,0 @@ - - I have received bug reports about dump telling that dump receives -unexpected signals when dump directories (in pass III). I have tried to -reproduce the problem and it appears that this may be caused by an optimization -problem in some versions of gcc. Dump works fine when compiled with -optimization by gcc 2.6.2 but it fails when compiled by gcc 2.6.3: - - either it gets an unexpected signal (SIGFPE), - - or it issues warnings ``Warning: dumpdirino called with file type - 040000'' and does not dump directories. - - Finding the problem was not an easy task because the behavior seemed -to be related to the version of the compiler. Anyway, I have found it :-) -There was an incorrect assignement in the function dumpdirino(), which is -responsible for dumping the contents of directories, and this caused some -problems when compiled with optimizations by some versions of gcc. After -fixing the problem, dump runs fine when compiled by gcc 2.6.3 or gcc 2.7.0. - - The new fixed version (numbered 0.2b) is now available on -tsx-11.mit.edu in the directory /pub/linux/packages/ext2fs. Please get it -if you are using dump and restore. - - Thanks to Daniel Veillard , Bob Snyder -, and Florian La Roche for -their reports and their help! - --- -Remy Card -Remy.Card@freenix.fr diff --git a/dump-0.2c.announce b/dump-0.2c.announce deleted file mode 100644 index d0da6b7..0000000 --- a/dump-0.2c.announce +++ /dev/null @@ -1,12 +0,0 @@ - - Yet another bug fix release of dump/restore for Ext2fs is available -on tsx-11.mit.edu in /pub/linux/packages/ext2fs/dump-0.2c.tar.gz. - - A stupid bug has been fixed. This bug caused an incorrect dump of -``slow'' (i.e. normal) symbolic links. There is no new features (yet :-). - - Thanks to the many people who have sent me success and bug reports! - --- -Remy Card -Remy.Card@freenix.fr diff --git a/dump-0.2d.announce b/dump-0.2d.announce deleted file mode 100644 index afc10d5..0000000 --- a/dump-0.2d.announce +++ /dev/null @@ -1,12 +0,0 @@ - - Ok, I am still trying to saturate comp.os.linux.announce :-) Yet -another bug fix release of dump/restore for Ext2fs is available on -tsx-11.mit.edu in /pub/linux/packages/ext2fs/dump-0.2d.tar.gz. - - Dump is now able to backup 2GB+ filesystems. Thanks to Doug Paul - for the patch. Dump and restore can now be linked as -static binaries (you have to edit the file MCONFIG before building them). - --- -Remy Card -Remy.Card@freenix.fr diff --git a/dump-0.2e.announce b/dump-0.2e.announce deleted file mode 100644 index cdf5c0b..0000000 --- a/dump-0.2e.announce +++ /dev/null @@ -1,19 +0,0 @@ - - Dump 0.2e is now available on tsx-11.mit.edu in the directory -/pub/linux/packages/ext2fs. - - A stupid bug in the "set owner/mode" pass has been fixed. Files were -restored with uid=0 and gid=0. The bug was in restore, not in dump, so this -means that backups made with dump 0.2d are Ok. Thanks to Brent Olson - for reporting this problem. - - Thanks also to the patience of the testers :-) - - I remind you that dump and restore should be considered as software -in BETA test. Don't rely too much on them for your backups... - --- -Remy Card -Remy.Card@freenix.fr - -No to french nuclear experiments! diff --git a/dump-0.3.announce b/dump-0.3.announce deleted file mode 100644 index c5ebc2a..0000000 --- a/dump-0.3.announce +++ /dev/null @@ -1,32 +0,0 @@ - - Ok, I'm back ;-) - - Dump 0.3 is now available on tsx-11.mit.edu in the directory -/pub/linux/packages/ext2fs. - - Restore is now able to restore named pipes (fifos). Thanks to -Jason Venner for reporting the bug. I have also fixed -a bug in the symlink restoration: owner and group were not set by previous -version. Thanks to Klaus Kudielka for -reporting it. Restore is now able to restore correctly files ending with -a hole (mainly DLL shared libraries under Linux). Thanks to David Monro - for sending me a patch much cleaner than mine :-) - - Kevin Layer has implemented a verify option in -restore. It is now possible to check a dump against the contents of the -filesystem. Thank you very much, Kevin! - - Some bug fixes from FreeBSD 2.2-current have also been integrated. - - Last, I have added the file `linux-1.2.x.patch' in the distribution. -This patch for 1.2 kernels should be applied if you want to get better -performances. - - I remind you that dump and restore should be considered as software -in BETA test. Don't rely too much on them for your backups... - --- -Remy Card -Remy.Card@freenix.fr - -No to nuclear testings! diff --git a/dump-0.4b1.announce b/dump-0.4b1.announce deleted file mode 100644 index 9054672..0000000 --- a/dump-0.4b1.announce +++ /dev/null @@ -1,35 +0,0 @@ - - A test release of dump 0.4 is now available on tsx-11.mit.edu, -in the file /pub/linux/ALPHA/ext2fs/dump-0.4b1.tar.gz. - - This new version is based on the latest dump and restore suite -available from Berkeley (I have integrated the changes from 4.4BSD-Lite2). - - It also includes lots of changes from the Debian 1.2 and Red Hat 4.0 -distributions (I have included most of the patches made by maintainers of -these distributions). - - Some changes were made to improve the portability of dump and restore: - - fixed size types are now used, so that the dump format is the same - on every architecture supported by Linux, - - dump now uses the Ext2fs library to get the block addresses - to solve an endianness problem that was present on SparcLinux. - - Autoconf is now used to configure dump and restore. I have shamelessly -adapted the configure script from the one present in the e2fsprogs -distribution (thanks Ted!). - - Last, a few minor bugs have been fixed. - - This version is a test release. Use it only for testing :-) New -beta versions will probably be released before a stable dump 0.4 version is -available. - - If you encounter problems with this test release, please send a -detailled bug report (please look at the file KNOWNBUGS before sending a -bug report). - --- -Remy Card -card@Linux.EU.Org - diff --git a/dump.lsm b/dump.lsm index b72e9ab..4c5c534 100644 --- a/dump.lsm +++ b/dump.lsm @@ -1,15 +1,15 @@ Begin3 Title: dump and restore for Ext2fs -Version: 0.4b6 -Entered-date: 03OCT99 +Version: 0.4b7 +Entered-date: 08OCT99 Description: Port of the 4.4BSD dump and restore backup suite Keywords: backup, filesystem, Ext2fs Author: University of California, Berkeley Maintained-by: pop@cybercable.fr (Stelian Pop) Primary-site: tsx-11.mit.edu /pub/linux/ALPHA/ext2fs - 132kB dump-0.4b6.tar.gz - 627 dump.lsm -Alternate-site: + 129kB dump-0.4b7.tar.gz + 677 dump.lsm +Alternate-site: http://perso.cybercable.fr/pop/dump Original-site: ftp.freebsd.org /pub/bsd-sources/4.4BSD-Lite2/sbin dump/* restore/* diff --git a/dump/Makefile.in b/dump/Makefile.in index a2e872a..2843a7b 100644 --- a/dump/Makefile.in +++ b/dump/Makefile.in @@ -16,12 +16,17 @@ OBJS= itime.o main.o optr.o tape.o traverse.o unctime.o \ MAN8= dump.8 MLINKS= dump.8 $(MANDIR)/rdump.8 -all:: $(PROG) +all:: $(PROG) dump.8 $(PROG): $(OBJS) $(DEPLIBS) $(LD) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) -install:: $(PROG) +dump.8: dump.8.in + sed -e "s|__DUMPDATES__|$(DUMPDATESPATH)|g" \ + -e "s|__DATE__|$(DATE)|g" \ + -e "s|__VERSION__|$(VERSION)|g" $< > $@ + +install:: all $(INSTALLBIN) $(PROG) $(BINDIR) $(INSTALLMAN) $(srcdir)/$(MAN8) $(MANDIR) @set $(LINKS) $(MLINKS); \ @@ -36,7 +41,7 @@ install:: $(PROG) done; true clean:: - $(RM) -f $(PROG) \#* *.s *.o *.a *~ core + $(RM) -f $(PROG) \#* *.s *.o *.a *~ core dump.8 distclean:: clean $(RM) -f Makefile Makefile.old .depend diff --git a/dump/dump.8 b/dump/dump.8 deleted file mode 100644 index b7f427e..0000000 --- a/dump/dump.8 +++ /dev/null @@ -1,449 +0,0 @@ -.\" Copyright (c) 1980, 1991, 1993 -.\" Regents of the University of California. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)dump.8 8.3 (Berkeley) 5/1/95 -.\" $Id: dump.8,v 1.3 1999/10/11 12:59:18 stelian Exp $ -.\" -.Dd June 4, 1997 -.Dt DUMP 8 -.Os BSD 4 -.Sh NAME -.Nm dump -.Nd ext2 filesystem backup -.Sh SYNOPSIS -.Nm dump -.Op Fl 0123456789acknu -.Op Fl B Ar records -.Op Fl b Ar blocksize -.Op Fl d Ar density -.Op Fl f Ar file -.Op Fl h Ar level -.Op Fl L Ar label -.Op Fl s Ar feet -.Op Fl T Ar date -.Ar filesystem -.Nm dump -.Op Fl 0123456789acknu -.Op Fl B Ar records -.Op Fl b Ar blocksize -.Op Fl d Ar density -.Op Fl f Ar file -.Op Fl h Ar level -.Op Fl L Ar label -.Op Fl s Ar feet -.Op Fl T Ar date -.Ar directory -.Nm dump -.Op Fl W Li \&| Fl w -.Pp -.in -\\n(iSu -(The -.Bx 4.3 -option syntax is implemented for backward compatibility but -is not documented here.) -.Sh DESCRIPTION -.Nm Dump -examines files -on an ext2 filesystem -and determines which files -need to be backed up. These files -are copied to the given disk, tape or other -storage medium for safe keeping (see the -.Fl f -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. This can be enforced -by using the -.Fl 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; -the actual size is determined by the tape size, density and/or -block count options below. -By default, the same output file name is used for each volume -after prompting the operator to change media. -.Pp -The following options are supported by -.Nm Ns : -.Bl -tag -width Ds -.It Fl 0\-9 -Dump levels. -A level 0, full backup, -guarantees the entire file system is copied -(but see also the -.Fl h -option below). -A level number above 0, -incremental backup, -tells -.Nm dump -to -copy all files new or modified since the -last dump of the same or lower level. -The default level is 9. -.It Fl B Ar records -The number of 1 KB blocks per volume. -This option overrides the calculation of tape size -based on length and density. -.It Fl 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 Fl b Ar blocksize -The number of kilobytes per dump record. -Since the IO system slices all requests into chunks of MAXBSIZE -(typically 64KB), it is not possible to use a larger blocksize -without having problems later with -.Xr restore 8 . -Therefore -.Nm dump -will constrain writes to MAXBSIZE. -.It Fl c -Change the defaults for use with a cartridge tape drive, with a density -of 8000 bpi, and a length of 1700 feet. -.It Fl h Ar level -Honor the user -.Dq nodump -flag -.Dp Dv UF_NODUMP -only for dumps at or above the given -.Ar level . -The default honor level is 1, -so that incremental backups omit such files -but full backups retain them. -.It Fl d Ar density -Set tape density to -.Ar density . -The default is 1600BPI. -.It Fl f Ar file -Write the backup to -.Ar file ; -.Ar file -may be a special device file -like -.Pa /dev/st0 -(a tape drive), -.Pa /dev/rsd1c -(a floppy disk drive), -an ordinary file, -or -.Ql Fl -(the standard output). -Multiple file names may be given as a single argument separated by commas. -Each file will be used for one dump volume in the order listed; -if the dump requires more volumes than the number of names given, -the last file name will used for all remaining volumes after prompting -for media changes. -If the name of the file is of the form -.Dq host:file -or -.Dq user@host:file -.Nm -writes to the named file on the remote host using -.Xr rmt 8 . -The default path name of the remote -.Xr rmt 8 -program is -.\" rmt path, is the path on the remote host -.Pa /etc/rmt ; -this can be overridden by the environment variable -.Ev RMT . -.It Fl k -Use Kerberos authentication to talk to remote tape servers. (Only -available if this option was enabled when -.Nm -was compiled.) -.It Fl L Ar label -The user-supplied text string -.Ar label -is placed into the dump header, where tools like -.Xr restore 8 -and -.Xr file 1 -can access it. -Note that this label is limited -to be at most LBLSIZE (currently 16) characters, which must include -the terminating -.Ql \e0 . -.It Fl n -Whenever -.Nm -requires operator attention, -notify all operators in the group -.Dq operator -by means similar to a -.Xr wall 1 . -.It Fl s Ar feet -Attempt to calculate the amount of tape needed -at a particular density. -If this amount is exceeded, -.Nm -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 T Ar date -Use the specified date as the starting time for the dump -instead of the time determined from looking in -.Pa /etc/dumpdates . -The format of -.Ar date -is the same as that of -.Xr ctime 3 . -This option is useful for automated dump scripts that wish to -dump over a specific period of time. -The -.Fl T -option is mutually exclusive from the -.Fl u -option. -.It Fl u -Update the file -.Pa /etc/dumpdates -after a successful dump. -The format of -.Pa /etc/dumpdates -is readable by people, consisting of one -free format record per line: -filesystem name, -increment level -and -.Xr ctime 3 -format dump date. -There may be only one entry per filesystem at each level. -The file -.Pa /etc/dumpdates -may be edited to change any of the fields, -if necessary. -.It Fl W -.Nm Dump -tells the operator what file systems need to be dumped. -This information is gleaned from the files -.Pa /etc/dumpdates -and -.Pa /etc/fstab . -The -.Fl W -option causes -.Nm -to print out, for each file system in -.Pa /etc/dumpdates , -the most recent dump date and level, -and highlights those file systems that should be dumped. -If the -.Fl W -option is set, all other options are ignored, and -.Nm -exits immediately. -.It Fl w -Is like -.Fl W , -but prints only those filesystems which need to be dumped. -.El -.Pp -.Nm Dump -requires operator intervention on these conditions: -end of tape, -end of dump, -tape write error, -tape open error or -disk read error (if there is more than a threshold of 32). -In addition to alerting all operators implied by the -.Fl n -key, -.Nm -interacts with the operator on -.Em dump's -control terminal at times when -.Nm -can no longer proceed, -or if something is grossly wrong. -All questions -.Nm -poses -.Em must -be answered by typing -.Dq yes -or -.Dq no , -appropriately. -.Pp -Since making a dump involves a lot of time and effort for full dumps, -.Nm -checkpoints itself at the start of each tape volume. -If writing that volume fails for some reason, -.Nm -will, -with operator permission, -restart itself from the checkpoint -after the old tape has been rewound and removed, -and a new tape has been mounted. -.Pp -.Nm Dump -tells the operator what is going on at periodic intervals, -including usually low estimates of the number of blocks to write, -the number of tapes it will take, the time to completion, and -the time to the tape change. -The output is verbose, -so that others know that the terminal -controlling -.Nm -is busy, -and will be for some time. -.Pp -In the event of a catastrophic disk event, the time required -to restore all the necessary backup tapes or files to disk -can be kept to a minimum by staggering the incremental dumps. -An efficient method of staggering incremental dumps -to minimize the number of tapes follows: -.Bl -bullet -offset indent -.It -Always start with a level 0 backup, for example: -.Bd -literal -offset indent -/sbin/dump -0u -f /dev/nrst1 /usr/src -.Ed -.Pp -This should be done at set intervals, say once a month or once every two months, -and on a set of fresh tapes that is saved forever. -.It -After a level 0, dumps of active file -systems are taken on a daily basis, -using a modified Tower of Hanoi algorithm, -with this sequence of dump levels: -.Bd -literal -offset indent -3 2 5 4 7 6 9 8 9 9 ... -.Ed -.Pp -For the daily dumps, it should be possible to use a fixed number of tapes -for each day, used on a weekly basis. -Each week, a level 1 dump is taken, and -the daily Hanoi sequence repeats beginning with 3. -For weekly dumps, another fixed set of tapes per dumped file system is -used, also on a cyclical basis. -.El -.Pp -After several months or so, the daily and weekly tapes should get -rotated out of the dump cycle and fresh tapes brought in. -.Sh ENVIRONMENT -.Bl -tag -width Fl -.It Ev TAPE -If no -f option was specified, -.Nm -will use the device specified via -.Ev TAPE -as the dump device. -.Ev TAPE -may be of the form -.Qq tapename , -.Qq host:tapename , -or -.Qq user@host:tapename . -.It Ev RMT -The environment variable -.Ev RMT -will be used to determine the pathname of the remote -.Xr rmt 8 -program. -.Sh FILES -.Bl -tag -width /etc/dumpdates -compact -.It Pa /dev/st0 -default tape unit to dump to -.It Pa /etc/dumpdates -dump date records -.It Pa /etc/fstab -dump table: file systems and frequency -.It Pa /etc/group -to find group -.Em operator -.El -.Sh SEE ALSO -.Xr fstab 5 , -.Xr restore 8 , -.Xr rmt 8 -.Sh DIAGNOSTICS -Many, and verbose. -.Pp -.Nm Dump -exits with zero status on success. -Startup errors are indicated with an exit code of 1; -abnormal termination is indicated with an exit code of 3. -.Sh BUGS -It might be considered a bug that this version of dump can only handle ext2 -filesystems. Specifically, it does not work with FAT filesystems. -.Pp -Fewer than 32 read errors on the filesystem are ignored. If noticing -read errors is important, the output from dump can be parsed to look for lines -that contain the text 'read error'. -.Pp -Each reel requires a new process, so parent processes for -reels already written just hang around until the entire tape -is written. -.Pp -.Nm Dump -with the -.Fl W -or -.Fl w -option does not report filesystems that have never been recorded -in -.Pa /etc/dumpdates , -even if listed in -.Pa /etc/fstab . -.Pp -It would be nice if -.Nm -knew about the dump sequence, -kept track of the tapes scribbled on, -told the operator which tape to mount when, -and provided more assistance -for the operator running -.Xr restore . -.Pp -.Nm Dump -cannot do remote backups without being run as root, due to its -security history. This will be fixed in a later version of -.Bx Free . -Presently, it works if you set it setuid (like it used to be), but this -might constitute a security risk. -.Sh HISTORY -A -.Nm -command appeared in -.At v6 . diff --git a/dump/dump.8.in b/dump/dump.8.in new file mode 100644 index 0000000..84e462c --- /dev/null +++ b/dump/dump.8.in @@ -0,0 +1,467 @@ +.\" Copyright (c) 1980, 1991, 1993 +.\" Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)dump.8 8.3 (Berkeley) 5/1/95 +.\" $Id: dump.8.in,v 1.1 1999/10/11 13:08:07 stelian Exp $ +.\" +.Dd __DATE__ +.Dt DUMP 8 +.Os "__VERSION__" +.Sh NAME +.Nm dump +.Nd ext2 filesystem backup +.Sh SYNOPSIS +.Nm dump +.Op Fl 0123456789acknu +.Op Fl B Ar records +.Op Fl b Ar blocksize +.Op Fl d Ar density +.Op Fl f Ar file +.Op Fl h Ar level +.Op Fl L Ar label +.Op Fl s Ar feet +.Op Fl T Ar date +.Ar filesystem +.Nm dump +.Op Fl 0123456789acknu +.Op Fl B Ar records +.Op Fl b Ar blocksize +.Op Fl d Ar density +.Op Fl f Ar file +.Op Fl h Ar level +.Op Fl L Ar label +.Op Fl s Ar feet +.Op Fl T Ar date +.Ar directory +.Nm dump +.Op Fl W Li \&| Fl w +.Pp +.in +(The +.Bx 4.3 +option syntax is implemented for backward compatibility but +is not documented here.) +.Sh DESCRIPTION +.Nm Dump +examines files +on an ext2 filesystem +and determines which files +need to be backed up. These files +are copied to the given disk, tape or other +storage medium for safe keeping (see the +.Fl f +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. This can be enforced +by using the +.Fl 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; +the actual size is determined by the tape size, density and/or +block count options below. +By default, the same output file name is used for each volume +after prompting the operator to change media. +.Pp +The following options are supported by +.Nm Ns : +.Bl -tag -width Ds +.It Fl 0\-9 +Dump levels. +A level 0, full backup, +guarantees the entire file system is copied +(but see also the +.Fl h +option below). +A level number above 0, +incremental backup, +tells +.Nm dump +to +copy all files new or modified since the +last dump of the same or lower level. +The default level is 9. +.It Fl B Ar records +The number of 1 KB blocks per volume. +This option overrides the calculation of tape size +based on length and density. +.It Fl 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 Fl b Ar blocksize +The number of kilobytes per dump record. +Since the IO system slices all requests into chunks of MAXBSIZE +(typically 64KB), it is not possible to use a larger blocksize +without having problems later with +.Xr restore 8 . +Therefore +.Nm dump +will constrain writes to MAXBSIZE. +.It Fl c +Change the defaults for use with a cartridge tape drive, with a density +of 8000 bpi, and a length of 1700 feet. +.It Fl h Ar level +Honor the user +.Dq nodump +flag +.Dp Dv UF_NODUMP +only for dumps at or above the given +.Ar level . +The default honor level is 1, +so that incremental backups omit such files +but full backups retain them. +.It Fl d Ar density +Set tape density to +.Ar density . +The default is 1600BPI. +.It Fl f Ar file +Write the backup to +.Ar file ; +.Ar file +may be a special device file +like +.Pa /dev/st0 +(a tape drive), +.Pa /dev/rsd1c +(a floppy disk drive), +an ordinary file, +or +.Ql Fl +(the standard output). +Multiple file names may be given as a single argument separated by commas. +Each file will be used for one dump volume in the order listed; +if the dump requires more volumes than the number of names given, +the last file name will used for all remaining volumes after prompting +for media changes. +If the name of the file is of the form +.Dq host:file +or +.Dq user@host:file +.Nm +writes to the named file on the remote host using +.Xr rmt 8 . +The default path name of the remote +.Xr rmt 8 +program is +.\" rmt path, is the path on the remote host +.Pa /etc/rmt ; +this can be overridden by the environment variable +.Ev RMT . +.It Fl k +Use Kerberos authentication to talk to remote tape servers. (Only +available if this option was enabled when +.Nm +was compiled.) +.It Fl L Ar label +The user-supplied text string +.Ar label +is placed into the dump header, where tools like +.Xr restore 8 +and +.Xr file 1 +can access it. +Note that this label is limited +to be at most LBLSIZE (currently 16) characters, which must include +the terminating +.Ql \e0 . +.It Fl n +Whenever +.Nm +requires operator attention, +notify all operators in the group +.Dq operator +by means similar to a +.Xr wall 1 . +.It Fl s Ar feet +Attempt to calculate the amount of tape needed +at a particular density. +If this amount is exceeded, +.Nm +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 T Ar date +Use the specified date as the starting time for the dump +instead of the time determined from looking in +.Pa __DUMPDATES__ . +The format of +.Ar date +is the same as that of +.Xr ctime 3 . +This option is useful for automated dump scripts that wish to +dump over a specific period of time. +The +.Fl T +option is mutually exclusive from the +.Fl u +option. +.It Fl u +Update the file +.Pa __DUMPDATES__ +after a successful dump. +The format of +.Pa __DUMPDATES__ +is readable by people, consisting of one +free format record per line: +filesystem name, +increment level +and +.Xr ctime 3 +format dump date. +There may be only one entry per filesystem at each level. +The file +.Pa __DUMPDATES__ +may be edited to change any of the fields, +if necessary. +.It Fl W +.Nm Dump +tells the operator what file systems need to be dumped. +This information is gleaned from the files +.Pa __DUMPDATES__ +and +.Pa /etc/fstab . +The +.Fl W +option causes +.Nm +to print out, for each file system in +.Pa __DUMPDATES__ , +the most recent dump date and level, +and highlights those file systems that should be dumped. +If the +.Fl W +option is set, all other options are ignored, and +.Nm +exits immediately. +.It Fl w +Is like +.Fl W , +but prints only those filesystems which need to be dumped. +.El +.Pp +.Nm Dump +requires operator intervention on these conditions: +end of tape, +end of dump, +tape write error, +tape open error or +disk read error (if there is more than a threshold of 32). +In addition to alerting all operators implied by the +.Fl n +key, +.Nm +interacts with the operator on +.Em dump's +control terminal at times when +.Nm +can no longer proceed, +or if something is grossly wrong. +All questions +.Nm +poses +.Em must +be answered by typing +.Dq yes +or +.Dq no , +appropriately. +.Pp +Since making a dump involves a lot of time and effort for full dumps, +.Nm +checkpoints itself at the start of each tape volume. +If writing that volume fails for some reason, +.Nm +will, +with operator permission, +restart itself from the checkpoint +after the old tape has been rewound and removed, +and a new tape has been mounted. +.Pp +.Nm Dump +tells the operator what is going on at periodic intervals, +including usually low estimates of the number of blocks to write, +the number of tapes it will take, the time to completion, and +the time to the tape change. +The output is verbose, +so that others know that the terminal +controlling +.Nm +is busy, +and will be for some time. +.Pp +In the event of a catastrophic disk event, the time required +to restore all the necessary backup tapes or files to disk +can be kept to a minimum by staggering the incremental dumps. +An efficient method of staggering incremental dumps +to minimize the number of tapes follows: +.Bl -bullet -offset indent +.It +Always start with a level 0 backup, for example: +.Bd -literal -offset indent +/sbin/dump -0u -f /dev/st0 /usr/src +.Ed +.Pp +This should be done at set intervals, say once a month or once every two months, +and on a set of fresh tapes that is saved forever. +.It +After a level 0, dumps of active file +systems are taken on a daily basis, +using a modified Tower of Hanoi algorithm, +with this sequence of dump levels: +.Bd -literal -offset indent +3 2 5 4 7 6 9 8 9 9 ... +.Ed +.Pp +For the daily dumps, it should be possible to use a fixed number of tapes +for each day, used on a weekly basis. +Each week, a level 1 dump is taken, and +the daily Hanoi sequence repeats beginning with 3. +For weekly dumps, another fixed set of tapes per dumped file system is +used, also on a cyclical basis. +.El +.Pp +After several months or so, the daily and weekly tapes should get +rotated out of the dump cycle and fresh tapes brought in. +.Sh ENVIRONMENT +.Bl -tag -width Fl +.It Ev TAPE +If no -f option was specified, +.Nm +will use the device specified via +.Ev TAPE +as the dump device. +.Ev TAPE +may be of the form +.Qq tapename , +.Qq host:tapename , +or +.Qq user@host:tapename . +.It Ev RMT +The environment variable +.Ev RMT +will be used to determine the pathname of the remote +.Xr rmt 8 +program. +.Sh FILES +.Bl -tag -width __DUMPDATES__ -compact +.It Pa /dev/st0 +default tape unit to dump to +.It Pa __DUMPDATES__ +dump date records +.It Pa /etc/fstab +dump table: file systems and frequency +.It Pa /etc/group +to find group +.Em operator +.El +.Sh SEE ALSO +.Xr fstab 5 , +.Xr restore 8 , +.Xr rmt 8 +.Sh DIAGNOSTICS +Many, and verbose. +.Pp +.Nm Dump +exits with zero status on success. +Startup errors are indicated with an exit code of 1; +abnormal termination is indicated with an exit code of 3. +.Sh BUGS +It might be considered a bug that this version of dump can only handle ext2 +filesystems. Specifically, it does not work with FAT filesystems. +.Pp +Fewer than 32 read errors on the filesystem are ignored. If noticing +read errors is important, the output from dump can be parsed to look for lines +that contain the text 'read error'. +.Pp +Each reel requires a new process, so parent processes for +reels already written just hang around until the entire tape +is written. +.Pp +.Nm Dump +with the +.Fl W +or +.Fl w +option does not report filesystems that have never been recorded +in +.Pa __DUMPDATES__ , +even if listed in +.Pa /etc/fstab . +.Pp +It would be nice if +.Nm +knew about the dump sequence, +kept track of the tapes scribbled on, +told the operator which tape to mount when, +and provided more assistance +for the operator running +.Xr restore . +.Pp +.Nm Dump +cannot do remote backups without being run as root, due to its +security history. This will be fixed in a later version of +.Bx Free . +Presently, it works if you set it setuid (like it used to be), but this +might constitute a security risk. +.Sh AUTHOR +The +.Nm dump/restore +backup suit was ported to Linux's Second Extended File System +by Remy Card . He maintained the initial versions +of dump (up and including 0.4b4, released in january 1997). +.Pp +Starting with 0.4b5, the new maintainer is Stelian Pop +.br +. +.Sh AVAILABILITY +The +.Nm dump/restore +backup suit is available for anonymous ftp from tsx-11.mit.edu +in /pub/linux/ALPHA/ext2fs (development versions) or +/pub/linux/packages/ext2fs (stable versions). +.Pp +An alternate downloading location is http://perso.cybercable.fr/pop/dump. +.Sh HISTORY +A +.Nm +command appeared in +.At v6 . diff --git a/dump/dump.h b/dump/dump.h index 8424c71..ba7ed38 100644 --- a/dump/dump.h +++ b/dump/dump.h @@ -208,8 +208,8 @@ struct dumptime *dthead; /* head of the list version */ int nddates; /* number of records (might be zero) */ int ddates_in; /* we have read the increment file */ struct dumpdates **ddatev; /* the arrayfied version */ -void initdumptimes __P((void)); -void getdumptime __P((void)); +void initdumptimes __P((int)); +void getdumptime __P((int)); void putdumptime __P((void)); #define ITITERATE(i, ddp) \ for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i]) @@ -229,7 +229,7 @@ extern int errno; #endif #ifdef __linux__ -#define DUMP_CURRENT_REV 0 +#define DUMP_CURRENT_REV 1 #endif #ifndef __linux__ diff --git a/dump/itime.c b/dump/itime.c index a1b66f9..e29632c 100644 --- a/dump/itime.c +++ b/dump/itime.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)itime.c 8.1 (Berkeley) 6/5/93"; #endif static const char rcsid[] = - "$Id: itime.c,v 1.3 1999/10/11 12:59:18 stelian Exp $"; + "$Id: itime.c,v 1.4 1999/10/11 13:08:07 stelian Exp $"; #endif /* not lint */ #include @@ -93,7 +93,7 @@ static int makedumpdate __P((struct dumpdates *, char *)); static void readdumptimes __P((FILE *)); void -initdumptimes(void) +initdumptimes(int createdumpdates) { FILE *df; @@ -103,25 +103,31 @@ initdumptimes(void) strerror(errno)); /* NOTREACHED */ } - /* - * Dumpdates does not exist, make an empty one. - */ - msg("WARNING: no file `%s', making an empty one\n", dumpdates); - if ((df = fopen(dumpdates, "w")) == NULL) { - quit("cannot create %s: %s\n", dumpdates, - strerror(errno)); - /* NOTREACHED */ + if (createdumpdates) { + /* + * Dumpdates does not exist, make an empty one. + */ + msg("WARNING: no file `%s', making an empty one\n", dumpdates); + if ((df = fopen(dumpdates, "w")) == NULL) { + quit("cannot create %s: %s\n", dumpdates, + strerror(errno)); + /* NOTREACHED */ + } + (void) fclose(df); + if ((df = fopen(dumpdates, "r")) == NULL) { + quit("cannot read %s even after creating it: %s\n", + dumpdates, strerror(errno)); + /* NOTREACHED */ + } } + else + msg("WARNING: no file `%s'\n", dumpdates); + } + if (df != NULL) { + (void) flock(fileno(df), LOCK_SH); + readdumptimes(df); (void) fclose(df); - if ((df = fopen(dumpdates, "r")) == NULL) { - quit("cannot read %s even after creating it: %s\n", - dumpdates, strerror(errno)); - /* NOTREACHED */ - } } - (void) flock(fileno(df), LOCK_SH); - readdumptimes(df); - (void) fclose(df); } static void @@ -152,7 +158,7 @@ readdumptimes(FILE *df) } void -getdumptime(void) +getdumptime(int createdumpdates) { register struct dumpdates *ddp; register int i; @@ -169,10 +175,11 @@ getdumptime(void) /* if we're not going to update dumpdates, there's no point in reading it, particularly since /var might not be mounted... wait until here to benefit from the initialization of variables needed by parent */ - if (uflag == 0) + if (!uflag && level == lastlevel) + return; + initdumptimes(createdumpdates); + if (ddatev == NULL) return; - - initdumptimes(); /* * Go find the entry with the same name for a lower increment * and older date diff --git a/dump/main.c b/dump/main.c index ca30a9c..58ff5c3 100644 --- a/dump/main.c +++ b/dump/main.c @@ -50,7 +50,7 @@ static const char copyright[] = static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95"; #endif static const char rcsid[] = - "$Id: main.c,v 1.3 1999/10/11 12:59:18 stelian Exp $"; + "$Id: main.c,v 1.4 1999/10/11 13:08:07 stelian Exp $"; #endif /* not lint */ #include @@ -343,7 +343,6 @@ main(int argc, char *argv[]) signal(SIGTERM, sig); if (signal(SIGINT, interrupt) == SIG_IGN) signal(SIGINT, SIG_IGN); - set_operators(); /* /etc/group snarfed */ getfstab(); /* /etc/fstab snarfed */ /* @@ -394,10 +393,17 @@ main(int argc, char *argv[]) spcl.c_level = level - '0'; spcl.c_type = TS_TAPE; if (!Tflag) - getdumptime(); /* dumpdates snarfed */ + getdumptime(uflag); /* dumpdates snarfed */ + + if (spcl.c_ddate == 0 && spcl.c_level) { + msg("WARNING: There is no inferior level dump on this filesystem\n"); + msg("WARNING: Assuming a level 0 dump by default\n"); + level = '0'; + spcl.c_level = 0; + } msg("Date of this level %c dump: %s", level, -#ifdef __linux +#ifdef __linux__ spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date)); #else spcl.c_date == 0 ? "the epoch\n" : ctime(&spcl.c_date)); @@ -550,7 +556,11 @@ main(int argc, char *argv[]) "can't allocate tape buffers - try a smaller blocking factor.\n"); startnewtape(1); +#ifdef __linux__ + (void)time4(&(tstart_writing)); +#else (void)time((time_t *)&(tstart_writing)); +#endif dumpmap(usedinomap, TS_CLRI, maxino - 1); msg("dumping (Pass III) [directories]\n"); @@ -595,7 +605,11 @@ main(int argc, char *argv[]) (void)dumpino(dp, ino); } +#ifdef __linux__ + (void)time4(&(tend_writing)); +#else (void)time((time_t *)&(tend_writing)); +#endif spcl.c_type = TS_END; for (i = 0; i < ntrec; i++) writeheader(maxino - 1); diff --git a/dump/optr.c b/dump/optr.c index 96b829a..ab38a3d 100644 --- a/dump/optr.c +++ b/dump/optr.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)optr.c 8.2 (Berkeley) 1/6/94"; #endif static const char rcsid[] = - "$Id: optr.c,v 1.3 1999/10/11 12:59:19 stelian Exp $"; + "$Id: optr.c,v 1.4 1999/10/11 13:08:08 stelian Exp $"; #endif /* not lint */ #include @@ -60,6 +60,7 @@ static const char rcsid[] = #include #include #include +#include #ifdef __linux__ #include @@ -97,7 +98,11 @@ query(const char *question) FILE *mytty; time_t firstprompt, when_answered; - firstprompt = time(NULL); +#ifdef __linux__ + (void)time4(&(firstprompt)); +#else + (void)time((time_t *)&(firstprompt)); +#endif if ((mytty = fopen(_PATH_TTY, "r")) == NULL) quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno)); @@ -130,12 +135,16 @@ query(const char *question) if (signal(SIGALRM, sig) == SIG_IGN) signal(SIGALRM, SIG_IGN); (void) fclose(mytty); - when_answered = time(NULL); +#ifdef __linux__ + (void)time4(&(when_answered)); +#else + (void)time((time_t *)&(when_answered)); +#endif /* * Adjust the base for time estimates to ignore time we spent waiting * for operator input. */ - if (tstart_writing != 0) + if ((tstart_writing != 0) && (when_answered != (time_t)-1) && (firstprompt != (time_t)-1)) tstart_writing += (when_answered - firstprompt); return(back); } @@ -314,7 +323,11 @@ timeest(void) { time_t tnow, deltat; +#ifdef __linux__ + (void) time4(&tnow); +#else (void) time((time_t *) &tnow); +#endif if (tnow >= tschedule) { tschedule = tnow + 300; if (blockswritten < 500) @@ -501,6 +514,10 @@ fstabsearchdir(const char *key, char *directory) register struct fstab *fs; register struct fstab *found_fs = NULL; unsigned int size = 0; + struct stat buf; + + if (stat(key, &buf) == 0 && S_ISBLK(buf.st_mode)) + return NULL; for (pf = table; pf != NULL; pf = pf->pf_next) { fs = pf->pf_fstab; @@ -534,40 +551,42 @@ lastdump(char arg) /* w ==> just what to do; W ==> most recent dumps */ { register int i; register struct fstab *dt; - register struct dumpdates *dtwalk; + register struct dumpdates *dtwalk=NULL; char *lastname, *date; int dumpme; time_t tnow; (void) time(&tnow); getfstab(); /* /etc/fstab input */ - initdumptimes(); /* /etc/dumpdates input */ - qsort((char *) ddatev, nddates, sizeof(struct dumpdates *), datesort); - - if (arg == 'w') - (void) printf("Dump these file systems:\n"); - else - (void) printf("Last dump(s) done (Dump '>' file systems):\n"); - lastname = "??"; - ITITERATE(i, dtwalk) { - if (strncmp(lastname, dtwalk->dd_name, - sizeof(dtwalk->dd_name)) == 0) - continue; - date = (char *)ctime(&dtwalk->dd_ddate); - date[16] = '\0'; /* blast away seconds and year */ - lastname = dtwalk->dd_name; - dt = fstabsearch(dtwalk->dd_name); - dumpme = (dt != NULL && - dt->fs_freq != 0 && - dtwalk->dd_ddate < tnow - (dt->fs_freq * 86400)); - if (arg != 'w' || dumpme) - (void) printf( - "%c %8s\t(%6s) Last dump: Level %c, Date %s\n", - dumpme && (arg != 'w') ? '>' : ' ', - dtwalk->dd_name, - dt ? dt->fs_file : "", - dtwalk->dd_level, - date); + initdumptimes(0); /* dumpdates input */ + if (ddatev != NULL) { + qsort((char *) ddatev, nddates, sizeof(struct dumpdates *), datesort); + + if (arg == 'w') + (void) printf("Dump these file systems:\n"); + else + (void) printf("Last dump(s) done (Dump '>' file systems):\n"); + lastname = "??"; + ITITERATE(i, dtwalk) { + if (strncmp(lastname, dtwalk->dd_name, + sizeof(dtwalk->dd_name)) == 0) + continue; + date = (char *)ctime(&dtwalk->dd_ddate); + date[16] = '\0'; /* blast away seconds and year */ + lastname = dtwalk->dd_name; + dt = fstabsearch(dtwalk->dd_name); + dumpme = (dt != NULL && + dt->fs_freq != 0 && + dtwalk->dd_ddate < tnow - (dt->fs_freq * 86400)); + if (arg != 'w' || dumpme) + (void) printf( + "%c %8s\t(%6s) Last dump: Level %c, Date %s\n", + dumpme && (arg != 'w') ? '>' : ' ', + dtwalk->dd_name, + dt ? dt->fs_file : "", + dtwalk->dd_level, + date); + } } } diff --git a/dump/tape.c b/dump/tape.c index b48665e..741f2de 100644 --- a/dump/tape.c +++ b/dump/tape.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)tape.c 8.4 (Berkeley) 5/1/95"; #endif static const char rcsid[] = - "$Id: tape.c,v 1.3 1999/10/11 12:59:19 stelian Exp $"; + "$Id: tape.c,v 1.4 1999/10/11 13:08:08 stelian Exp $"; #endif /* not lint */ #ifdef __linux__ @@ -270,10 +270,19 @@ do_stats(void) time_t tnow, ttaken; int blocks; +#ifdef __linux__ + (void)time4(&tnow); +#else (void)time(&tnow); +#endif ttaken = tnow - tstart_volume; blocks = spcl.c_tapea - tapea_volume; - msg("Volume %d completed at: %s", tapeno, ctime(&tnow)); + msg("Volume %d completed at: %s", tapeno, +#ifdef __linux__ + ctime4(&tnow)); +#else + ctime(&tnow)); +#endif if (ttaken > 0) { msg("Volume %d took %d:%02d:%02d\n", tapeno, ttaken / 3600, (ttaken % 3600) / 60, ttaken % 60); @@ -299,7 +308,11 @@ statussig(int notused) if (blockswritten < 500) return; +#ifdef __linux__ + (void) time4(&tnow); +#else (void) time((time_t *) &tnow); +#endif deltat = tstart_writing - tnow + (1.0 * (tnow - tstart_writing)) / blockswritten * tapesize; (void)snprintf(msgbuf, sizeof(msgbuf), @@ -445,17 +458,10 @@ trewind(void) void close_rewind(void) { - time_t tstart_changevol, tend_changevol; - trewind(); (void)do_stats(); if (nexttape) return; -#ifdef __linux__ - (void)time4(&(tstart_changevol)); -#else - (void)time((time_t *)&(tstart_changevol)); -#endif if (!nogripe) { msg("Change Volumes: Mount volume #%d\n", tapeno+1); broadcast("CHANGE DUMP VOLUMES!\7\7\n"); @@ -465,13 +471,6 @@ close_rewind(void) dumpabort(0); /*NOTREACHED*/ } -#ifdef __linux__ - (void)time4(&(tend_changevol)); -#else - (void)time((time_t *)&(tend_changevol)); -#endif - if ((tstart_changevol != (time_t)-1) && (tend_changevol != (time_t)-1)) - tstart_writing += (tend_changevol - tstart_changevol); } void @@ -637,7 +636,11 @@ startnewtape(int top) interrupt_save = signal(SIGINT, SIG_IGN); parentpid = getpid(); tapea_volume = spcl.c_tapea; - (void)time(&tstart_volume); +#ifdef __linux__ + (void)time4(&tstart_volume); +#else + (void)time((&tstart_volume); +#endif restore_check_point: (void)signal(SIGINT, interrupt_save); @@ -750,7 +753,12 @@ restore_check_point: spcl.c_flags |= DR_NEWHEADER; writeheader((ino_t)slp->inode); spcl.c_flags &=~ DR_NEWHEADER; - msg("Volume %d started at: %s", tapeno, ctime(&tstart_volume)); + msg("Volume %d started at: %s", tapeno, +#ifdef __linux__ + ctime4(&tstart_volume)); +#else + ctime(&tstart_volume)); +#endif if (tapeno > 1) msg("Volume %d begins with blocks from inode %d\n", tapeno, slp->inode); diff --git a/dump/traverse.c b/dump/traverse.c index 59ce524..d408993 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)traverse.c 8.7 (Berkeley) 6/15/95"; #endif static const char rcsid[] = - "$Id: traverse.c,v 1.3 1999/10/11 12:59:19 stelian Exp $"; + "$Id: traverse.c,v 1.4 1999/10/11 13:08:08 stelian Exp $"; #endif /* not lint */ #include @@ -338,7 +338,7 @@ mapdirs(ino_t maxino, long *tapesize) register int isdir; register char *map; register ino_t ino; -#ifndef __linux +#ifndef __linux__ register int i; long filesize; #endif diff --git a/dump/unctime.c b/dump/unctime.c index bd72453..ec0960f 100644 --- a/dump/unctime.c +++ b/dump/unctime.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)unctime.c 8.2 (Berkeley) 6/14/94"; #endif static const char rcsid[] = - "$Id: unctime.c,v 1.3 1999/10/11 12:59:19 stelian Exp $"; + "$Id: unctime.c,v 1.4 1999/10/11 13:08:08 stelian Exp $"; #endif /* not lint */ #include diff --git a/restore/Makefile.in b/restore/Makefile.in index e032d18..d8257fd 100644 --- a/restore/Makefile.in +++ b/restore/Makefile.in @@ -17,12 +17,16 @@ OBJS= dirs.o interactive.o main.o restore.o symtab.o tape.o \ MAN8= restore.8 MLINKS= restore.8 $(MANDIR)/rrestore.8 -all:: $(PROG) +all:: $(PROG) restore.8 $(PROG): $(OBJS) $(DEPLIBS) $(CC) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) -install:: $(PROG) +restore.8: restore.8.in + sed -e "s|__DATE__|$(DATE)|g" \ + -e "s|__VERSION__|$(VERSION)|g" $< > $@ + +install:: all $(INSTALLBIN) $(PROG) $(BINDIR) $(INSTALLMAN) $(srcdir)/$(MAN8) $(MANDIR) @set $(LINKS) $(MLINKS); \ @@ -37,7 +41,7 @@ install:: $(PROG) done; true clean:: - $(RM) -f $(PROG) \#* *.s *.o *.a *~ core + $(RM) -f $(PROG) \#* *.s *.o *.a *~ core restore.8 distclean:: clean $(RM) -f Makefile Makefile.old .depend diff --git a/restore/dirs.c b/restore/dirs.c index 30cec66..a6611c6 100644 --- a/restore/dirs.c +++ b/restore/dirs.c @@ -49,7 +49,7 @@ static char sccsid[] = "@(#)dirs.c 8.7 (Berkeley) 5/1/95"; #endif static const char rcsid[] = - "$Id: dirs.c,v 1.3 1999/10/11 12:59:19 stelian Exp $"; + "$Id: dirs.c,v 1.4 1999/10/11 13:08:08 stelian Exp $"; #endif /* not lint */ #include @@ -658,10 +658,11 @@ setdirmodes(int flags) cp = myname(ep); (void) chown(cp, node.uid, node.gid); (void) chmod(cp, node.mode); + if (node.flags) #ifdef __linux__ - (void) setflags(cp, node.flags); + (void) fsetflags(cp, node.flags); #else - (void) chflags(cp, node.flags); + (void) chflags(cp, node.flags); #endif utimes(cp, node.timep); ep->e_flags &= ~NEW; diff --git a/restore/extern.h b/restore/extern.h index 8d8740b..46e6cc2 100644 --- a/restore/extern.h +++ b/restore/extern.h @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * @(#)extern.h 8.2 (Berkeley) 1/7/94 - * $Id: extern.h,v 1.3 1999/10/11 12:59:20 stelian Exp $ + * $Id: extern.h,v 1.4 1999/10/11 13:08:09 stelian Exp $ */ struct entry *addentry __P((char *, ino_t, int)); @@ -119,3 +119,7 @@ int rmtioctl __P((int, int)); int rmtopen __P((const char *, int)); int rmtread __P((const char *, int)); int rmtseek __P((int, int)); + +/* From e2fsprogs */ +int fsetflags __P((const char *, unsigned long)); +int setflags __P((int, unsigned long)); diff --git a/restore/interactive.c b/restore/interactive.c index de958bb..2f26278 100644 --- a/restore/interactive.c +++ b/restore/interactive.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)interactive.c 8.5 (Berkeley) 5/1/95"; #endif static const char rcsid[] = - "$Id: interactive.c,v 1.3 1999/10/11 12:59:20 stelian Exp $"; + "$Id: interactive.c,v 1.4 1999/10/11 13:08:09 stelian Exp $"; #endif /* not lint */ #include @@ -561,12 +561,12 @@ printlist(char *name, char *basename) strcmp(dp->d_name, "..") == 0)) continue; locname[namelen] = '\0'; - if (namelen + dp->d_namlen >= MAXPATHLEN) { + if (namelen + strlen(dp->d_name) >= MAXPATHLEN) { fprintf(stderr, "%s%s: name exceeds %d char\n", locname, dp->d_name, MAXPATHLEN); } else { (void) strncat(locname, dp->d_name, - (int)dp->d_namlen); + (int)strlen(dp->d_name)); mkentry(locname, dp, listp++); entries++; } @@ -633,9 +633,12 @@ mkentry(char *name, struct direct *dp, struct afile *fp) fp->postfix = '#'; break; +#ifndef __linux__ + /* no need for this */ case DT_WHT: fp->postfix = '%'; break; +#endif case DT_UNKNOWN: case DT_DIR: @@ -717,26 +720,20 @@ formatf(struct afile *list, int nentry) * Skip over directory entries that are not on the tape * * First have to get definition of a dirent. + * + * For Linux the dirent struct is now included from bsdcompat.h */ -#ifdef __linux__ -struct dirent { - off_t d_off; /* offset of next disk dir entry */ - unsigned long d_fileno; /* file number of entry */ - unsigned short d_reclen; /* length of this record */ - unsigned short d_namlen; /* length of string in d_name */ - char d_name[255+1]; /* name (up to MAXNAMLEN + 1) */ -}; -#else /* __linux__ */ +#ifndef __linux__ #undef DIRBLKSIZ #include #undef d_ino -#endif /* __linux__ */ +#endif /* ! __linux__ */ struct dirent * glob_readdir(RST_DIR *dirp) { struct direct *dp; - static struct dirent adirent; + static struct dirent adirent; while ((dp = rst_readdir(dirp)) != NULL) { if (!vflag && dp->d_ino == WINO) @@ -747,7 +744,6 @@ glob_readdir(RST_DIR *dirp) if (dp == NULL) return (NULL); adirent.d_fileno = dp->d_ino; - adirent.d_namlen = dp->d_namlen; memmove(adirent.d_name, dp->d_name, dp->d_namlen + 1); return (&adirent); } @@ -759,7 +755,6 @@ static int glob_stat(const char *name, struct stat *stp) { register struct direct *dp; - dp = pathsearch(name); if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0) || (!vflag && dp->d_ino == WINO)) diff --git a/restore/main.c b/restore/main.c index f979560..7460d7d 100644 --- a/restore/main.c +++ b/restore/main.c @@ -50,7 +50,7 @@ static const char copyright[] = static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/4/95"; #endif static const char rcsid[] = - "$Id: main.c,v 1.3 1999/10/11 12:59:20 stelian Exp $"; + "$Id: main.c,v 1.4 1999/10/11 13:08:09 stelian Exp $"; #endif /* not lint */ #include @@ -361,12 +361,17 @@ main(int argc, char *argv[]) static void usage(void) { +#ifdef KERBEROS +#define kerbflag "k" +#else +#define kerbflag +#endif (void)fprintf(stderr, "usage:\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n", - "restore -i [-chkmuvy] [-b blocksize] [-f file] [-s fileno]", - "restore -r [-ckuvy] [-b blocksize] [-f file] [-s fileno]", - "restore -R [-ckuvy] [-b blocksize] [-f file] [-s fileno]", - "restore -x [-chkmuvy] [-b blocksize] [-f file] [-s fileno] [file ...]", - "restore -t [-chkuvy] [-b blocksize] [-f file] [-s fileno] [file ...]"); + "restore -i [-ch" kerbflag "muvy] [-b blocksize] [-f file] [-s fileno]", + "restore -r [-c" kerbflag "uvy] [-b blocksize] [-f file] [-s fileno]", + "restore -R [-c" kerbflag "uvy] [-b blocksize] [-f file] [-s fileno]", + "restore -x [-ch" kerbflag "muvy] [-b blocksize] [-f file] [-s fileno] [file ...]", + "restore -t [-ch" kerbflag "kuvy] [-b blocksize] [-f file] [-s fileno] [file ...]"); exit(1); } diff --git a/restore/restore.8 b/restore/restore.8 deleted file mode 100644 index 676e3c4..0000000 --- a/restore/restore.8 +++ /dev/null @@ -1,543 +0,0 @@ -.\" Copyright (c) 1985, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)restore.8 8.4 (Berkeley) 5/1/95 -.\" $Id: restore.8,v 1.3 1999/10/11 12:59:20 stelian Exp $ -.\" -.Dd May 1, 1995 -.Dt RESTORE 8 -.Os BSD 4 -.Sh NAME -.Nm restore -.Nd "restore files or file systems from backups made with dump" -.Sh SYNOPSIS -.Nm restore -.Fl C -.Op Fl ckvy -.Op Fl b Ar blocksize -.Op Fl D Ar filesystem -.Op Fl f Ar file -.Op Fl s Ar fileno -.Op Fl T Ar directory -.Nm restore -.Fl i -.Op Fl chkmNuvy -.Op Fl b Ar blocksize -.Op Fl f Ar file -.Op Fl s Ar fileno -.Op Fl T Ar directory -.Nm restore -.Fl R -.Op Fl ckNuvy -.Op Fl b Ar blocksize -.Op Fl f Ar file -.Op Fl s Ar fileno -.Op Fl T Ar directory -.Nm restore -.Fl r -.Op Fl ckNuvy -.Op Fl b Ar blocksize -.Op Fl f Ar file -.Op Fl s Ar fileno -.Op Fl T Ar directory -.Nm restore -.Fl t -.Op Fl chkNuvy -.Op Fl b Ar blocksize -.Op Fl f Ar file -.Op Fl s Ar fileno -.Op Fl T Ar directory -.Op file ... -.Nm restore -.Fl x -.Op Fl chkmNuvy -.Op Fl b Ar blocksize -.Op Fl f Ar file -.Op Fl s Ar fileno -.Op Fl T Ar directory -.Op file ... -.Pp -.in -\\n(iSu -(The -.Bx 4.3 -option syntax is implemented for backward compatibility but -is not documented here.) -.Sh DESCRIPTION -The -.Nm restore -command performs the inverse function of -.Xr dump 8 . -A full backup of a file system may be restored and -subsequent incremental backups layered on top of it. -Single files and -directory subtrees may be restored from full or partial -backups. -.Nm Restore -works across a network; -to do this see the -.Fl f -flag described below. -Other arguments to the command are file or directory -names specifying the files that are to be restored. -Unless the -.Fl h -flag is specified (see below), -the appearance of a directory name refers to -the files and (recursively) subdirectories of that directory. -.Pp -Exactly one of the following flags is required: -.Bl -tag -width Ds -.It Fl C -This mode allows comparison of files from a dump. -.Nm Restore -reads the backup and compares its contents with files present on the -disk. -It first changes its working directory to the root of the filesystem -that was dumped and compares the tape with the files in its new -current directory. -.It Fl i -This mode allows interactive restoration of files from a dump. -After reading in the directory information from the dump, -.Nm restore -provides a shell like interface that allows the user to move -around the directory tree selecting files to be extracted. -The available commands are given below; -for those commands that require an argument, -the default is the current directory. -.Bl -tag -width Fl -.It Ic add Op Ar arg -The current directory or specified argument is added to the list of -files to be extracted. -If a directory is specified, then it and all its descendents are -added to the extraction list -(unless the -.Fl h -flag is specified on the command line). -Files that are on the extraction list are prepended with a -.Dq \&* -when they are listed by -.Ic ls . -.It Ic \&cd Ar arg -Change the current working directory to the specified argument. -.It Ic delete Op Ar arg -The current directory or specified argument is deleted from the list of -files to be extracted. -If a directory is specified, then it and all its descendents are -deleted from the extraction list -(unless the -.Fl h -flag is specified on the command line). -The most expedient way to extract most of the files from a directory -is to add the directory to the extraction list and then delete -those files that are not needed. -.It Ic extract -All files on the extraction list are extracted -from the dump. -.Nm Restore -will ask which volume the user wishes to mount. -The fastest way to extract a few files is to -start with the last volume and work towards the first volume. -.It Ic help -List a summary of the available commands. -.It Ic \&ls Op Ar arg -List the current or specified directory. -Entries that are directories are appended with a -.Dq \&* . -Entries that have been marked for extraction are prepended with a ``*''. -If the verbose -flag is set, the inode number of each entry is also listed. -.It Ic pwd -Print the full pathname of the current working directory. -.It Ic quit -Restore immediately exits, -even if the extraction list is not empty. -.It Ic setmodes -All directories that have been added to the extraction list -have their owner, modes, and times set; -nothing is extracted from the dump. -This is useful for cleaning up after a restore has been prematurely aborted. -.It Ic verbose -The sense of the -.Fl v -flag is toggled. -When set, the verbose flag causes the -.Ic ls -command to list the inode numbers of all entries. -It also causes -.Nm restore -to print out information about each file as it is extracted. -.El -.It Fl R -.Nm Restore -requests a particular tape of a multi-volume set on which to restart -a full restore -(see the -.Fl r -flag below). -This is useful if the restore has been interrupted. -.It Fl r -Restore (rebuild) a file system. -The target file system should be made pristine with -.Xr newfs 8 , -mounted, and the user -.Xr cd Ns 'd -into the pristine file system -before starting the restoration of the initial level 0 backup. If the -level 0 restores successfully, the -.Fl r -flag may be used to restore -any necessary incremental backups on top of the level 0. -The -.Fl r -flag precludes an interactive file extraction and can be -detrimental to one's health (not to mention the disk) if not used carefully. -An example: -.Bd -literal -offset indent -newfs /dev/rrp0g eagle -mount /dev/rp0g /mnt -cd /mnt - -restore rf /dev/rst8 -.Ed -.Pp -Note that -.Nm restore -leaves a file -.Pa restoresymtable -in the root directory to pass information between incremental -restore passes. -This file should be removed when the last incremental has been -restored. -.Pp -.Nm Restore , -in conjunction with -.Xr newfs 8 -and -.Xr dump 8 , -may be used to modify file system parameters -such as size or block size. -.It Fl t -The names of the specified files are listed if they occur -on the backup. -If no file argument is given, -the root directory is listed, -which results in the entire content of the -backup being listed, -unless the -.Fl h -flag has been specified. -Note that the -.Fl t -flag replaces the function of the old -.Xr dumpdir 8 -program. -.ne 1i -.It Fl x -The named files are read from the given media. -If a named file matches a directory whose contents -are on the backup -and the -.Fl h -flag is not specified, -the directory is recursively extracted. -The owner, modification time, -and mode are restored (if possible). -If no file argument is given, -the root directory is extracted, -which results in the entire content of the -backup being extracted, -unless the -.Fl h -flag has been specified. -.El -.Pp -The following additional options may be specified: -.Bl -tag -width Ds -.It Fl b Ar blocksize -The number of kilobytes per dump record. -If the -.Fl b -option is not specified, -.Nm restore -tries to determine the media block size dynamically. -.It Fl c -Normally, -.Nm restore -will try to determine dynamically whether the dump was made from an -old (pre-4.4) or new format file system. The -.Fl c -flag disables this check, and only allows reading a dump in the old -format. -.It Fl D Ar filesystem -The -.Fl D -flag allows the user to specify the filesystem name when using -.Nm restore -with the -.Fl C -option to check the backup. -.It Fl f Ar file -Read the backup from -.Ar file ; -.Ar file -may be a special device file -like -.Pa /dev/st0 -(a tape drive), -.Pa /dev/rsd1c -(a disk drive), -an ordinary file, -or -.Ql Fl -(the standard input). -If the name of the file is of the form -.Dq host:file -or -.Dq user@host:file , -.Nm restore -reads from the named file on the remote host using -.Xr rmt 8 . -.Pp -.It Fl k -Use Kerberos authentication when contacting the remote tape server. -(Only available if this options was enabled when -.Nm restore -was compiled.) -.Pp -.It Fl h -Extract the actual directory, -rather than the files that it references. -This prevents hierarchical restoration of complete subtrees -from the dump. -.It Fl m -Extract by inode numbers rather than by file name. -This is useful if only a few files are being extracted, -and one wants to avoid regenerating the complete pathname -to the file. -.It Fl N -The -.Fl N -flag causes -.Nm restore to only print file names. Files are not extracted. -.It Fl s Ar fileno -Read from the specified -.Ar fileno -on a multi-file tape. -File numbering starts at 1. -.It Fl T Ar directory -The -.Fl T -flag allows the user to specify a directory to use for the storage of -temporary files. The default value is /tmp. This flag is most useful -when restoring files after having booted from a floppy. There might be little -or no space on the floppy filesystem, but another source of space might exist. -.It Fl u -When creating certain types of files, restore may generate a warning -diagnostic if they already exist in the target directory. -To prevent this, the -.Fl u -(unlink) flag causes restore to remove old entries before attempting -to create new ones. -.It Fl v -Normally -.Nm restore -does its work silently. -The -.Fl v -(verbose) -flag causes it to type the name of each file it treats -preceded by its file type. -.It Fl y -Do not ask the user whether to abort the restore in the event of an error. -Always try to skip over the bad block(s) and continue. -.El -.Sh DIAGNOSTICS -Complains if it gets a read error. -If -.Fl y -has been specified, or the user responds -.Ql y , -.Nm restore -will attempt to continue the restore. -.Pp -If a backup was made using more than one tape volume, -.Nm restore -will notify the user when it is time to mount the next volume. -If the -.Fl x -or -.Fl i -flag has been specified, -.Nm restore -will also ask which volume the user wishes to mount. -The fastest way to extract a few files is to -start with the last volume, and work towards the first volume. -.Pp -There are numerous consistency checks that can be listed by -.Nm restore . -Most checks are self-explanatory or can -.Dq never happen . -Common errors are given below. -.Pp -.Bl -tag -width Ds -compact -.It Converting to new file system format -A dump tape created from the old file system has been loaded. -It is automatically converted to the new file system format. -.Pp -.It : not found on tape -The specified file name was listed in the tape directory, -but was not found on the tape. -This is caused by tape read errors while looking for the file, -and from using a dump tape created on an active file system. -.Pp -.It expected next file , got -A file that was not listed in the directory showed up. -This can occur when using a dump created on an active file system. -.Pp -.It Incremental dump too low -When doing an incremental restore, -a dump that was written before the previous incremental dump, -or that has too low an incremental level has been loaded. -.Pp -.It Incremental dump too high -When doing an incremental restore, -a dump that does not begin its coverage where the previous incremental -dump left off, -or that has too high an incremental level has been loaded. -.Pp -.It Tape read error while restoring -.It Tape read error while skipping over inode -.It Tape read error while trying to resynchronize -A tape (or other media) read error has occurred. -If a file name is specified, -its contents are probably partially wrong. -If an inode is being skipped or the tape is trying to resynchronize, -no extracted files have been corrupted, -though files may not be found on the tape. -.Pp -.It resync restore, skipped blocks -After a dump read error, -.Nm restore -may have to resynchronize itself. -This message lists the number of blocks that were skipped over. -.El -.Sh ENVIRONMENT -If the following environment variable exists it will be utilized by -.Nm restore : -.Pp -.Bl -tag -width "TMPDIR" -compact -.It Ev TAPE -If no -f option was specified, -.Nm -will use the device specified via -.Ev TAPE -as the dump device. -.Ev TAPE -may be of the form -.Qq tapename , -.Qq host:tapename -or -.Qq user@host:tapename . -.It Ev TMPDIR -The directory given in -.Ev TMPDIR -will be used -instead of -.Pa /tmp -to store temporary files. -.It Ev RMT -The environment variable -.Ev RMT -will be used to determine the pathname of the remote -.Xr rmt 8 -program. -.Sh FILES -.Bl -tag -width "./restoresymtable" -compact -.It Pa /dev/st0 -the default tape drive -.It Pa /tmp/rstdir* -file containing directories on the tape -.It Pa /tmp/rstmode* -owner, mode, and time stamps for directories -.It Pa \&./restoresymtable -information passed between incremental restores -.El -.Sh SEE ALSO -.Xr dump 8 , -.Xr mount 8 , -.Xr newfs 8 , -.Xr mkfs 8 , -.Xr rmt 8 -.Sh BUGS -.Nm Restore -can get confused when doing incremental restores from -dumps that were made on active file systems. -.Pp -A level 0 dump must be done after a full restore. -Because -.Nm restore -runs in user code, -it has no control over inode allocation; -thus a full dump must be done to get a new set of directories -reflecting the new inode numbering, -even though the content of the files is unchanged. -.Pp -The temporary files -.Pa /tmp/rstdir* -and -.Pa /tmp/rstmode* -are generated with a unique name based on the date of the dump -and the process ID (see -.Xr mktemp 3 ), -except when -.Fl r -or -.Fl R -is used. -Because -.Fl R -allows you to restart a -.Fl r -operation that may have been interrupted, the temporary files should -be the same across different processes. -In all other cases, the files are unique because it is possible to -have two different dumps started at the same time, and separate -operations shouldn't conflict with each other. -.Pp -To do a network restore, you have to run restore as root. This is due -to the previous security history of dump and restore. (restore is -written to be setuid root, but we are not certain all bugs are gone -from the restore code - run setuid at your own risk.) -.Sh HISTORY -The -.Nm restore -command appeared in -.Bx 4.2 . diff --git a/restore/restore.8.in b/restore/restore.8.in new file mode 100644 index 0000000..5c12337 --- /dev/null +++ b/restore/restore.8.in @@ -0,0 +1,560 @@ +.\" Copyright (c) 1985, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)restore.8 8.4 (Berkeley) 5/1/95 +.\" $Id: restore.8.in,v 1.1 1999/10/11 13:08:09 stelian Exp $ +.\" +.Dd __DATE__ +.Dt RESTORE 8 +.Os "__VERSION__" +.Sh NAME +.Nm restore +.Nd "restore files or file systems from backups made with dump" +.Sh SYNOPSIS +.Nm restore +.Fl C +.Op Fl ckvy +.Op Fl b Ar blocksize +.Op Fl D Ar filesystem +.Op Fl f Ar file +.Op Fl s Ar fileno +.Op Fl T Ar directory +.Nm restore +.Fl i +.Op Fl chkmNuvy +.Op Fl b Ar blocksize +.Op Fl f Ar file +.Op Fl s Ar fileno +.Op Fl T Ar directory +.Nm restore +.Fl R +.Op Fl ckNuvy +.Op Fl b Ar blocksize +.Op Fl f Ar file +.Op Fl s Ar fileno +.Op Fl T Ar directory +.Nm restore +.Fl r +.Op Fl ckNuvy +.Op Fl b Ar blocksize +.Op Fl f Ar file +.Op Fl s Ar fileno +.Op Fl T Ar directory +.Nm restore +.Fl t +.Op Fl chkNuvy +.Op Fl b Ar blocksize +.Op Fl f Ar file +.Op Fl s Ar fileno +.Op Fl T Ar directory +.Op file ... +.Nm restore +.Fl x +.Op Fl chkmNuvy +.Op Fl b Ar blocksize +.Op Fl f Ar file +.Op Fl s Ar fileno +.Op Fl T Ar directory +.Op file ... +.Pp +.in +(The +.Bx 4.3 +option syntax is implemented for backward compatibility but +is not documented here.) +.Sh DESCRIPTION +The +.Nm restore +command performs the inverse function of +.Xr dump 8 . +A full backup of a file system may be restored and +subsequent incremental backups layered on top of it. +Single files and +directory subtrees may be restored from full or partial +backups. +.Nm Restore +works across a network; +to do this see the +.Fl f +flag described below. +Other arguments to the command are file or directory +names specifying the files that are to be restored. +Unless the +.Fl h +flag is specified (see below), +the appearance of a directory name refers to +the files and (recursively) subdirectories of that directory. +.Pp +Exactly one of the following flags is required: +.Bl -tag -width Ds +.It Fl C +This mode allows comparison of files from a dump. +.Nm Restore +reads the backup and compares its contents with files present on the +disk. +It first changes its working directory to the root of the filesystem +that was dumped and compares the tape with the files in its new +current directory. +.It Fl i +This mode allows interactive restoration of files from a dump. +After reading in the directory information from the dump, +.Nm restore +provides a shell like interface that allows the user to move +around the directory tree selecting files to be extracted. +The available commands are given below; +for those commands that require an argument, +the default is the current directory. +.Bl -tag -width Fl +.It Ic add Op Ar arg +The current directory or specified argument is added to the list of +files to be extracted. +If a directory is specified, then it and all its descendents are +added to the extraction list +(unless the +.Fl h +flag is specified on the command line). +Files that are on the extraction list are prepended with a +.Dq \&* +when they are listed by +.Ic ls . +.It Ic \&cd Ar arg +Change the current working directory to the specified argument. +.It Ic delete Op Ar arg +The current directory or specified argument is deleted from the list of +files to be extracted. +If a directory is specified, then it and all its descendents are +deleted from the extraction list +(unless the +.Fl h +flag is specified on the command line). +The most expedient way to extract most of the files from a directory +is to add the directory to the extraction list and then delete +those files that are not needed. +.It Ic extract +All files on the extraction list are extracted +from the dump. +.Nm Restore +will ask which volume the user wishes to mount. +The fastest way to extract a few files is to +start with the last volume and work towards the first volume. +.It Ic help +List a summary of the available commands. +.It Ic \&ls Op Ar arg +List the current or specified directory. +Entries that are directories are appended with a +.Dq \&* . +Entries that have been marked for extraction are prepended with a ``*''. +If the verbose +flag is set, the inode number of each entry is also listed. +.It Ic pwd +Print the full pathname of the current working directory. +.It Ic quit +Restore immediately exits, +even if the extraction list is not empty. +.It Ic setmodes +All directories that have been added to the extraction list +have their owner, modes, and times set; +nothing is extracted from the dump. +This is useful for cleaning up after a restore has been prematurely aborted. +.It Ic verbose +The sense of the +.Fl v +flag is toggled. +When set, the verbose flag causes the +.Ic ls +command to list the inode numbers of all entries. +It also causes +.Nm restore +to print out information about each file as it is extracted. +.El +.It Fl R +.Nm Restore +requests a particular tape of a multi-volume set on which to restart +a full restore +(see the +.Fl r +flag below). +This is useful if the restore has been interrupted. +.It Fl r +Restore (rebuild) a file system. +The target file system should be made pristine with +.Xr mke2fs 8 , +mounted, and the user +.Xr cd Ns 'd +into the pristine file system +before starting the restoration of the initial level 0 backup. If the +level 0 restores successfully, the +.Fl r +flag may be used to restore +any necessary incremental backups on top of the level 0. +The +.Fl r +flag precludes an interactive file extraction and can be +detrimental to one's health (not to mention the disk) if not used carefully. +An example: +.Bd -literal -offset indent +mke2fs /dev/sda1 +mount /dev/sda1 /mnt +cd /mnt + +restore rf /dev/st0 +.Ed +.Pp +Note that +.Nm restore +leaves a file +.Pa restoresymtable +in the root directory to pass information between incremental +restore passes. +This file should be removed when the last incremental has been +restored. +.Pp +.Nm Restore , +in conjunction with +.Xr mke2fs 8 +and +.Xr dump 8 , +may be used to modify file system parameters +such as size or block size. +.It Fl t +The names of the specified files are listed if they occur +on the backup. +If no file argument is given, +the root directory is listed, +which results in the entire content of the +backup being listed, +unless the +.Fl h +flag has been specified. +Note that the +.Fl t +flag replaces the function of the old +.Xr dumpdir 8 +program. +.ne 1i +.It Fl x +The named files are read from the given media. +If a named file matches a directory whose contents +are on the backup +and the +.Fl h +flag is not specified, +the directory is recursively extracted. +The owner, modification time, +and mode are restored (if possible). +If no file argument is given, +the root directory is extracted, +which results in the entire content of the +backup being extracted, +unless the +.Fl h +flag has been specified. +.El +.Pp +The following additional options may be specified: +.Bl -tag -width Ds +.It Fl b Ar blocksize +The number of kilobytes per dump record. +If the +.Fl b +option is not specified, +.Nm restore +tries to determine the media block size dynamically. +.It Fl c +Normally, +.Nm restore +will try to determine dynamically whether the dump was made from an +old (pre-4.4) or new format file system. The +.Fl c +flag disables this check, and only allows reading a dump in the old +format. +.It Fl D Ar filesystem +The +.Fl D +flag allows the user to specify the filesystem name when using +.Nm restore +with the +.Fl C +option to check the backup. +.It Fl f Ar file +Read the backup from +.Ar file ; +.Ar file +may be a special device file +like +.Pa /dev/st0 +(a tape drive), +.Pa /dev/sda1 +(a disk drive), +an ordinary file, +or +.Ql Fl +(the standard input). +If the name of the file is of the form +.Dq host:file +or +.Dq user@host:file , +.Nm restore +reads from the named file on the remote host using +.Xr rmt 8 . +.Pp +.It Fl k +Use Kerberos authentication when contacting the remote tape server. +(Only available if this options was enabled when +.Nm restore +was compiled.) +.Pp +.It Fl h +Extract the actual directory, +rather than the files that it references. +This prevents hierarchical restoration of complete subtrees +from the dump. +.It Fl m +Extract by inode numbers rather than by file name. +This is useful if only a few files are being extracted, +and one wants to avoid regenerating the complete pathname +to the file. +.It Fl N +The +.Fl N +flag causes +.Nm restore to only print file names. Files are not extracted. +.It Fl s Ar fileno +Read from the specified +.Ar fileno +on a multi-file tape. +File numbering starts at 1. +.It Fl T Ar directory +The +.Fl T +flag allows the user to specify a directory to use for the storage of +temporary files. The default value is /tmp. This flag is most useful +when restoring files after having booted from a floppy. There might be little +or no space on the floppy filesystem, but another source of space might exist. +.It Fl u +When creating certain types of files, restore may generate a warning +diagnostic if they already exist in the target directory. +To prevent this, the +.Fl u +(unlink) flag causes restore to remove old entries before attempting +to create new ones. +.It Fl v +Normally +.Nm restore +does its work silently. +The +.Fl v +(verbose) +flag causes it to type the name of each file it treats +preceded by its file type. +.It Fl y +Do not ask the user whether to abort the restore in the event of an error. +Always try to skip over the bad block(s) and continue. +.El +.Sh DIAGNOSTICS +Complains if it gets a read error. +If +.Fl y +has been specified, or the user responds +.Ql y , +.Nm restore +will attempt to continue the restore. +.Pp +If a backup was made using more than one tape volume, +.Nm restore +will notify the user when it is time to mount the next volume. +If the +.Fl x +or +.Fl i +flag has been specified, +.Nm restore +will also ask which volume the user wishes to mount. +The fastest way to extract a few files is to +start with the last volume, and work towards the first volume. +.Pp +There are numerous consistency checks that can be listed by +.Nm restore . +Most checks are self-explanatory or can +.Dq never happen . +Common errors are given below. +.Pp +.Bl -tag -width Ds -compact +.It Converting to new file system format +A dump tape created from the old file system has been loaded. +It is automatically converted to the new file system format. +.Pp +.It : not found on tape +The specified file name was listed in the tape directory, +but was not found on the tape. +This is caused by tape read errors while looking for the file, +and from using a dump tape created on an active file system. +.Pp +.It expected next file , got +A file that was not listed in the directory showed up. +This can occur when using a dump created on an active file system. +.Pp +.It Incremental dump too low +When doing an incremental restore, +a dump that was written before the previous incremental dump, +or that has too low an incremental level has been loaded. +.Pp +.It Incremental dump too high +When doing an incremental restore, +a dump that does not begin its coverage where the previous incremental +dump left off, +or that has too high an incremental level has been loaded. +.Pp +.It Tape read error while restoring +.It Tape read error while skipping over inode +.It Tape read error while trying to resynchronize +A tape (or other media) read error has occurred. +If a file name is specified, +its contents are probably partially wrong. +If an inode is being skipped or the tape is trying to resynchronize, +no extracted files have been corrupted, +though files may not be found on the tape. +.Pp +.It resync restore, skipped blocks +After a dump read error, +.Nm restore +may have to resynchronize itself. +This message lists the number of blocks that were skipped over. +.El +.Sh ENVIRONMENT +If the following environment variable exists it will be utilized by +.Nm restore : +.Pp +.Bl -tag -width "TMPDIR" -compact +.It Ev TAPE +If no -f option was specified, +.Nm +will use the device specified via +.Ev TAPE +as the dump device. +.Ev TAPE +may be of the form +.Qq tapename , +.Qq host:tapename +or +.Qq user@host:tapename . +.It Ev TMPDIR +The directory given in +.Ev TMPDIR +will be used +instead of +.Pa /tmp +to store temporary files. +.It Ev RMT +The environment variable +.Ev RMT +will be used to determine the pathname of the remote +.Xr rmt 8 +program. +.Sh FILES +.Bl -tag -width "./restoresymtable" -compact +.It Pa /dev/st0 +the default tape drive +.It Pa /tmp/rstdir* +file containing directories on the tape +.It Pa /tmp/rstmode* +owner, mode, and time stamps for directories +.It Pa \&./restoresymtable +information passed between incremental restores +.El +.Sh SEE ALSO +.Xr dump 8 , +.Xr mount 8 , +.Xr mke2fs 8 , +.Xr rmt 8 +.Sh BUGS +.Nm Restore +can get confused when doing incremental restores from +dumps that were made on active file systems. +.Pp +A level 0 dump must be done after a full restore. +Because +.Nm restore +runs in user code, +it has no control over inode allocation; +thus a full dump must be done to get a new set of directories +reflecting the new inode numbering, +even though the content of the files is unchanged. +.Pp +The temporary files +.Pa /tmp/rstdir* +and +.Pa /tmp/rstmode* +are generated with a unique name based on the date of the dump +and the process ID (see +.Xr mktemp 3 ), +except when +.Fl r +or +.Fl R +is used. +Because +.Fl R +allows you to restart a +.Fl r +operation that may have been interrupted, the temporary files should +be the same across different processes. +In all other cases, the files are unique because it is possible to +have two different dumps started at the same time, and separate +operations shouldn't conflict with each other. +.Pp +To do a network restore, you have to run restore as root. This is due +to the previous security history of dump and restore. (restore is +written to be setuid root, but we are not certain all bugs are gone +from the restore code - run setuid at your own risk.) +.Sh AUTHOR +The +.Nm dump/restore +backup suit was ported to Linux's Second Extended File System +by Remy Card . He maintained the initial versions +of dump (up and including 0.4b4, released in january 1997). +.Pp +Starting with 0.4b5, the new maintainer is Stelian Pop +.br +. +.Sh AVAILABILITY +The +.Nm dump/restore +backup suit is available for anonymous ftp from tsx-11.mit.edu +in /pub/linux/ALPHA/ext2fs (development versions) or +/pub/linux/packages/ext2fs (stable versions). +.Pp +An alternate downloading location is http://perso.cybercable.fr/pop/dump. +.Sh HISTORY +The +.Nm restore +command appeared in +.Bx 4.2 . diff --git a/restore/restore.c b/restore/restore.c index f1986a4..3eb6d93 100644 --- a/restore/restore.c +++ b/restore/restore.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)restore.c 8.3 (Berkeley) 9/13/94"; #endif static const char rcsid[] = - "$Id: restore.c,v 1.3 1999/10/11 12:59:20 stelian Exp $"; + "$Id: restore.c,v 1.4 1999/10/11 13:08:09 stelian Exp $"; #endif /* not lint */ #include diff --git a/restore/symtab.c b/restore/symtab.c index 27343d9..275dd1c 100644 --- a/restore/symtab.c +++ b/restore/symtab.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)symtab.c 8.3 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id: symtab.c,v 1.3 1999/10/11 12:59:20 stelian Exp $"; + "$Id: symtab.c,v 1.4 1999/10/11 13:08:10 stelian Exp $"; #endif /* not lint */ /* diff --git a/restore/tape.c b/restore/tape.c index 9e1e28c..ab0513a 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -49,7 +49,7 @@ static char sccsid[] = "@(#)tape.c 8.9 (Berkeley) 5/1/95"; #endif static const char rcsid[] = - "$Id: tape.c,v 1.3 1999/10/11 12:59:21 stelian Exp $"; + "$Id: tape.c,v 1.4 1999/10/11 13:08:10 stelian Exp $"; #endif /* not lint */ #include @@ -602,10 +602,11 @@ extractfile(char *name) } (void) chown(name, curfile.dip->di_uid, curfile.dip->di_gid); (void) chmod(name, mode); + if (flags) #ifdef __linux__ - (void) fsetflags(name, flags); + (void) fsetflags(name, flags); #else - (void) chflags(name, flags); + (void) chflags(name, flags); #endif skipfile(); utimes(name, timep); @@ -627,10 +628,14 @@ extractfile(char *name) } (void) chown(name, curfile.dip->di_uid, curfile.dip->di_gid); (void) chmod(name, mode); + if (flags) #ifdef __linux__ - (void) fsetflags(name, flags); + { + warn("%s: fsetflags called on a special file", name); + (void) fsetflags(name, flags); + } #else - (void) chflags(name, flags); + (void) chflags(name, flags); #endif skipfile(); utimes(name, timep); @@ -652,10 +657,11 @@ extractfile(char *name) } (void) fchown(ofile, curfile.dip->di_uid, curfile.dip->di_gid); (void) fchmod(ofile, mode); + if (flags) #ifdef __linux__ - (void) fsetflags(ofile, flags); + (void) setflags(ofile, flags); #else - (void) fchflags(ofile, flags); + (void) fchflags(ofile, flags); #endif getfile(xtrfile, xtrskip); (void) close(ofile); diff --git a/restore/utilities.c b/restore/utilities.c index 7c3bcd8..1498599 100644 --- a/restore/utilities.c +++ b/restore/utilities.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)utilities.c 8.5 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id: utilities.c,v 1.3 1999/10/11 12:59:21 stelian Exp $"; + "$Id: utilities.c,v 1.4 1999/10/11 13:08:10 stelian Exp $"; #endif /* not lint */ #include @@ -157,7 +157,6 @@ void newnode(struct entry *np) { char *cp; - if (np->e_type != NODE) badentry(np, "newnode: not a node"); cp = myname(np); diff --git a/rmt/Makefile.in b/rmt/Makefile.in index 973d942..e1d4440 100644 --- a/rmt/Makefile.in +++ b/rmt/Makefile.in @@ -18,17 +18,21 @@ SRCS= rmt.c OBJS= rmt.o MAN8= rmt.8 -all:: $(PROG) +all:: $(PROG) rmt.8 $(PROG): $(OBJS) $(DEPLIBS) $(CC) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) -install:: $(PROG) +rmt.8: rmt.8.in + sed -e "s|__DATE__|$(DATE)|g" \ + -e "s|__VERSION__|$(VERSION)|g" $< > $@ + +install:: all $(INSTALLBIN) $(PROG) $(BINDIR) $(INSTALLMAN) $(srcdir)/$(MAN8) $(MANDIR) clean:: - rm -f $(PROG) \#* *.s *.o *.a *~ core + rm -f $(PROG) \#* *.s *.o *.a *~ core rmt.8 distclean:: clean rm -f Makefile Makefile.old .depend diff --git a/rmt/rmt.8 b/rmt/rmt.8 deleted file mode 100644 index 8f9d0df..0000000 --- a/rmt/rmt.8 +++ /dev/null @@ -1,218 +0,0 @@ -.\" Copyright (c) 1983, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)rmt.8 8.3 (Berkeley) 6/1/94 -.\" -.Dd June 1, 1994 -.Dt RMT 8 -.Os BSD 4.2 -.Sh NAME -.Nm rmt -.Nd remote magtape protocol module -.Sh SYNOPSIS -.Nm rmt -.Sh DESCRIPTION -.Nm Rmt -is a program used by the remote dump and restore programs -in manipulating a magnetic tape drive through an interprocess -communication connection. -.Nm Rmt -is normally started up with an -.Xr rexec 3 -or -.Xr rcmd 3 -call. -.Pp -The -.Nm -program accepts requests specific to the manipulation of -magnetic tapes, performs the commands, then responds with -a status indication. All responses are in -.Tn ASCII -and in -one of two forms. -Successful commands have responses of: -.Bd -filled -offset indent -.Sm off -.Sy A Ar number No \en -.Sm on -.Ed -.Pp -.Ar Number -is an -.Tn ASCII -representation of a decimal number. -Unsuccessful commands are responded to with: -.Bd -filled -offset indent -.Sm off -.Xo Sy E Ar error-number -.No \en Ar error-message -.No \en -.Xc -.Sm on -.Ed -.Pp -.Ar Error-number -is one of the possible error -numbers described in -.Xr intro 2 -and -.Ar error-message -is the corresponding error string as printed -from a call to -.Xr perror 3 . -The protocol is comprised of the -following commands, which are sent as indicated - no spaces are supplied -between the command and its arguments, or between its arguments, and -.Ql \en -indicates that a newline should be supplied: -.Bl -tag -width Ds -.Sm off -.It Xo Sy \&O Ar device -.No \en Ar mode No \en -.Xc -Open the specified -.Ar device -using the indicated -.Ar mode . -.Ar Device -is a full pathname and -.Ar mode -is an -.Tn ASCII -representation of a decimal -number suitable for passing to -.Xr open 2 . -If a device had already been opened, it is -closed before a new open is performed. -.It Xo Sy C Ar device No \en -.Xc -Close the currently open device. The -.Ar device -specified is ignored. -.It Xo Sy L -.Ar whence No \en -.Ar offset No \en -.Xc -.Sm on -Perform an -.Xr lseek 2 -operation using the specified parameters. -The response value is that returned from the -.Xr lseek -call. -.Sm off -.It Sy W Ar count No \en -.Sm on -Write data onto the open device. -.Nm Rmt -reads -.Ar count -bytes from the connection, aborting if -a premature end-of-file is encountered. -The response value is that returned from -the -.Xr write 2 -call. -.Sm off -.It Sy R Ar count No \en -.Sm on -Read -.Ar count -bytes of data from the open device. -If -.Ar count -exceeds the size of the data buffer (10 kilobytes), it is -truncated to the data buffer size. -.Nm Rmt -then performs the requested -.Xr read 2 -and responds with -.Sm off -.Sy A Ar count-read No \en -.Sm on -if the read was -successful; otherwise an error in the -standard format is returned. If the read -was successful, the data read is then sent. -.Sm off -.It Xo Sy I Ar operation -.No \en Ar count No \en -.Xc -.Sm on -Perform a -.Dv MTIOCOP -.Xr ioctl 2 -command using the specified parameters. -The parameters are interpreted as the -.Tn ASCII -representations of the decimal values -to place in the -.Ar mt_op -and -.Ar mt_count -fields of the structure used in the -.Xr ioctl -call. The return value is the -.Ar count -parameter when the operation is successful. -.ne 1i -.It Sy S -Return the status of the open device, as -obtained with a -.Dv MTIOCGET -.Xr ioctl -call. If the operation was successful, -an ``ack'' is sent with the size of the -status buffer, then the status buffer is -sent (in binary). -.El -.Sm on -.Pp -Any other command causes -.Nm -to exit. -.Sh DIAGNOSTICS -All responses are of the form described above. -.Sh SEE ALSO -.Xr rcmd 3 , -.Xr rexec 3 , -.Xr mtio 4 , -.Xr rdump 8 , -.Xr rrestore 8 -.Sh BUGS -People should be discouraged from using this for a remote -file access protocol. -.Sh HISTORY -The -.Nm -command appeared in -.Bx 4.2 . diff --git a/rmt/rmt.8.in b/rmt/rmt.8.in new file mode 100644 index 0000000..2f3b3df --- /dev/null +++ b/rmt/rmt.8.in @@ -0,0 +1,236 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)rmt.8 8.3 (Berkeley) 6/1/94 +.\" +.Dd __DATE__ +.Dt RMT 8 +.Os "__VERSION__" +.Sh NAME +.Nm rmt +.Nd remote magtape protocol module +.Sh SYNOPSIS +.Nm rmt +.Sh DESCRIPTION +.Nm Rmt +is a program used by the remote dump and restore programs +in manipulating a magnetic tape drive through an interprocess +communication connection. +.Nm Rmt +is normally started up with an +.Xr rexec 3 +or +.Xr rcmd 3 +call. +.Pp +The +.Nm +program accepts requests specific to the manipulation of +magnetic tapes, performs the commands, then responds with +a status indication. All responses are in +.Tn ASCII +and in +one of two forms. +Successful commands have responses of: +.Bd -filled -offset indent +.Sm off +.Sy A Ar number No \en +.Sm on +.Ed +.Pp +.Ar Number +is an +.Tn ASCII +representation of a decimal number. +Unsuccessful commands are responded to with: +.Bd -filled -offset indent +.Sm off +.Xo Sy E Ar error-number +.No \en Ar error-message +.No \en +.Xc +.Sm on +.Ed +.Pp +.Ar Error-number +is one of the possible error +numbers described in +.Xr intro 2 +and +.Ar error-message +is the corresponding error string as printed +from a call to +.Xr perror 3 . +The protocol is comprised of the +following commands, which are sent as indicated - no spaces are supplied +between the command and its arguments, or between its arguments, and +.Ql \en +indicates that a newline should be supplied: +.Bl -tag -width Ds +.Sm off +.It Xo Sy \&O Ar device +.No \en Ar mode No \en +.Xc +Open the specified +.Ar device +using the indicated +.Ar mode . +.Ar Device +is a full pathname and +.Ar mode +is an +.Tn ASCII +representation of a decimal +number suitable for passing to +.Xr open 2 . +If a device had already been opened, it is +closed before a new open is performed. +.It Xo Sy C Ar device No \en +.Xc +Close the currently open device. The +.Ar device +specified is ignored. +.It Xo Sy L +.Ar whence No \en +.Ar offset No \en +.Xc +.Sm on +Perform an +.Xr lseek 2 +operation using the specified parameters. +The response value is that returned from the +.Xr lseek +call. +.Sm off +.It Sy W Ar count No \en +.Sm on +Write data onto the open device. +.Nm Rmt +reads +.Ar count +bytes from the connection, aborting if +a premature end-of-file is encountered. +The response value is that returned from +the +.Xr write 2 +call. +.Sm off +.It Sy R Ar count No \en +.Sm on +Read +.Ar count +bytes of data from the open device. +If +.Ar count +exceeds the size of the data buffer (10 kilobytes), it is +truncated to the data buffer size. +.Nm Rmt +then performs the requested +.Xr read 2 +and responds with +.Sm off +.Sy A Ar count-read No \en +.Sm on +if the read was +successful; otherwise an error in the +standard format is returned. If the read +was successful, the data read is then sent. +.Sm off +.It Xo Sy I Ar operation +.No \en Ar count No \en +.Xc +.Sm on +Perform a +.Dv MTIOCOP +.Xr ioctl 2 +command using the specified parameters. +The parameters are interpreted as the +.Tn ASCII +representations of the decimal values +to place in the +.Ar mt_op +and +.Ar mt_count +fields of the structure used in the +.Xr ioctl +call. The return value is the +.Ar count +parameter when the operation is successful. +.ne 1i +.It Sy S +Return the status of the open device, as +obtained with a +.Dv MTIOCGET +.Xr ioctl +call. If the operation was successful, +an ``ack'' is sent with the size of the +status buffer, then the status buffer is +sent (in binary). +.El +.Sm on +.Pp +Any other command causes +.Nm +to exit. +.Sh DIAGNOSTICS +All responses are of the form described above. +.Sh SEE ALSO +.Xr rcmd 3 , +.Xr rexec 3 , +.Xr mtio 4 , +.Xr rdump 8 , +.Xr rrestore 8 +.Sh BUGS +People should be discouraged from using this for a remote +file access protocol. +.Sh AUTHOR +The +.Nm dump/restore +backup suit was ported to Linux's Second Extended File System +by Remy Card . He maintained the initial versions +of dump (up and including 0.4b4, released in january 1997). +.Pp +Starting with 0.4b5, the new maintainer is Stelian Pop +.br +. +.Sh AVAILABILITY +The +.Nm dump/restore +backup suit is available for anonymous ftp from tsx-11.mit.edu +in /pub/linux/ALPHA/ext2fs (development versions) or +/pub/linux/packages/ext2fs (stable versions). +.Pp +An alternate downloading location is http://perso.cybercable.fr/pop/dump. +.Sh HISTORY +The +.Nm +command appeared in +.Bx 4.2 . diff --git a/rmt/rmt.c b/rmt/rmt.c index 92353af..7e79dfb 100644 --- a/rmt/rmt.c +++ b/rmt/rmt.c @@ -50,7 +50,7 @@ static const char copyright[] = static char sccsid[] = "@(#)rmt.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id: rmt.c,v 1.3 1999/10/11 12:59:21 stelian Exp $"; + "$Id: rmt.c,v 1.4 1999/10/11 13:08:11 stelian Exp $"; #endif /* not lint */ /* @@ -80,7 +80,7 @@ int maxrecsize = -1; #define SSIZE 64 char device[SSIZE]; -char count[SSIZE], mode[SSIZE], pos[SSIZE], op[SSIZE]; +char count[SSIZE], filemode[SSIZE], pos[SSIZE], op[SSIZE]; char resp[BUFSIZ]; @@ -118,14 +118,14 @@ top: if (tape >= 0) (void) close(tape); getstring(device); - getstring(mode); - DEBUG2("rmtd: O %s %s\n", device, mode); + getstring(filemode); + DEBUG2("rmtd: O %s %s\n", device, filemode); /* * XXX the rmt protocol does not provide a means to * specify the permission bits; allow rw for everyone, * as modified by the users umask */ - tape = open(device, atoi(mode), 0666); + tape = open(device, atoi(filemode), 0666); if (tape < 0) goto ioerror; goto respond;