Subject: Bug or feature: nodump on directories doesn't work
To: None <netbsd-users@netbsd.org>
From: Brian C. Grayson <bgrayson@marvin.ece.utexas.edu>
List: netbsd-users
Date: 10/22/1998 13:43:05
  Is this a bug or a feature?  The nodump flag (see chflags(2))
prevents files from being dumped to backup, depending on the
'honor' setting to dump(8).  However, if one sets the nodump flag
on a directory (say, /usr/pkgsrc or /usr/src), it dumps the
directory and everything in it anyway.

  I'd like to be able to mark all top-level directories under
/usr/src (except maybe /usr/src/sys/arch/i386/conf) as
nondumpable, and save a few 100MBs on our dump tapes!  The only
alternative is to run a chflags -R every night to do the job,
to pick up any newly-generated .o files etc.

  Here's an example:
% ls -loR
total 593
-r-xr-xr-x  1 bgrayson  wheel  nodump 290816 Oct 20 00:49 a*
-r-xr-xr-x  1 bgrayson  wheel  -      290816 Oct 20 00:49 b*
drwxr-xr-x  2 bgrayson  wheel  -         512 Oct 20 00:50 bar/

./bar:
total 592
-r-xr-xr-x  1 bgrayson  wheel  - 290816 Oct 20 00:50 a*
-r-xr-xr-x  1 bgrayson  wheel  - 290816 Oct 20 00:50 b*

% du
593     ./bar
1186    .

% dump S0h 0 .
...
  DUMP: estimated 898 tape blocks on 0.02 tape(s).

% chflags nodump bar

% ls -lod bar
drwxr-xr-x  2 bgrayson  wheel  nodump 512 Oct 20 00:50 bar/

% dump S0h 0 .
...
  DUMP: estimated 896 tape blocks on 0.02 tape(s).

  Notice that setting the nodump flag on bar made no difference
in the dump size.  (Actually, it looks like it won't dump the
directory itself (savings of 2 blocks), but it will dump the
files in the directory.)

  Thanks.  I tried looking at the source code, but couldn't
figure out exactly where the nodump flag needs to be checked to
prevent recursion.  I'm running -current from a week or two ago.

  Brian
-- 
"... and it is called a Schmitt trigger because Bubba Schmitt invented it."
	- John Bennett, ELEC 426