NetBSD Problem Report #42883

From www@NetBSD.org  Thu Feb 25 01:23:31 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id B8CD763C594
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 25 Feb 2010 01:23:31 +0000 (UTC)
Message-Id: <20100225012331.7C50063C49F@www.NetBSD.org>
Date: Thu, 25 Feb 2010 01:23:31 +0000 (UTC)
From: greywolf@starwolf.com
Reply-To: greywolf@starwolf.com
To: gnats-bugs@NetBSD.org
Subject: dump(8) needs "true incremental backup" capacity
X-Send-Pr-Version: www-1.0

>Number:         42883
>Category:       bin
>Synopsis:       dump(8) needs "true incremental backup" capacity
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 25 01:25:00 +0000 2010
>Closed-Date:    Fri Feb 26 02:12:19 +0000 2010
>Last-Modified:  Fri Feb 26 02:15:02 +0000 2010
>Originator:     Greywolf
>Release:        NetBSD-5.0_RC1
>Organization:
Random Spherical Collisions
>Environment:
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

[code patch is against NetBSD-current]
>Description:
** this report supersedes bin/42880 **

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:
#/* this report supersedes bin/42880 */
--- 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.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 */
--- dump.8.orig 2010-02-24 02:54:31.000000000 -0800
+++ dump.8      2010-02-24 17:03:34.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.
@@ -551,6 +557,12 @@
 .Nm
 command appeared in
 .At v6 .
+.Pp
+The
+.Fl i
+flag was inspired by the
+.Fl x
+flag from Sun's Solstice Backup utility.
 .Sh BUGS
 Fewer than 32 read errors on the file system are ignored.
 .Pp

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: christos@NetBSD.org
State-Changed-When: Thu, 25 Feb 2010 21:12:19 -0500
State-Changed-Why:
patch applied, thanks


From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42883 CVS commit: src/sbin/dump
Date: Thu, 25 Feb 2010 21:11:40 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Fri Feb 26 02:11:40 UTC 2010

 Modified Files:
 	src/sbin/dump: dump.8 dump.h itime.c main.c

 Log Message:
 PR/42883: Greywolf: Add -i flag which brings "true incremental" capability.


 To generate a diff of this commit:
 cvs rdiff -u -r1.58 -r1.59 src/sbin/dump/dump.8
 cvs rdiff -u -r1.45 -r1.46 src/sbin/dump/dump.h
 cvs rdiff -u -r1.16 -r1.17 src/sbin/dump/itime.c
 cvs rdiff -u -r1.64 -r1.65 src/sbin/dump/main.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.