Commit Graph

76 Commits

Author SHA1 Message Date
riz 0b1ff958b5 As currently written, writeat() expects disk blocks, not fs blocks, so
when testing that the last sector of the new size is writeable, make
sure we're ACTUALLY writing in the new space, instead of possibly
overwriting something in the existing fs.

Discovered while writing tests - tests which uncovered file corruption at
certain block sizes.

XXX should rewrite writeat() to expect fs blocks instead of disk blocks.

OK mlelstv@
2010-12-07 23:29:55 +00:00
riz 3485b1dad5 Turns out, plain-file usage is already supported. *blush* 2010-12-03 05:23:34 +00:00
riz 4c7e04789a Knock one off the list. 2010-12-02 22:04:01 +00:00
riz 9f2c8ccc2b Use howmany() instead of "/" to calculate the number of cylinders for
the changed file system, so as to not drop a partial cylinder at the
end.  Fixes PR bin/44177.
2010-12-02 22:00:27 +00:00
riz 6ad0ad89d6 Update TODO for resize_ffs(8), adding some stuff and removing some
ancient bits.
2010-12-01 17:39:54 +00:00
riz 6efa15a79a Do not look for a v1 file system at SBLOCK_UFS2, as this gets the wrong
superblock (first alternate) for a file system with 64k blocks.
Spotted by mhitch@.
2010-12-01 17:39:21 +00:00
riz 18174be827 Clean up this file:
- sync usage comment with current reality
- sort includes
- wrap lines
- use EXIT_FAILURE consistently
- make error messages consistent:  Cannot->Can't
- Remove "Old FFSv1 macros" in favor of system macros in ufs/ffs/fs.h .
  Leave dblksize() because it uses the on-disk dinode structure.

More cleanup is needed.
No functional changes intended.
2010-12-01 17:33:45 +00:00
riz 6f8b62aac7 Restore a couple of checks for updating the cg_old_ncyl value which
were commented out with XXX and a notation to "fix once fsck is fixed."
fsck seems to have been fixed for this particular issue sometime in the
7 years since the code was brought into the tree.

Update cg_old_niblk instead of cg_ni_blk, since this tool
currently supports ffsv1 only.

With these two changes, I can grow a file system and have the result
be clean according to fsck_ffs.  Shrinking still results in an unclean
file system.

OK mhitch@

While I'm here, fix a typo in an error message.
2010-11-29 19:54:10 +00:00
wiz 4958aa2ca5 Various improvements. 2010-10-31 11:39:46 +00:00
haad 1e89108160 Add resize_ffs tool to build, change default behaviour to grow filesystem
to device size. Add parameter -s to specify size if user want to shrink
filesystem.

Apply some KNF, remove dead unused code.

Oked by christos@.
2010-10-30 21:16:07 +00:00
lukem 10a1256f76 set WARNS=3 -- too many -Wsign-compare issues in the kernel ffs code 2009-04-26 05:57:48 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
perry 36c7456d7c include sys/cdefs.h so that __attribute__ can be fixed later 2007-12-15 16:32:05 +00:00
bouyer a59a9ef8db writeat() also expect offsets in DEV_BSIZE unit. This and the previous commit
should fix PR bin/35560. Thanks to Michael L. Hitch for pointing me at the
PR.
2007-07-08 16:54:40 +00:00
bouyer 2d9d4664a8 readat() expects the offset in DEV_BSIZE units. This made resize_ffs find the
filesystem on a vnd partition for me. It did grow the filesystem, and after
a fsck -f on the partition to fix a few superblock inconsistencies, all
looks good.
2007-07-05 21:38:20 +00:00
snj d3df836a71 Fix a typo in a comment. 2005-06-03 03:34:44 +00:00
dsl 05f998d8c6 Dunno why this code is playing 'hunt the superblock', but stop it
finding an ffsv1 sb at 64k.
Also stop it playing with fs that have 'FS_FLAGS_UPDATED' set.
It certainly doesn't act on that falg, and my guess is that it is
playing the pre-ffsv2 fs.
Fixes part of PR kern/24809
2004-03-21 21:02:01 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
salo b75abedac4 netbsd.org->NetBSD.org 2003-07-26 19:38:45 +00:00
christos 628c00a0ec make this compile again. 2003-04-03 14:55:16 +00:00
wiz 84cb70148f Correct program name in comments. 2003-03-10 09:23:50 +00:00
wiz d686d8626e Sort sections; "file system" instead of filesystem; mdoc improvements;
new sentenence, new line.
2003-03-10 09:23:23 +00:00
lukem 6ddd712ab0 (cross)builds on current ok 2003-02-23 00:27:51 +00:00
lukem 82aaf00052 minor cosmetic tweak 2003-02-23 00:26:02 +00:00
martin 416cebb2dc This program deals with on-disk structures.
s/daddr_t/int32_t/g for now (UFS2 will need other changes as well).
2003-02-21 23:55:38 +00:00
jtk ec57cc7eb3 Preliminary version of resize_ffs, based on der Mouse's fsresize tool.
I didn't have time to clean it up completely before my legal status
w.r.t. open source projects goes into limbo for a while.  Other
developers are encouraged to play with the tool and get it into
release-worthy shape.

TODO list (see TODO file)

* verify it builds on -current, put it into release lists/etc. and src/sbin/Makefile
  (built & tested on 1.6.1)
* make it ask questions before doing any work (confirm)
* create regression test suite (see discussions on tech-kern and
  developers) and fix any bugs
* verify conversion to ANSI C didn't break anything
* port to UFS2
2003-02-21 04:08:54 +00:00