Home | History | Annotate | Download | only in dump
History log of /src/sbin/dump/main.c
RevisionDateAuthorComments
 1.79  04-Oct-2024  rillig dump: suppress lint warning about "effectively discards 'const'"
 1.78  03-Dec-2020  kre PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.
 1.77  05-Apr-2020  joerg Fix depenency on common symbols in sbin.
 1.76  19-Aug-2019  perseant Add -D flag to allow the user to specify an alternate dumpdates file.
Closes PR #54469.
 1.75  25-Mar-2019  manu branches: 1.75.2;
Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry

This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.
 1.74  01-Mar-2019  christos Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.
 1.73  24-Aug-2015  bouyer branches: 1.73.8; 1.73.16;
Consistently use iswap64() and 64bit intermediate variable, as well as
64bit formats for c_tapea. Fixes tape useage report for large filesystems.
 1.72  24-Aug-2015  bouyer Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.71  08-Sep-2013  mlelstv branches: 1.71.4;
Fix handling of NAME aliases in /etc/fstab.
 1.70  15-Jun-2013  christos handle new lfs split
 1.69  07-Apr-2012  christos branches: 1.69.2;
factor out rawname() from dump, fsck, savecore.
 1.68  07-Apr-2012  christos use getfsspecname()
 1.67  19-Feb-2012  christos PR/45735: Bug Hunting: The dump(8) manpage, as well as the program's `usage'-line,
needs improvement
 1.66  11-Mar-2010  christos branches: 1.66.6; 1.66.8;
PR/42952: The Grey Wolf: Fix for "true incremental". Don't overload level
9, use a new level "i" which is logically 10.
 1.65  26-Feb-2010  christos PR/42883: Greywolf: Add -i flag which brings "true incremental" capability.
 1.64  20-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
 1.63  26-Oct-2006  hannken branches: 1.63.18; 1.63.22;
When using a snapshot take the snapshot raw device on further open.

Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)

Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.62  24-Jun-2006  perseant Change LFCNWRAP{STOP,GO} to make them more suitable for snapshotting; in
particular, the caller can now choose whether to wait for the condition
to be met, and if the caller of LFCNWRAPSTOP dies or otherwise closes
the descriptor, the filesystem is started again. Updated the ckckp
regression test to use the new semantics.

dump_lfs(8) now uses the fcntls to implement LFS-style snapshotting through
the -X flag, addressing PR#33457 albeit not using fss(4). Fixed a couple
other problems with dump_lfs that manifested themselves during testing.
 1.61  19-Apr-2006  hannken Emit "a snapshot of" message for snap_internal case too.
 1.60  18-Mar-2006  christos Coverity CID 2297: Fix memory leak.
 1.59  27-Jun-2005  christos sprinkle const
 1.58  19-Apr-2005  hannken Snapshot support for dump(8):

- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.

- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.

Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.57  21-Apr-2004  christos branches: 1.57.2;
Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.56  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.55  02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.54  27-Mar-2003  lukem Use "wall -g operator" (instead of private code) to broadcast() messages to
members of the operator group.
Don't install "setgid tty", and remove now unnecessary gid/egid swapping.
Remove utmp trawling code pulled in from usr.bin/who.
The Code is now simpler, and more portable (without the utmp cruft) too.

This is derived from similar work in OpenBSD.
 1.53  17-Nov-2002  itojun should be safer to cast to u_long than to cast down to int
 1.52  17-Nov-2002  tsutsui Add a cast to sizeof in printf() arg since _BSD_SIZE_T is unsigned long
on some ports.
 1.51  16-Nov-2002  itojun use strlcpy. use sizeof() instead of xxLEN to avoid de-synchronization
 1.50  07-Jan-2002  bouyer For -l: specify the timeout on the command line (in seconds) instead of
hardwiring it to 2s, as suggested on tech-userlevel.
 1.49  30-Dec-2001  lukem Add -a to "auto-size" the tape, rather than relying upon other options
to define the tape size. Requires the tape driver to either return ENOSPC
at end of media, or 0 when a write is attempted (such as the "early warning"
support in st(4) enabled with "mt eew 1"). From FreeBSD.
 1.48  25-Dec-2001  lukem Fixes from FreeBSD:
- Fix error if first tape was write protected. Fix NetBSD PRs 4754 and 6098.
- Make dump exit codes confirm to manual page.
- Use \a instead of \7 to make noise.
- Fix estimated number of tapes for huge dumps to cartridges.
- Use <sys/queue.h> SLIST_* instead of home-rolled lists.
- Do not exit if unable to read or create /etc/dumpdates.
- Support output (tape) device returning ENOSPC for end-of-media on a write.

Fixes by me:
- Remove unused ddates_in.
- Don't dump core if SIGINFO is received before 1 second has elapsed.
- Only process SIGINFO in current "active" child.
- Don't dump core in -w if dumpdates wasn't readable and ddatev == NULL
- Minor KNF; wrap some lines
 1.47  23-Dec-2001  lukem clean up from time_t -> int32_t change in dumprestore.h
 1.46  23-Dec-2001  lukem unifdef sunos
 1.45  23-Dec-2001  lukem nuke trailing whitespace
 1.44  22-Dec-2001  lukem - use correct type for minTime in findlru() (size_t instead of int)
- clean up whitespace
 1.43  20-Dec-2001  soren Another little mistake, spotted by wiz.
 1.42  20-Dec-2001  soren Sync getopt() / man page with actual getopt options.
 1.41  14-Dec-2001  bouyer Add a -l (autoload) flag. For multivolume dumps, this makes dump eject the
tape when a volume is full, and try to reopen the tape drive for 2 mn.
To be used with tape changers which load the next tape when the current one is
ejected.
While I'm there fix eject handling for remote tape.
 1.40  16-Nov-2001  lukem relax the restriction on -F that the file system image argument must be a
regular file
 1.39  15-Oct-2001  blymn Add the capability for dump to print timestamps on all informational
messages.
 1.38  14-Aug-2001  lukem - implement -F, which indicates that files-to-dump is a regular file
containing a file system image (instead of being a single file as
part of a subtree dump)
- use "file system" instead of "filesystem" or "file-system"
 1.37  08-Aug-2001  david Patch to drop setgid tty privs until forking for operator notification
 1.36  17-Jul-2001  mrg reset uid & gid around calling rmthost().
 1.35  16-Jul-2001  mrg display what signal, not "unknown"
 1.34  03-Jun-2001  hannken Assign a saved copy of dt->fs_file to mountpoint. dt->fs_file will be freed
otherwise resulting in a wrong spcl.c_filesys .
 1.33  28-May-2001  lukem * improve parsing of file-systems-to-dump when a path is given:
- if it's a path to an unmounted file-system listed in /etc/fstab, use
that instead of assuming the user wanted a subtree dump of the parent
directory. this restores the behaviour of dump before the subtree
dumping code went in.
- if it's a path to a mounted file-system which is not in /etc/fstab,
use the info from getmntinfo(3). previously, dump would choke.
* implement error checked malloc(), calloc(), strdup(), and use
appropriately (some of the calloc()s weren't being checked)
* use 'file-system' instead of 'filesystem' in the man page
 1.32  27-May-2001  lukem more KNF
 1.31  27-May-2001  lukem knf to ansi
 1.30  12-May-2001  tron Add "e" option to usage message. Problem pointed out by Takahiro Kambe
in private e-mail.
 1.29  12-May-2001  tron Fix bug in new "e" option: only eject tape if it is full, not if the dump
was finished.
 1.28  07-May-2001  tron Add a new option "e" to "dump" which allows to eject tapes automatically
if a tape change is required.
 1.27  13-Dec-2000  scw Global variables don't need to be initialised to zero.
 1.26  11-Oct-2000  briggs Fix format warnings
 1.25  01-Oct-1999  perseant branches: 1.25.6;
Working version of aborted dump{,_lfs} join.
 1.24  30-Sep-1999  perseant Back out changes made on the 29th, not at all the changes I intended to commit.
(I don't know how I did it though ... I'll figure it out tonight.)
I'll reapply this, in a working form, this evening.
 1.23  29-Sep-1999  perseant Adapt dump(8) to use filestore-independent (but still ufs-specific)
replacements for NINDIR, fsbtodb, etc. Create dump_lfs by adding a few
LFS-filestore-specific routines. As described in PR#8317.
 1.22  23-Mar-1999  bouyer branches: 1.22.2; 1.22.4;
Implement a read cache, as announced on tech-userlevel. Default is 32k
read buffer size, 512 buffer or 15% of the user memory. Can be changed
with the -k and -s options.
 1.21  03-Jan-1999  lukem add support for '-L label', which file(1) and restore(1) can extract from the
header. mostly based on [bin/6715] from Brian Grayson <bgrayson@ece.utexas.edu>

old filesystems don't have fs_qbmask and fs_qfmask set in the superblock;
fudge them as per code in /sys/ufs/ffs/ffs_vfsops.c::ffs_oldfscompat().
bug and suggested fix from Robert Elz <kre@munnari.OZ.AU> in [bin/6610]
XXX: there may be other variables required as well...
 1.20  25-Aug-1998  ross from Erik Bertelsen <erik@mediator.uni-c.dk>
{ put } { in } { lots } { of } { these } { to } { shut } { up } { egcs }
 1.19  06-Jul-1998  mrg - use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames
 1.18  18-Mar-1998  bouyer Add support for non-native byte order FFS. The dump is in filesystem byte
order, restore already knows how to byteswap dumps.
 1.17  18-Sep-1997  lukem Various changes from Brian Grayson <bgrayson@ece.utexas.edu> in [bin/4103]
* exit after providing an estimate if -S was given. the PR used -e,
but checking around indicated prior art in Solaris usin -S.
* remove superfluous 'DUMP:' prefix in two messages
* initialise blocksperfile explicitly (not necessary, but everything
else in that section gets initialised, so be consistant :)
* display the ``pretty'' name of the dumped directory, so the user
knows if it's a subset or not
 1.16  16-Sep-1997  lukem resolve conflicts from lite-2 import
 1.15  15-Sep-1997  lukem * cleanup for WARNS=1
* fix use of .Nm
* comment out some unused(?) functions
 1.14  05-Jun-1997  lukem * Add the ability to dump specific files & directories of a single
filesystem. This uses fts(3) to access the directory structure (and
not the raw device), so the standard access permissions are adhered
to (unlike dumping an entire filesystem, which just requires read
access to the raw disk device).
* Support SIGINFO status reporting.
* Remove now unused variables that previously stored the (e)uid.
* Be more informative in a couple of error messages.
 1.13  27-May-1997  mrg enable rcmd(). garbage collect.
 1.12  21-Apr-1997  mrg be safe with buffers.
 1.11  15-Apr-1997  lukem remove use of "register".
 1.10  10-Apr-1997  lukem Implement changes from [bin/1915]
* 'w' and 'W' display the year
* verbosity additions displaying total & per-volume transfer times and rates
 1.9  27-Feb-1997  mikel set bflag so that 'dump bd M N' works properly. fix from Juergen
Hannken-Illjes in PR bin/3254.
 1.8  15-Mar-1996  scottr Be more paranoid with our effective uid.
 1.7  05-Feb-1996  mrg support $TAPE. update manual to reflect reality (#1937).
 1.6  18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.5  20-Feb-1995  mycroft Use getopt(3), with obsolete() from restore(8) for backward compatibility.
 1.4  23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.3  08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.2  28-Mar-1994  cgd don't segv if called with no options!
 1.1  22-Dec-1993  cgd branches: 1.1.1;
new version from CSRG, via BSDI, with fixes
 1.1.1.2  16-Sep-1997  lukem imported from lite-2
 1.1.1.1  13-Jun-1994  mycroft Import 4.4-Lite version.
 1.22.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.2.1  11-Oct-2000  he Pull up revision 1.26 (requested by he):
Format string cleanup.
 1.25.6.8  28-Mar-2002  he Pull up revisions 1.33-1.34 (via patch, requested by bouyer):
Improve behaviour when a path is given:
1) check if the path is an unmounted file system listed in fstab
2) check if it is a path to a mounted file system not listed in fstab
Fixes PR#15790.
 1.25.6.7  16-Jan-2002  he Pull up revision 1.49 (via patch, requested by bouyer):
Add an ``-a'' option to ``auto-size'' the tape, rather than
relying upon other options to define the tape size.
 1.25.6.6  16-Jan-2002  he Pull up revisions 1.46-1.48 (via patch, requested by bouyer):
Various fixes:
o Fix error if first tape is write-protected; fixes PR#4754 and PR#6098
o Make error codes conform to manual page
o Use \a to make noise
o Fix estimated number of tapes for huge dumps to cartridges
o Use <sys/queue.h> SLIST_* macros instead of homegrown variants
o Do not exit if unable to read/create /etc/dumpdates
o Support output (tape) device returning ENOSPC for end-of-media on write
o Don't dump core if SIGINFO is received before 1 second has elapsed
o Only process SIGINFO in currently active child
o Ensure current (sub)block isn't past end of file system -- fixes
"spins forever but does nothing" bug.
o Some other minor fixes (types, whitespace, KNF, unifdef sunos, ...)
 1.25.6.5  16-Jan-2002  he Pull up revisions 1.41,1.50 (via patch, requested by bouyer):
Implement ``-l <timeout>'' option for use with e.g. autochangers.
 1.25.6.4  08-Aug-2001  jhawk Pull up revision 1.37 via patch (requested by david):
Temporarily drop setgid (for setgid tty) privileges, but restore them
if we fork to perform an operator notification. Generalize pre-existing
#ifdef RDUMP code.
 1.25.6.3  15-May-2001  he Pull up revision 1.29 (requested by tron):
Fix bug in new ``e'' option: only eject tape if it is full, not
if the dump was finished.
 1.25.6.2  09-May-2001  he Pull up revision 1.28 (requested by tron):
Add a new option ``e'' to dump which directs it to eject tapes
automatically if a tape change is required.
 1.25.6.1  18-Oct-2000  tv Pullup sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.57.2.3  11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.57.2.2  21-Apr-2006  tron branches: 1.57.2.2.2;
Pull up following revision(s) (requested by hannken in ticket #1283):
sbin/dump/main.c: revision 1.61
Emit "a snapshot of" message for snap_internal case too.
 1.57.2.1  21-Apr-2005  tron branches: 1.57.2.1.2;
Pull up revision 1.58 (requested by hannken in ticket #184):
Snapshot support for dump(8):
- New option `-x backup' takes the dump from a snapshot backed up by `backup'.
The snapshot will be deleted on exit.
- New option `-X' as a synonym for `-x mountpoint' where `mountpoint' is the
file system to be dumped.
Reviewed and Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.57.2.2.2.1  11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.57.2.1.2.1  11-Nov-2006  bouyer Pull up following revision(s) (requested by hannken in ticket #1573):
sbin/dump/snapshot.h: revision 1.3 via patch
sbin/dump/snapshot.c: revision 1.3 via patch
sbin/dump/main.c: revision 1.63 via patch
sbin/dump/tape.c: revision 1.47 via patch
sbin/dump/dump.h: revision 1.44 via patch
When using a snapshot take the snapshot raw device on further open.
Fixes PR #34923 dump(8) only dumps a corefile with -X (snapshots)
Approved by: Manuel Bouyer <bouyer@netbsd.org>
 1.63.22.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.63.18.1  28-Sep-2008  mjf Sync with HEAD.
 1.66.8.2  08-Mar-2016  snj Pull up following revision(s) (requested by bouyer in ticket #1332):
sbin/dump/main.c: revision 1.73
sbin/dump/tape.c: revision 1.54
Consistently use iswap64() and 64bit intermediate variable, as well as
64bit formats for c_tapea. Fixes tape useage report for large filesystems.
 1.66.8.1  08-Mar-2016  snj Pull up following revision(s) (requested by bouyer in ticket #1331):
sbin/dump/dump.8: revision 1.67 via patch
sbin/dump/main.c: revision 1.72
sbin/dump/rcache.c: revision 1.25
Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.66.6.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.66.6.1  17-Apr-2012  yamt sync with head
 1.69.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.69.2.1  23-Jun-2013  tls resync from head
 1.71.4.2  06-Nov-2015  riz Pull up following revision(s) (requested by bouyer in ticket #991):
sbin/dump/tape.c: revision 1.54
sbin/dump/main.c: revision 1.73
Consistently use iswap64() and 64bit intermediate variable, as well as
64bit formats for c_tapea. Fixes tape useage report for large filesystems.
 1.71.4.1  06-Nov-2015  riz Pull up following revision(s) (requested by bouyer in ticket #990):
sbin/dump/rcache.c: revision 1.25
sbin/dump/dump.8: revision 1.67
sbin/dump/main.c: revision 1.72
Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
 1.73.16.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.73.16.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.73.16.1  10-Jun-2019  christos Sync with HEAD
 1.73.8.2  07-Dec-2020  martin Pull up following revision(s) (requested by kre in ticket #1630):

sbin/dump/dump.h: revision 1.59
sbin/dump/main.c: revision 1.78

PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.
 1.73.8.1  29-Mar-2019  martin Pull up following revision(s) (requested by manu in ticket #1221):

sbin/dump/tape.c: revision 1.55
sbin/dump_lfs/dump_lfs.8: revision 1.18
sbin/dump/dump.h: revision 1.56
sbin/dump/dump.8: revision 1.69
sbin/dump/dump.h: revision 1.57
sbin/dump/ffs_inode.c: revision 1.23
sbin/dump/optr.c: revision 1.43
sbin/dump/itime.c: revision 1.21
sbin/dump/main.c: revision 1.74
sbin/dump/itime.c: revision 1.22
sbin/dump/main.c: revision 1.75
sbin/dump/dump.8: revision 1.70
sbin/dump/traverse.c: revision 1.52
sbin/dump/dump.8: revision 1.71

Document what rdump is (was once) for. PR 53442.

Use getfsspecname() to fill the filesystem argument in dumpdates.
While here, make sure that the error strings terminate with newline
consistently, and add a function that adds the system error string.

Add -U flag to dump(8) and dump_lfs(8) to specify dumpdates entry
This address situations where dump(8) cannot figure out the device being
dumped. It also allows tracking of subvolume dumps by using virtual
device as dumpdates entry.

Bump date for previous.
 1.75.2.1  06-Dec-2020  martin Pull up following revision(s) (requested by kre in ticket #1139):

sbin/dump/dump.h: revision 1.59
sbin/dump/main.c: revision 1.78

PR bin/55834

count blocks written in unsigned 64 bit counter
rather than signed int which overflows after 2^31-1
blocks (2TiB) after which neither the 5 minute
status updates or SIGINFO (^T) reports are issued
until the negative numbers increase past 0 and
wildly inaccurate reports would be written.

RSS XML Feed