Commit Graph

149 Commits

Author SHA1 Message Date
Kirk McKusick
a73665b028 Fix nits pointed out in PR bin/39905 that have not already been
corrected since it was filed. With this change the PR will be closed.

PR:     bin/39905
2008-05-23 19:17:08 +00:00
Kirk McKusick
4e5867d27e This fixes the "getfile: lost data" panic when restoring dumps
on a 7.0 or later system that were created on a pre-5.0 system.
We must ensure that restore zeros out the previously undefined
birthtime and external attribute size fields when reading dump
tapes made by the UFS1 dump program.

The problem is that UFS2 dump carefully zeros out the unused
birthtime and external attribute size fields in the dump header
when dumping UFS1 filesystems, but the UFS1 dump didn't know about
those fields (they were spares) so just left whatever random junk
was in them. So, when restoring one of these pre-UFS2 dumps,
the new restore would eventually trip across a header that had
a non-zero external attribute size and try to extract it. That
consumed several tape blocks which left it totally out of sync
and very unhappy (i.e., the panic). The fix is in the gethead()
function which modernizes old headers by copying old fields to
their new location (and with this fix) zeroing out previously
undefined fields.

PR:		bin/120881
Review by:	David Malone & Scott Lambert
MFC after:	1 week
2008-05-22 22:19:33 +00:00
Kirk McKusick
67dafe43c1 Follow on to fix 1.51 for "Header with wrong dumpdate" message.
Must ensure that dump tapes from UFS1 filesystems properly copy
old fields of dump headers to new locations. Move check of dumpdate
to follow the code which ensures that the appropriate fields have
been copied.

PR:		bin/118087
Help from:	David Malone, Scott Lambert, Javier Martín Rueda
MFC after:	2 weeks
2008-05-22 22:18:38 +00:00
Kirk McKusick
aed3576d26 restore(8) does not check for write failure while building two temp
files containing directory and ownership data. If /tmp fills, the
console is blasted with zillions of "file system full" errors, and
restore continues on, even though directory and/or ownership data
has been lost. This is particularly likely to happen when running
from the live CD, which has little /tmp space.

PR:         bin/93603, also probably bin/107213
Fix from:   Ken Lalonde
2008-04-14 20:15:53 +00:00
Kirk McKusick
cfbb5cdd50 Avoid printing spurious ``Header with wrong dumpdate.'' message. 2008-04-11 21:51:53 +00:00
Kirk McKusick
c028393d70 Correctly set file group when restore is run by a user other than root. 2008-04-11 21:48:14 +00:00
Warner Losh
52b370fe8e Use safer string handling.
Reviewed by: security-team
2008-04-03 20:37:38 +00:00
Kirk McKusick
a9093e846d Move macros describing extended attributes in UFS from
<sys/extattr.h> to <ufs/ufs/extattr.h>. Move description
of extended attributes in UFS from man9/extattr.9 to
man5/fs.5.

Note that restore will not compile until <sys/extattr.h>
and <ufs/ufs/extattr.h> have been updated.

Suggested by:	Robert Watson
2007-03-06 08:13:21 +00:00
Kirk McKusick
772ad651bf Update the dump program to save extended attributes. Update
the restore program to restore all dumped extended attributes.

If the restore is running as root, it will always be able
to restore all extended attributes. If it is not running
as root, it makes a best effort to set them. Using the -v
command line flag or the `verbose' command in interactive
mode will display all the extended attributes being set on
files (and at the end on directories) that are being restored.
It will note any extended attributes that could not be set.

The extended attributes are placed on the dump image immediately
following each file's data. Older versions of restore can work
with the newer dump images. Old versions of restore will
correctly restore the file data and then (silently) skip
over the extended attribute data and proceed to the next file.

This resolves PR 93085 which will be closed once the code
has been MFC'ed.

Note that this code will not compile until these header
files have been updated: <protocols/dumprestore.h> and
<sys/extattr.h>.

PR:		bin/93085
Comments from:	Poul-Henning Kamp and Robert Watson
MFC after:	3 weeks
2007-02-26 08:15:56 +00:00
David Malone
cbc8bb98ef Add a "-D" flag to restore which puts it into "degraded" mode. This
makes restore less efficient, but it makes a bigger effore to read
corrupted dumps. Specifiacally, when in degreded mode:

	1) Restore shifts the input by 1 byte if it sees a problem,
	rather than one tape block.
	2) It doesn't assume the inodes are stored in ascending order.
	3) It turns some panics into warning printfs.

We also verify some fields more carefully than before.

There's probably more a degreded mode could do, but this seems to
help a lot.

Approved by:	imp, iedowse, mckusick
MFC after:	3 weeks
2006-12-05 11:18:51 +00:00
Ruslan Ermilov
325301a75b Mention the -L option of dump(8) that can neutralize negative
effects of restoring dumps of live file systems.

PR:		docs/91297
2006-10-12 14:47:20 +00:00
Maxim Konovalov
0e6d65d1fd o Fix style(9) for previous. 2006-08-25 09:14:23 +00:00
Maxim Konovalov
ac5cc9e9bc A bunch of fixes from NetBSD:
o Restore owner/group/mode/atime/mtime of symbolic links, rev. 1.30.
o Extract file flags of symbolic link, rev. 1.42.
o Call getfile() before altering file attributes.
  Open file with mode 0600 instead of 0666 so that file won't remain
  group or world readable/writable even if getfile() terminated.
  Move skipfile() before altering file attributes in IF{CHR,BLK} and
  IFIFO case for symmetry, rev. 1.32.
o Use file mode 0600 when creating special file or fifo, revs. 1.33, 1.34.

o Remove redundant -N check.

PR:		bin/101660
Submitted by:	Andrey V. Elsukov
Obtained from:	NetBSD, enami@netbsd
MFC after:	6 weeks
2006-08-25 05:46:47 +00:00
Diomidis Spinellis
aa590d16d0 Remove a diagnostic message that can't occur: we lost the ability to
handle the old filesystem format on 2002/06/21.
2005-10-20 11:20:55 +00:00
Diomidis Spinellis
153fdc98cf Interpret correctly the glob(3) return value.
Previously, interactive commands specifying a non-existent file or
directory used to display an "out of memory error".

MFC after:	2 weeks
2005-07-21 16:12:35 +00:00
Philippe Charnier
35a974fdb8 rscid -> __FBSDID. Mark parameter as __unused when necessary. 2005-05-29 15:57:00 +00:00
Warner Losh
371c9f9384 Remove debug from last commit 2005-04-03 16:35:58 +00:00
Warner Losh
64a96794b7 /*- 2005-04-03 05:18:28 +00:00
Warner Losh
aad0ac34fe Revert bogus += -g change. I needed it to debug the problem.
Noticed by: njl, Andrej Tobola
2005-03-25 17:30:20 +00:00
Warner Losh
66b4217151 Restore the ability to read FreeBSD 1 tapes (and I think any net2
based tapes, but I'm not sure where NFS_MAGIC was introduced after
4.3).  When support for the pre-4.4 format was removed (the ability to
read 4.2 and 4.3 BSD tapes), the old format inode conversion was
junked as well.  However, FreeBSD 1 dump tapes use the NFS_MAGIC
format, but have this inode format.  Before, restore would fail
complaining that '.' wasn't found and the root directory wasn't on
this tape.  Since the conversion from the not so old format is
relatively trivial, restore the code to make that conversion.

FreeBSD 1 dumps are once again readable.

MFC After: a few days
2005-03-25 07:35:59 +00:00
Warner Losh
a2c0855654 dcvt is unused since the support for converting pre-4.4 tapes was
removed.  Go ahead and remove it and struct odirent since it too is
unused.

# FreeBSD 1.1.5 tapes are still unreadable, but 2.0 and newer work.
2005-03-25 06:57:50 +00:00
Warner Losh
84c248f850 c_tapea and c_firstrec are used for TS_TAPE blocks, so convert them
for the old (4.4-lite through FreeBSD 4.x and *BSD) format.  It looks
like they aren't used for TS_INODE, but conversion costs so little
there that I've not removed them there (in case my grep was wrong).

This makes at least some of the tapes work for me again.  Now, to
regresion test all my dusty tapes...
2005-03-25 06:03:11 +00:00
Warner Losh
372e256ad0 In order to print out the dump dates correctly, the date and ddate fields
also need to be convereted for old tapes for records of type TAPE.
2005-03-18 21:06:54 +00:00
Warner Losh
ecdd99f852 Sync usage and man page with reality. There's no '-c' command line
flag today.  Maybe we should still retain it, but I'll let others fight
that windmill.
2005-03-18 17:49:08 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
8d646af581 Sync program's usage() with manpage's SYNOPSIS. 2005-02-10 09:19:34 +00:00
Ruslan Ermilov
6087df9e8b Sort sections. 2005-01-18 10:09:38 +00:00
Ruslan Ermilov
9806e23132 Mechanically kill hard sentence breaks. 2004-07-02 21:45:06 +00:00
Stefan Farfeleder
1916772e6f Use the correct types for the functions rst_opendir(), glob_readdir() and
rst_closedir() which are called by glob().

Reviewed by:	md5
Approved by:	das (mentor)
2004-05-24 16:24:26 +00:00
Stefan Farfeleder
e54fb3f2dc Include <timeconv.h> for time conversion functions.
Approved by:	das (mentor)
2004-05-24 16:10:57 +00:00
Ruslan Ermilov
d04b5dfe6c Assorted markup, grammar, and spelling fixes. 2004-05-17 08:35:43 +00:00
Brian Feldman
c51d70c690 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
2004-04-13 02:58:06 +00:00
Mark Murray
4c723140a4 Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp
2004-04-09 19:58:40 +00:00
Johan Karlsson
604d24db95 style.Makefile(5):
Use WARNS?= instead of WARNS=.
2004-02-23 20:25:27 +00:00
Peter Wemm
30d38f7b0d Fix gcc warnings. If NAME_MAX is 255, and d_namlen is a uint8_t, then
d_namlen can never be > NAME_MAX.  Stop gcc worrying about this by
using a preprocessor test to see if NAME_MAX changes.
2003-10-26 04:43:02 +00:00
Andrey A. Chernov
0407880f4b Localize 'ls' output
Don't set 8bit in quote processing
2003-08-06 08:46:21 +00:00
Philippe Charnier
9680d7b695 Add section number to .Xr 2003-06-08 12:51:28 +00:00
Ruslan Ermilov
44b81f0f89 Removed all vestiges of KerberosIV. 2003-05-01 21:18:36 +00:00
Ruslan Ermilov
cbfe6d117c Style. 2003-05-01 21:10:37 +00:00
Mark Murray
8edde085dd De-Kerberise (KerberosIV). KerberosIV is no longer present, and
remote backups can still be done with Kerberos authentication using
SSH and Kerberos 5.
2003-05-01 20:09:58 +00:00
Sheldon Hearn
c359d71a85 Add TAPE to the ENVIRONMENT section.
MFC after:	1 month
2003-01-10 10:55:13 +00:00
Sheldon Hearn
d1d5a33b13 Add an ENVIRONMENT section so that the reader knows that the TMPDIR envar
is honoured.

Reported by:	des
MFC after:	1 month
2003-01-10 10:45:48 +00:00
Ruslan Ermilov
463cfa804d Fixed the abuses of .Ql visible on stderr in troff mode.
PR:		docs/37176
2002-12-23 16:04:51 +00:00
Mike Barcroft
89fdc4e117 Use the standardized CHAR_BIT constant instead of NBBY in userland. 2002-09-25 04:06:37 +00:00
Philippe Charnier
7fed38d0a0 Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:10:45 +00:00
Warner Losh
0b0fe61dfb Use '0' instead of NULL when we mean the integer constant 0 and not a
"null pointer expression".
2002-08-21 18:52:32 +00:00
Tom Rhodes
ce66ddb763 s/filesystem/file system/g as discussed on -developers 2002-08-21 18:11:48 +00:00
Kirk McKusick
fb36a3d847 Change utimes to set the file creation time (for filesystems that
support creation times such as UFS2) to the value of the
modification time if the value of the modification time is older
than the current creation time. See utimes(2) for further details.

Sponsored by:	DARPA & NAI Labs.
2002-07-17 02:03:19 +00:00
Philippe Charnier
629e80effb The .Nm utility. 2002-07-06 19:35:14 +00:00
Kirk McKusick
1c85e6a35d 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>
2002-06-21 06:18:05 +00:00