History log of /freebsd-10.1-release/sbin/dump/main.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 229403 03-Jan-2012 ed

Replace index() and rindex() calls with strchr() and strrchr().

The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.


# 217769 24-Jan-2011 mckusick

The dump, fsck_ffs, fsdb, fsirand, newfs, makefs, and quot utilities
include sys/time.h instead of time.h. This include is incorrect as
per the manpages for the APIs and the POSIX definitions. This commit
replaces sys/time.h where necessary with time.h.

The commit also includes some minor style(9) header fixup in newfs.

This commit is part of a larger effort by Garrett Cooper started in
//depot/user/gcooper/posix-conformance-work/ -- to make FreeBSD more
POSIX compliant.

Submitted by: Garrett Cooper yanegomi at gmail dot com


# 203459 03-Feb-2010 delphij

Plug two memory leaks in error case.

MFC after: 1 month


# 179275 24-May-2008 mckusick

Expand dump to allow MAX_INT dump levels.

PR: bin/100732
Submitted by: Matthew Vincenz <msvincen@midway.uchicago.edu>


# 179267 23-May-2008 mckusick

When using dump to generate level 0 dumps which are then rsync'ed
to a remote machine, the fact that the dump date is stored with
each header (inode) record makes rsync significantly less efficient
than necessary. This also applies to inode access times when they
are not important data to retain. When implementing an offsite
backup solution of this type, these dates in particular are not
important, especially if it prevents effective offsite backups.

PR: bin/91049
Submitted by: Forrest W Christian <fwc@mt.net>


# 163280 12-Oct-2006 ru

Make "dump /filesystem" (without options) work.

PR: docs/84408
MFC after: 3 days


# 161333 15-Aug-2006 mjacob

If rawname returns NULL, deal with it appropriately.

PR: 94045
Submitted by: Andrey Elsukov
MFC after: 1 week


# 145238 18-Apr-2005 imp

'r' disk devices no longer exist, so don't try to create a pathname
that has an 'r' in it.

This also eliminates a bogus use of strlcat.
PR: 80064


# 141611 10-Feb-2005 ru

Sync program's usage() with manpage's SYNOPSIS.


# 140604 21-Jan-2005 wes

Forced commit to note:

MFC after: 2 weeks


# 140602 21-Jan-2005 wes

Improved error checking for existence of a .snap directory to
generate snapshots in when -L is requested. If the .snap directory
does not exist, or is not a directory, issue a warning and revert
to the non- live behavior.

Obtained from: St. Bernard Software RAPID


# 128175 13-Apr-2004 green

Add -P arguments for dump(8) and restore(8) which allow the user to
use backup methods other than files and tapes. The -P argument is
a normal sh(1) pipeline with either $DUMP_VOLUME or $RESTORE_VOLUME
defined in the environment, respectively.

For example, I can back up my home to three DVD+R[W]s as so:
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0s2e 40028550 10093140 26733126 27% /home
green# dump -0 -L -C16 -B4589840 -P 'growisofs -Z /dev/cd0=/dev/fd/0' /home


# 128166 12-Apr-2004 green

Improve the warnings for dump -L and do not bother doing the snapshot if
it is specified for read-only filesystems.

Submitted by: Jason Young <jyoung8607@hotmail.com>
PR: 46672


# 128073 09-Apr-2004 markm

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp


# 124132 04-Jan-2004 iedowse

Define _PATH_MKSNAP_FFS and use it in dump(8) instead of assuming
that mksnap_ffs(8) can be found using the current $PATH.

Reviewed by: mckusick


# 122787 16-Nov-2003 mckusick

Convert the live dump command (`dump -L') to use mksnap_ffs instead
of trying to directly create the snapshot itself. This change allows
users logged into the system as operator to run live dumps.

Note that dump no longer tries to create the snapshot in the root of
the filesystem, but rather in a .snap directory in the root of the
filesystem. The reason is that the operator is usually not permitted
to write into the root of the filesystem. The newfs command and
background fsck have both been modified to create a .snap directory
in the root of the filesystem, but if neither of these have been run,
then the .snap directory must be created manually by the superuser
before a live dump can be run. The .snap directory should be owned
by user root and group operator and set to mode 770.


# 122669 14-Nov-2003 johan

Make this WARNS=2 clean by
- using (intmax_t) and %j
- giving a non-empty format string to msg()

Include <stdint.h> directly instead of depending on <inttypes.h>
to do it.

Tested by: make universe


# 114810 07-May-2003 mckusick

Dump is hard-wired to believe that it can read disks on
1024-byte boundaries. For many years this was a reasonable
assumption. However, in recent years we have begun seeing
devices with 2048-byte sectors. These devices return errors
when dump tries to read starting in the middle of a sector
or when it tries to read only the first half of a sector.
Rather than change the native block size used by dump (and
thus create an incompatible dump format), this fix checks
for transfer requests that start and/or end on a non-sector
boundary. When such a read is detected, the new code reads
the entire sector and copies out just the part that dump
needs.

Reviewed by: Poul-Henning Kamp <phk@critter.freebsd.dk>
Approved by: re (John Baldwin <jhb@FreeBSD.org>)
Sponsored by: DARPA & NAI Labs.


# 114463 01-May-2003 ru

Removed all vestiges of KerberosIV.


# 114452 01-May-2003 markm

De-Kerberise (KerberosIV). KerberosIV is no longer present, and
remote backups can still be done with Kerberos authentication using
SSH and Kerberos 5.


# 113214 07-Apr-2003 mdodd

Avoid a name conflict with future functionality:

getfstab() -> dump_getfstab()


# 111287 22-Feb-2003 ru

Sort options.


# 109244 14-Jan-2003 dillon

Comment correction. NetBSD uses 'readblksize' as the multiplier for the
-r option, which defaults to 32K (not 512 bytes). Still just as bad
from a UI standpoint, though.


# 109190 13-Jan-2003 dillon

really, this time for sure. Fix formatting in usage().


# 109189 13-Jan-2003 dillon

Grr. I keep forgetting things. Include -C in dump's usage() .


# 109188 13-Jan-2003 dillon

Add support for obsolete option form for -C


# 109187 13-Jan-2003 dillon

Add a caching option to dump. Use -C. Note that NetBSD has a caching option
called -r but it takes 512 byte blocks instead of megabytes, and I felt a
megabytes specification would be far more useful so I did not use the same
option character.

This will *greatly* improve dump performance at the cost of possibly
missing filesystem changes that occur between passes, and does a fairly
good job making up for the loss of buffered block devices. Caching is disabled
by default to retain historical behavior.

In tests, dump performance improved by about 40% when dumping / or /usr.

Beware that dump forks and the cache may wind up being larger then you
specify, but a more complex shared memory implementation would not produce
results that are all that much better so I kept it simple for now.

MFC after: 3 days


# 107559 03-Dec-2002 mckusick

Add the `L' option to dump to notify it that it is dumping a
live filesystem. To obtain a consistent dump image, dump takes
a snapshot of the filesystem and then does a dump of the snapshot.
The snapshot is removed when the dump is complete.

Also add an operator warning that the `L' option should be used
if dump is run on a live filesystem without the `L' option being
specified. The alternative would be to silently use a snapshot
any time that a live filesystem is dumped, but this change in
dump semantics seemed too drastic at this time.

Sponsored by: DARPA & NAI Labs.
Approved by: re


# 107294 27-Nov-2002 mckusick

Create a new 32-bit fs_flags word in the superblock. Add code to move
the old 8-bit fs_old_flags to the new location the first time that the
filesystem is mounted by a new kernel. One of the unused flags in
fs_old_flags is used to indicate that the flags have been moved.
Leave the fs_old_flags word intact so that it will work properly if
used on an old kernel.

Change the fs_sblockloc superblock location field to be in units
of bytes instead of in units of filesystem fragments. The old units
did not work properly when the fragment size exceeeded the superblock
size (8192). Update old fs_sblockloc values at the same time that
the flags are moved.

Suggested by: BOUWSMA Barry <freebsd-misuser@netscum.dyndns.dk>
Sponsored by: DARPA & NAI Labs.


# 104290 01-Oct-2002 bde

Changed "file system" back to "filesystem" in the usage message. English
rules don't apply to tokens that are supposed to represent single args.
This was only fixed in the man page.

Fixed other differences between the man page and the usage message (1
formatting bug and 1 syntax bug).


# 103949 25-Sep-2002 mike

Use the standardized CHAR_BIT constant instead of NBBY in userland.


# 102231 21-Aug-2002 trhodes

s/filesystem/file system/g as discussed on -developers


# 99562 07-Jul-2002 iedowse

Replace the use of %qd with intmax_t/%jd and fix a number of -Wall
and -Wformat warnings:
o Include timeconv.h for the time conversion functions.
o Remove unused variables.
o Correct a few cases where %d was used when printing longs.


# 98542 21-Jun-2002 mckusick

This commit adds basic support for the UFS2 filesystem. The UFS2
filesystem expands the inode to 256 bytes to make space for 64-bit
block pointers. It also adds a file-creation time field, an ability
to use jumbo blocks per inode to allow extent like pointer density,
and space for extended attributes (up to twice the filesystem block
size worth of attributes, e.g., on a 16K filesystem, there is space
for 32K of attributes). UFS2 fully supports and runs existing UFS1
filesystems. New filesystems built using newfs can be built in either
UFS1 or UFS2 format using the -O option. In this commit UFS1 is
the default format, so if you want to build UFS2 format filesystems,
you must specify -O 2. This default will be changed to UFS2 when
UFS2 proves itself to be stable. In this commit the boot code for
reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c)
as there is insufficient space in the boot block. Once the size of the
boot block is increased, this code can be defined.

Things to note: the definition of SBSIZE has changed to SBLOCKSIZE.
The header file <ufs/ufs/dinode.h> must be included before
<ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and
ufs_lbn_t.

Still TODO:
Verify that the first level bootstraps work for all the architectures.
Convert the utility ffsinfo to understand UFS2 and test growfs.
Add support for the extended attribute storage. Update soft updates
to ensure integrity of extended attribute storage. Switch the
current extended attribute interfaces to use the extended attribute
storage. Add the extent like functionality (framework is there,
but is currently never used).

Sponsored by: DARPA & NAI Labs.
Reviewed by: Poul-Henning Kamp <phk@freebsd.org>


# 96707 16-May-2002 trhodes

more file system > filesystem


# 96478 12-May-2002 phk

Sigh, more BBSIZE related breakage.

Sponsored by: DARPA & NAI Labs.


# 92837 20-Mar-2002 imp

o remove __P
o Use ANSI function definitions
o unifdef -D__STDC__


# 91540 01-Mar-2002 iedowse

Add a new "-S" flag to dump to allow it just print out dump estimate
size and then exit.

PR: bin/35450
Submitted by: Mark Hannon <markhannon@optushome.com.au>
Obtained from: NetBSD
MFC after: 1 week


# 90743 16-Feb-2002 iedowse

Supply progress information in dump's process title, which is useful
for monitoring automated backups. This is based on a patch by Mikhail
Teterin, with some changes to make its operation clearer and to
update the proctitle more frequently.

PR: bin/32138


# 89572 19-Jan-2002 dillon

I've been meaning to do this for a while. Add an underscore to the
time_to_xxx() and xxx_to_time() functions. e.g. _time_to_xxx()
instead of time_to_xxx(), to make it more obvious that these are
stopgap functions & placemarkers and not meant to create a defacto
standard. They will eventually be replaced when a real standard
comes out of committee.


# 86473 16-Nov-2001 iedowse

Zap a number of #ifdef sunos blocks, and all of the `register'
keywords.


# 86470 16-Nov-2001 iedowse

Give a sensible error message when the filesystem to be dumped is
not listed in /etc/fstab. Previously, the user would be greeted
with "DUMP: bad sblock magic number" when dump tried to parse
the directory contents as an FFS filesystem.

PR: bin/12789
Submitted by: Bob Willcox <bob@pmr.com>


# 85635 28-Oct-2001 dillon

Make the protocol/dumprestore.h header match restore's idea of the dump
header for the case where sizeof(time_t) != sizeof(int). dumprestore.h
was embedding time_t when it should have been embedding int32_t.

Use time_to_time32() and time32_to_time() to convert between the
protocoll/file-format time and time_t.


# 83083 05-Sep-2001 ru

SECURITY.

Notify operators using wall(1)'s -g option.
Drop ``setgid tty'' privilege.

Obtained from: OpenBSD
MFC after: 1 month


# 79442 09-Jul-2001 dillon

Add manual page and usage for dump -D (supplied by Dima Dorfman) (will also
be MFC'd)

Submitted by: Dima Dorfman <dima@unixfreak.org>


# 79428 08-Jul-2001 dillon

Oops, forgot to add 'D' to the option morphing block.


# 79427 08-Jul-2001 dillon

Add a -D option to dump, allowing the path for the /etc/dumpdates file to be
changed, so independant entities backing up the same thing to different
media can be made not to trip over each other.

MFC after: 3 days


# 77929 09-Jun-2001 dd

Since we use getopt (in rev. 1.12), there's no need for the case's for
the individual options to increment argv and decrement argc. This
caused the -T option to swallow an extra argument.

PR: 27982
Submitted by: Samuel Greear <sgreear@vsni.com>


# 71750 28-Jan-2001 phk

Use \a instead of \007 for making noise.

Submitted by: "Jason Smethers" <jsmethers@pdq.net>


# 58928 02-Apr-2000 joerg

Avoid rawname() stupidly prepending an `r' before the device name even
in cases where the supplied name was already pointing to a character
special device. This fixes the breakage that occured when trying to
dump a filesystem by name (e. g. /usr), with an fstab already
mentioning the raw device name (like /dev/rda0g) where dump attempted
to use /dev/rrda0g then.

Also removed the now obsolete remark that fstab were carrying block
special names.


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 47446 23-May-1999 jmz

Fix typo in dump reporting

PR: bin/10573
Submitted by: Christian Weisgerber <naddy@mips.rhein-neckar.de>


# 39382 16-Sep-1998 andreas

checked, that new sa CAM driver takes care of using buffer sizes
<= 64 KB. Was able to dump/restore with block sizes of 96, 128 and
200. using systat -vmstat I noticed transfer blocksizes <= 64KB,
so physio's limits aren't touched.
Since this check was originally from me, I feels safe now to back it
out.


# 37635 14-Jul-1998 jkoshy

Make `dump' exit codes confirm to manual page.

PR: 5346
Style-check-by: bde


# 36997 15-Jun-1998 charnier

Correct use of .Nm. Add rcsid. Remove unused #includes.


# 26543 10-Jun-1997 charnier

Add Id. Cosmetic in usage string.


# 25288 29-Apr-1997 wollman

Implement Kerberized rcmd for rdump/rrestore. This is lacking the
options one would normally expect to set the realm, enable encryption,
and whatnot, but this actually is able to contact the remote server,
so at least it's a start. (As a bonus, the stripped static binary is
unquestionably exportable.)


# 23891 15-Mar-1997 peter

The -a option (autosize) option got mangled during the Lite2 merge.

Pointed out by: Tom Jackson <tom@peeper.jackson.org>


# 23672 11-Mar-1997 peter

Merge Lite2 changes (rather bigish, the dump/restore folks should check)


# 22192 01-Feb-1997 joerg

Add the `a' option (``auto-size'') to bypass all tape length
considerations, and dump right to the end of medium.


# 21413 08-Jan-1997 peter

Fix double typo


# 21409 07-Jan-1997 imp

Fix many buffer overflows, correct usage of strcat and implement
$TAPE. Inspired by OpenBSD's work in this area.

Reviewed by: Peter Wemm, Guido van Rooij and Jordan Hubbard.
Obtained from: OpenBSD


# 21407 07-Jan-1997 pst

bin/1789: dump estimates a negative number of tapes needed for huge dumps


# 18286 14-Sep-1996 bde

Don't use __dead or __pure in user code. They were obfuscations
for gcc >= 2.5 and no-ops for gcc >= 2.6. Converted to use __dead2
or __pure2 where it wasn't already done, except in math.h where use
of __pure was mostly wrong.


# 12986 23-Dec-1995 joerg

Put the superfluous "DUMP:" back in the statistics line, to make
Amanda happy.


# 12377 18-Nov-1995 joerg

Andreas Klemm's patch set for dump(8), with some minor (cosmetic)
changes and one addition by me.

. Use reasonable defaults for the tape drive (/dev/rst0) instead of
something we actually don't have.

. Add a summary line displaying the alapsed time and the total throughput.

. Replace "rmt" for the remote location of rmt(8) by "/etc/rmt", since this
is the historical protocol, and relying on the $PATH causes a big pain.
Make it adjustable via an environmental variable though.

Reviewed by: joerg (for Andreas' part)
Submitted by: andreas@knobel.gun.de (Andreas Klemm)


# 11770 24-Oct-1995 jkh

Fix a silly bug where MAXPATHLEN was subtracted from the string length rather
than the other way around!
Submitted by: Elmar Bartel <bartel@informatik.tu-muenchen.de>


# 8871 30-May-1995 rgrimes

Remove trailing whitespace.


# 3974 28-Oct-1994 joerg

Fixed an evil bug where rawname() could write across the boundaries of
an array. The bug became obvious in the old system where the array was only
32 characters long (now MAXPATHLEN). Dump honored its name then (:-)
and dumped its core when calling dump -w for a fstab that contained rather long
NFS file system names. Even though this is rather unlikely to happen now,
a bug is a bug:)


# 1559 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1558,
which included commits to RCS files with non-trunk default branches.


# 1558 26-May-1994 rgrimes

BSD 4.4 Lite sbin Sources

Note: XNSrouted and routed NOT imported here, they shall be imported with
usr.sbin.