aboutsummaryrefslogtreecommitdiff
path: root/sbin/dumpfs
Commit message (Collapse)AuthorAgeFilesLines
* Print the fs last-mounted time too.Chuck Silvers2020-05-021-3/+5
| | | | | | | | | Reviewed by: mckusick Approved by: mckusick (mentor) Sponsored by: Netflix Notes: svn path=/head/; revision=360559
* The goal of this change is to prevent accidental foot shooting byKirk McKusick2018-02-081-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | folks running filesystems created on check-hash enabled kernels (which I will call "new") on a non-check-hash enabled kernels (which I will call "old). The idea here is to detect when a filesystem is run on an old kernel and flag the filesystem so that when it gets moved back to a new kernel, it will not start getting a slew of check-hash errors. Back when the UFS version 2 filesystem was created, it added a file flag FS_INDEXDIRS that was to be set on any filesystem that kept some sort of on-disk indexing for directories. The idea was precisely to solve the issue we have today. Specifically that a newer kernel that supported indexing would be able to tell that the filesystem had been run on an older non-indexing kernel and that the indexes should not be used until they had been rebuilt. Since we have never implemented on-disk directory indicies, the FS_INDEXDIRS flag is cleared every time any UFS version 2 filesystem ever created is mounted for writing. This commit repurposes the FS_INDEXDIRS flag as the FS_METACKHASH flag. Thus, the FS_METACKHASH is definitively known to have always been cleared. The FS_INDEXDIRS flag has been moved to a new block of flags that will always be cleared starting with this commit (until they get used to implement some future feature which needs to detect that the filesystem was mounted on a kernel that predates the new feature). If a filesystem with check-hashes enabled is mounted on an old kernel the FS_METACKHASH flag is cleared. When that filesystem is mounted on a new kernel it will see that the FS_METACKHASH has been cleared and clears all of the fs_metackhash flags. To get them re-enabled the user must run fsck (in interactive mode without the -y flag) which will ask for each supported check hash whether it should be rebuilt and enabled. When fsck is run in its default preen mode, it will just ignore the check hashes so they will remain disabled. The kernel has always disabled any check hash functions that it does not support, so as more types of check hashes are added, we will get a non-surprising result. Specifically if filesystems get moved to kernels supporting fewer of the check hashes, those that are not supported will be disabled. If the filesystem is moved back to a kernel with more of the check-hashes available and fsck is run interactively to rebuild them, then their checking will resume. Otherwise just the smaller subset will be checked. A side effect of this commit is that filesystems running with cylinder-group check hashes will stop having them checked until fsck is run to re-enable them (since none of them currently have the FS_METACKHASH flag set). So, if you want check hashes enabled on your filesystems after booting a kernel with these changes, you need to run fsck to enable them. Any newly created filesystems will have check hashes enabled. If in doubt as to whether you have check hashes emabled, run dumpfs and look at the list of enabled flags at the end of the superblock details. Notes: svn path=/head/; revision=329051
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Continuing efforts to provide hardening of FFS, this change adds aKirk McKusick2017-09-221-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | check hash to cylinder groups. If a check hash fails when a cylinder group is read, no further allocations are attempted in that cylinder group until it has been fixed by fsck. This avoids a class of filesystem panics related to corrupted cylinder group maps. The hash is done using crc32c. Check hases are added only to UFS2 and not to UFS1 as UFS1 is primarily used in embedded systems with small memories and low-powered processors which need as light-weight a filesystem as possible. Specifics of the changes: sys/sys/buf.h: Add BX_FSPRIV to reserve a set of eight b_xflags that may be used by individual filesystems for their own purpose. Their specific definitions are found in the header files for each filesystem that uses them. Also add fields to struct buf as noted below. sys/kern/vfs_bio.c: It is only necessary to compute a check hash for a cylinder group when it is actually read from disk. When calling bread, you do not know whether the buffer was found in the cache or read. So a new flag (GB_CKHASH) and a pointer to a function to perform the hash has been added to breadn_flags to say that the function should be called to calculate a hash if the data has been read. The check hash is placed in b_ckhash and the B_CKHASH flag is set to indicate that a read was done and a check hash calculated. Though a rather elaborate mechanism, it should also work for check hashing other metadata in the future. A kernel internal API change was to change breada into a static fucntion and add flags and a function pointer to a check-hash function. sys/ufs/ffs/fs.h: Add flags for types of check hashes; stored in a new word in the superblock. Define corresponding BX_ flags for the different types of check hashes. Add a check hash word in the cylinder group. sys/ufs/ffs/ffs_alloc.c: In ffs_getcg do the dance with breadn_flags to get a check hash and if one is provided, check it. sys/ufs/ffs/ffs_vfsops.c: Copy across the BX_FFSTYPES flags in background writes. Update the check hash when writing out buffers that need them. sys/ufs/ffs/ffs_snapshot.c: Recompute check hash when updating snapshot cylinder groups. sys/libkern/crc32.c: lib/libufs/Makefile: lib/libufs/libufs.h: lib/libufs/cgroup.c: Include libkern/crc32.c in libufs and use it to compute check hashes when updating cylinder groups. Four utilities are affected: sbin/newfs/mkfs.c: Add the check hashes when building the cylinder groups. sbin/fsck_ffs/fsck.h: sbin/fsck_ffs/fsutil.c: Verify and update check hashes when checking and writing cylinder groups. sbin/fsck_ffs/pass5.c: Offer to add check hashes to existing filesystems. Precompute check hashes when rebuilding cylinder group (although this will be done when it is written in fsutil.c it is necessary to do it early before comparing with the old cylinder group) sbin/dumpfs/dumpfs.c Print out the new check hash flag(s) sbin/fsdb/Makefile: Needs to add libufs now used by pass5.c imported from fsck_ffs. Reviewed by: kib Tested by: Peter Holm (pho) Notes: svn path=/head/; revision=323923
* Renumber copyright clause 4Warner Losh2017-02-282-2/+2
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Use MIN macro from sys/param.h.Marcelo Araujo2016-05-021-2/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=298908
* Explicitly add more files to the 'runtime' package.Glen Barber2016-02-091-0/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295450
* The dumpfs(8) utility doesn't actually use disktab(5); remove itEdward Tomasz Napierala2015-09-031-1/+0
| | | | | | | | | | from "SEE ALSO". MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=287429
* It's 2015, and some people are still trying to use fdisk and thenEdward Tomasz Napierala2015-09-021-1/+1
| | | | | | | | | | | | | | | | go asking what debug flags to set for GEOM to make it work. Advice them to use gpart(8) instead. Something similar should probably done with disklabel, but I need to rewrite the disklabel examples first. Reviewed by: wblock@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3315 Notes: svn path=/head/; revision=287396
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+19
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-271-2/+1
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=283595
| * | Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * | Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * | Merge from headSimon J. Gerraty2013-09-052-6/+30
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=255263
| * \ \ sync from headSimon J. Gerraty2013-04-121-2/+2
| |\ \ \ | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=249429
| * | | | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | | | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | | | Sync from headSimon J. Gerraty2012-11-041-2/+5
| |\ \ \ \ | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=242545
| * | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | | | Print leading zeroes of UFS2 fs_id like we do for UFS1.Andrey V. Elsukov2015-05-261-1/+1
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR: 156908 MFC after: 1 week Notes: svn path=/head/; revision=283577
* | | | | Convert sbin/ to LIBADDBaptiste Daroussin2014-11-251-2/+1
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | Reduce overlinking Notes: svn path=/head/; revision=275030
* | | | When running the -m option to generate a newfs(8) command suitable forKirk McKusick2013-05-162-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | recreating the filesystem, check for and output the -i, -k, and -l options if appropriate. Note the remaining deficiencies of the -m option in the dumpfs(8) manual page. Specifically that newfs(8) options -E, -R, -S, and -T options are not handled and that -p is not useful so is omitted. Also document that newfs(8) options -n and -r are neither checked for nor output but should be. The -r flag is needed if the filesystem uses gjournal(8). PR: bin/163992 Reported by: Dieter <freebsd@sopwith.solgatos.com> Submitted by: Andy Kosela <akosela@andykosela.com> MFC after: 1 week Notes: svn path=/head/; revision=250710
* | | | Clean up trailing whitespace.Kirk McKusick2013-05-161-3/+3
| |_|/ |/| | | | | | | | | | | | | | | | | | | | Submitted by: Andy Kosela MFC after: 1 week Notes: svn path=/head/; revision=250708
* | | The purpose of this change to the FFS layout policy is to reduce theKirk McKusick2013-03-221-2/+2
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | running time for a full fsck. It also reduces the random access time for large files and speeds the traversal time for directory tree walks. The key idea is to reserve a small area in each cylinder group immediately following the inode blocks for the use of metadata, specifically indirect blocks and directory contents. The new policy is to preferentially place metadata in the metadata area and everything else in the blocks that follow the metadata area. The size of this area can be set when creating a filesystem using newfs(8) or changed in an existing filesystem using tunefs(8). Both utilities use the `-k held-for-metadata-blocks' option to specify the amount of space to be held for metadata blocks in each cylinder group. By default, newfs(8) sets this area to half of minfree (typically 4% of the data area). This work was inspired by a paper presented at Usenix's FAST '13: www.usenix.org/conference/fast13/ffsck-fast-file-system-checker Details of this implementation appears in the April 2013 of ;login: www.usenix.org/publications/login/april-2013-volume-38-number-2. A copy of the April 2013 ;login: paper can also be downloaded from: www.mckusick.com/publications/faster_fsck.pdf. Reviewed by: kib Tested by: Peter Holm MFC after: 4 weeks Notes: svn path=/head/; revision=248623
* | Fix problem with geom_label(4) not recognizing UFS labels on filesystemsEdward Tomasz Napierala2012-10-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | extended using growfs(8). The problem here is that geom_label checks if the filesystem size recorded in UFS superblock is equal to the provider (i.e. device) size. This check cannot be removed due to backward compatibility. On the other hand, in most cases growfs(8) cannot set fs_size in the superblock to match the provider size, because, differently from newfs(8), it cannot recompute cylinder group sizes. To fix this problem, add another superblock field, fs_providersize, used only for this purpose. The geom_label(4) will attach if either fs_size (filesystem created with newfs(8)) or fs_providersize (filesystem expanded using growfs(8)) matches the device size. PR: kern/165962 Reviewed by: mckusick Sponsored by: FreeBSD Foundation Notes: svn path=/head/; revision=242379
* | Add support for gjournal to dumpfsEitan Adler2012-10-221-0/+2
|/ | | | | | | | | | PR: 165821 Submitted by: Andreas Longwitz <longwitz@incore.de> Approved by: cperciva MFC after: 3 days Notes: svn path=/head/; revision=241842
* Add missing -l flag to usage().Christian Brueffer2011-12-261-1/+1
| | | | | | | | | PR: 163629 Submitted by: olgeni MFC after: 1 week Notes: svn path=/head/; revision=228898
* Staticify dumpfs.Ed Schouten2011-12-131-20/+20
| | | | | | | | | This tool only consists of a single C file, so we can simply mark everything except main() static. This seems to shave off about 8% of the binary size. Notes: svn path=/head/; revision=228458
* Add missing static keywords for global variables to tools in sbin/.Ed Schouten2011-11-041-1/+1
| | | | | | | | | These tools declare global variables without using the static keyword, even though their use is limited to a single C-file, or without placing an extern declaration of them in the proper header file. Notes: svn path=/head/; revision=227081
* Use _PATH_DEV and make the format more consistent with GEOM_LABEL.Xin LI2011-07-141-1/+2
| | | | | | | Submitted by: ivoras Notes: svn path=/head/; revision=224025
* Add a -l option to show file system's corresponding /dev/ufsid path.Xin LI2011-07-142-5/+26
| | | | | | | | | | This is useful for scripts that converts existing system's fstab to use their /dev/ufsid devices. MFC after: 2 weeks Notes: svn path=/head/; revision=224004
* We now have multiple filesystems (UFS, ZFS, ...), so for tools that onlyGavin Atkinson2011-05-081-3/+3
| | | | | | | | | | | operate on one type of filesystem, mention this. While here, capitalise the use of "UFS" in growfs.8 to match other uses of the term in other man pages. MFC after: 1 week Notes: svn path=/head/; revision=221659
* Add support for displaying newfs flags for SU+J and TRIM.Juli Mallett2011-03-231-1/+5
| | | | Notes: svn path=/head/; revision=219899
* Add support for FS_TRIM to user-mode UFS utilities.Konstantin Belousov2010-12-291-1/+3
| | | | | | | | | Reviewed by: mckusick, pjd, pho Tested by: pho MFC after: 1 month Notes: svn path=/head/; revision=216798
* - Merge soft-updates journaling from projects/suj/head into head. ThisJeff Roberson2010-04-241-2/+2
| | | | | | | | | | | brings in support for an optional intent log which eliminates the need for background fsck on unclean shutdown. Sponsored by: iXsystems, Yahoo!, and Juniper. With help from: McKusick and Peter Holm Notes: svn path=/head/; revision=207141
* Print leading zeros in the UFS2 FSID.Gavin Atkinson2010-01-061-1/+1
| | | | | | | | | | PR: bin/142155 Submitted by: Efstratios Karatzas gpf.kira gmail.com Approved by: ed (mentor) MFC after: 2 weeks Notes: svn path=/head/; revision=201647
* Implement NFSv4 ACL support for UFS.Edward Tomasz Napierala2009-12-211-1/+4
| | | | | | | Reviewed by: rwatson Notes: svn path=/head/; revision=200796
* Switch the default WARNS level for sbin/ to 6.Ruslan Ermilov2009-10-191-0/+1
| | | | | | | Submitted by: Ulrich Spörlein Notes: svn path=/head/; revision=198236
* Properly re-create "-s size" argument to newfs(8).Ruslan Ermilov2009-10-191-1/+1
| | | | Notes: svn path=/head/; revision=198231
* Print disk offets as %jd rather than %lld; I fixed one before committingRobert Watson2009-01-281-1/+1
| | | | | | | | | | but missed the other, which breaks 64-bit builds. Reported by: bf <bf2006a at yahoo dot com> MFC after: 1 week Notes: svn path=/head/; revision=187820
* Bump doc date for recent change.Tom Rhodes2009-01-281-1/+1
| | | | Notes: svn path=/head/; revision=187818
* Add a new flag to dumpfs(8), -f, which causes dumpfs to list all freeRobert Watson2009-01-282-7/+82
| | | | | | | | | | | | | | | | | | | | | | fragments in the file system by fragment (block) number. This new mode does the necessary arithmetic to generate absolute fragment numbers rather than than the cg-relative numbers printed in the default mode. If -f is passed once, contiguous fragment ranges are collapsed into an X-Y format as free block lists are currently printed in regular dumpfs output, but if specified twice, all block numbers are printed individually, allowing both compact and more script-friendly representation. This proves quite handy when attempting to recover deleted data, as it allows exclusion of non-deleted data from blocks searched. MFC after: 1 week Discussed with: jeff, Richard Clayton <richard dot clayton at cl.cam.ac.uk> Sponsored by: Google, Inc. Notes: svn path=/head/; revision=187814
* Replace incomprehensive description of -m by much clearer text from OpenBSD,Pav Lucistnik2007-05-121-2/+3
| | | | | | | | | | | | with the exception of one word. PR: docs/112465 Submitted by: naddy Obtained from: OpenBSD MFC after: 1 week Notes: svn path=/head/; revision=169511
* Teach about new fields (cg_unrefs and fs_unrefs) and new FS_GJOURNAL flag.Pawel Jakub Dawidek2006-10-311-5/+9
| | | | | | | Sponsored by: home.pl Notes: svn path=/head/; revision=163844
* Sync program's usage() with manpage's SYNOPSIS.Ruslan Ermilov2005-02-101-1/+1
| | | | Notes: svn path=/head/; revision=141611
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-1/+2
| | | | Notes: svn path=/head/; revision=131488
* Remove advertising clause from University of California Regent's license,Mark Murray2004-04-092-8/+0
| | | | | | | | | per letter dated July 22, 1999. Approved by: core, imp Notes: svn path=/head/; revision=128073
* Reinstate 1.40 -- swap avgfilesize and avgfpdir column order.Don Lewis2003-12-071-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=123219