NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/42880: dump(8) needs "true incremental backup" capacity



>Number:         42880
>Category:       bin
>Synopsis:       dump(8) needs "true incremental backup" capacity
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 24 12:30:00 +0000 2010
>Originator:     The Grey Wolf <greywolf%starwolf.com@localhost>
>Release:        NetBSD 5.0_RC1
>Organization:
Random Spherical Collisions
>Environment:
        
        
System: NetBSD lothlorien.starwolf.com 5.0_RC1 NetBSD 5.0_RC1 (GENERIC) #0: Wed 
Jan 28 10:59:04 PST 2009 
builds@wb25:/home/builds/ab/netbsd-5/i386/200901280002Z-obj/home/builds/ab/netbsd-5/src/sys/arch/i386/compile/GENERIC
 i386
Architecture: i386
Machine: i386
>Description:
        Dump(8) will not perform an incremental dump once a level 9 dump
        (with a record saved into /etc/dumpdates) is performed; all dumps
        are incremental after that.
>How-To-Repeat:
        # dump 9auf $output_file /file/system
        # dump 9auf $output_file2 /file/system

        $output_file will contain everything modified since the last
        recorded level 8 (or lower) dump.  $output_file2 will also contain
        everything modified thence, because dump doesn't look at the
        last level 9 record.

        The patches below allow a dump with level 'i' to dump at level 9,
        but to take the _previous_ recorded level 9 into account, i.e.

        # : assume previous dump was not level 9:
        # dump 9auf $output_file /file/system
        [everything modified since the last lower level dump and now
        gets spit to the file, and the level 9 dump date is recorded]
        # : and some time later...
        # dump iauf $output_file2 /file/system
        [everything modified since the last level 9 dump gets spit to
        the output file #2, and a level 9 dump date is recorded,
        overwriting the previous one.]
        #
>Fix:
--- dump.h.orig 2010-02-24 00:26:52.000000000 -0800
+++ dump.h      2010-02-24 00:26:56.000000000 -0800
@@ -110,6 +110,7 @@
 int    diskfd;         /* disk file descriptor */
 int    tapefd;         /* tape file descriptor */
 int    pipeout;        /* true => output to standard output */
+int    trueinc;        /* true => "true incremental", i.e use last 9 as ref */
 ino_t  curino;         /* current inumber; used globally */
 int    newtape;        /* new tape flag */
 u_int64_t      tapesize;       /* estimated tape size, blocks */
--- main.c.orig 2010-02-24 00:16:39.000000000 -0800
+++ main.c      2010-02-24 01:50:29.000000000 -0800
@@ -134,7 +134,7 @@
 
        obsolete(&argc, &argv);
        while ((ch = getopt(argc, argv,
-           "0123456789aB:b:cd:eFf:h:k:l:L:nr:s:StT:uWwx:X")) != -1)
+           "0123456789iaB:b:cd:eFf:h:k:l:L:nr:s:StT:uWwx:X")) != -1)
                switch (ch) {
                /* dump level */
                case '0': case '1': case '2': case '3': case '4':
@@ -142,6 +142,11 @@
                        level = ch;
                        break;
 
+               case 'i':       /* "true incremental" regardless level 9 */
+                       level = '9';
+                       trueinc = 1;
+                       break;
+
                case 'a':               /* `auto-size', Write to EOM. */
                        unlimited = 1;
                        break;
--- itime.c.orig        2010-02-24 00:28:59.000000000 -0800
+++ itime.c     2010-02-24 01:23:42.000000000 -0800
@@ -145,12 +145,14 @@
        initdumptimes();
        /*
         *      Go find the entry with the same name for a lower increment
-        *      and older date
+        *      and older date.  If we are doing a true incremental, then
+        *      we can use level 9 as a ref point
         */
        ITITERATE(i, ddp) {
                if (strncmp(fname, ddp->dd_name, sizeof (ddp->dd_name)) != 0)
                        continue;
-               if (ddp->dd_level >= level)
+               if ((!trueinc && (ddp->dd_level >= level)) ||
+                   (trueinc && (ddp->dd_level > level)))
                        continue;
                if (ddp->dd_ddate <= iswap32(spcl.c_ddate))
                        continue;
--- dump.8.orig 2010-02-24 02:54:31.000000000 -0800
+++ dump.8      2010-02-24 02:58:50.000000000 -0800
@@ -39,7 +39,7 @@
 .Nd file system backup
 .Sh SYNOPSIS
 .Nm
-.Op Fl 0123456789aceFnStuX
+.Op Fl 0123456789aceFinStuX
 .Bk -words
 .Op Fl B Ar records
 .Ek
@@ -147,7 +147,9 @@
 option below).
 A level number above 0, incremental backup,
 tells dump to copy all files new or modified since the
-last dump of a lower level.
+last dump of a lower level (but see also the
+.Fl i
+option below).
 The default level is 9.
 .It Fl a
 .Dq auto-size .
@@ -221,6 +223,10 @@
 The default honor level is 1,
 so that incremental backups omit such files
 but full backups retain them.
+.It Fl i Ar incremental
+The dump is treated as level 9 but takes into account a previous
+level 9, if one exists.  This makes it possible to perform a "true
+incremental" dump.
 .It Fl k Ar read-blocksize
 The size in kilobyte of the read buffers, rounded up to a multiple of the
 file system block size.

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index