summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/main.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r260068, r260069, r260076scottl2014-01-021-4/+31
| | | | | | | | | | | | | | | | | | | | | | Add the -R option to allow fsck_ffs to restart itself when too many critical errors have been detected in a particular run. Clean up the global state variables so that a restart can happen correctly. Separate the global variables in fsck_ffs and fsdb to their own file. This fixes header sharing with fscd. Correctly initialize, static-ize, and remove global variables as needed in dir.c. This fixes a problem with lost+found directories that was causing a segfault. Correctly initialize, static-ize, and remove global variables as needed in suj.c. Initialize the suj globals before allocating the disk object, not after. Also ensure that 'preen' mode doesn't conflict with 'restart' mode Obtained from: Netflix
* Add a 'surrender' mode to fsck_ffs. With the -S flag, once hard read errorsscottl2013-07-301-1/+5
| | | | | | | | are encountered, the fsck will stop instead of wasting time chewing through possibly other errors. Obtained from: Netflix MFC after: 3 days
* Add a -Z option which zeroes unused blocks. It can be combined with -E,des2013-04-291-1/+5
| | | | | | | in which case unused blocks are first zeroed and then erased. Reviewed by: mckusick MFC after: 3 weeks
* When running with the -d option, instrument fsck_ffs to track the number,mckusick2013-02-241-0/+8
| | | | | | data type, and running time of its I/O operations. No functional changes.
* Fix some nearby type and style errors.mdf2012-09-281-10/+9
| | | | Pointed out by: bde
* Fix fsck_ffs build with a 64-bit ino_t.mdf2012-09-271-1/+1
| | | | Original code by: Gleb Kurtsou
* Simply printf-like strings and outdent strings so that it is easy to seeobrien2012-09-121-20/+18
| | | | if they fit on a standard terminal.
* Forgot this nit in r221107.des2011-09-031-1/+1
| | | | Approved by: re (kib)
* Add an -E option to mirror newfs's. The idea is that if you have a systemdes2011-04-291-2/+6
| | | | | | | | | | | | | | | | | | | that was built before ffs grew support for TRIM, your filesystem will have plenty of free blocks that the flash chip doesn't know are free, so it can't take advantage of them for wear leveling. Once you've upgraded your kernel, you enable TRIM on the filesystem (tunefs -t enable), then run fsck_ffs -E on it before mounting it. I tested this patch by half-filling an mdconfig'ed filesystem image, running fsck_ffs -E on it, then verifying that the contents were not damaged by comparing them to a pristine copy using rsync's checksum functionality. There is no reliable way to test it on real hardware. Many thanks to mckusick@, who provided the tricky parts of this patch and reviewed the final version. Reviewed by: mckusick@ MFC after: 3 weeks
* Mechanical whitespace cleanup.des2011-04-271-7/+7
| | | | MFC after: 3 weeks
* The dump, fsck_ffs, fsdb, fsirand, newfs, makefs, and quot utilitiesmckusick2011-01-241-2/+2
| | | | | | | | | | | | | | 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
* One question mark per question; everything else is just exaggerating.bz2010-08-031-1/+1
| | | | | reply() will output a '?', when printing the question along with [yn], so no need to have another here.
* Improve fsck robustness for SU+J cases:delphij2010-06-221-8/+10
| | | | | | | | | | - Use err/errx only when the case is really fatal. For other cases, fall back to full fsck instead of quiting fsck. - Plug a memory leak. - Avoid divide by zero when printing summary. - Output "FILE SYSTEM IS MARKED CLEAN" when a successful journal recovering is done. - When -f is specified, do full fsck instead of journal recovery.
* - Merge soft-updates journaling from projects/suj/head into head. Thisjeff2010-04-241-3/+24
| | | | | | | | 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
* Add some error messages suggested in PR bin/138043. The code tomckusick2010-01-071-1/+4
| | | | | | | correct the problem was added in r176575 by delphij on 2008-02-25. PR: 138043 Reported by: Heikki Suonsivu
* Update the actions previously attempted by the -D option to make themmckusick2009-02-041-7/+7
| | | | | | | | | | | | | | | | | | robust. With these changes fsck is now able to detect and reliably rebuild corrupted cylinder group maps. The -D option is no longer necessary as it has been replaced by a prompt asking whether the corrupted cylinder group should be rebuilt and doing so when requested. These actions are only offered and taken when running fsck in manual mode. Corrupted cylinder groups found during preen mode cause the fsck to fail. Add the -r option to free up excess unused inodes. Decreasing the number of preallocated inodes reduces the running time of future runs of fsck and frees up space that can allocated to files. The -r option is ignored when running in preen mode. Reviewed by: Xin LI <delphij@> Sponsored by: Rsync.net
* Add the '-C' "check clean" flag. If the FS is marked clean, skip fileobrien2009-01-301-5/+9
| | | | | | | | system checking. However, if the file system is not clean, perform a full fsck. Reviewed by: delphij Obtained from: Juniper Networks
* Rename option 'C' to 'D' (damaged) in order to avoid a conflict with upcomingdelphij2009-01-201-4/+4
| | | | | | | Juniper 'C' (clean) flag. Requested by: obrien MFC after: 1 week
* Garbage collect 'fflags'.obrien2008-12-241-6/+2
|
* Instead of passing MNT_UPDATE, MNT_SNAPSHOT, MNT_RELOAD fromrodrigc2008-08-231-2/+3
| | | | | | | | userspace to kernel via nmount(), pass in the strings "update", "snapshot", "reload". We want to move away from passing MNT_ flags from userspace -> kernel via nmount(), and instead favor passing the string options.
* - Display '-C' option in usage().stas2008-06-081-1/+1
| | | | Approved by: kib
* Add a new flag, '-C' which enables a special mode that is intended fordelphij2008-04-101-1/+6
| | | | | | | | | | catastrophic recovery. Currently, this mode only validates whether a cylindergroup has good signature data, and prompts the user to decide whether to clear it as a whole. This mode is useful when there is data damage on a disk and you are working on copy of the original disk, as fsck_ffs(8) tends to abnormally exit in such case, as a last resort to recover data from the disk.
* Add comment about specifying "ro" mount option whenrodrigc2008-04-041-0/+4
| | | | | | doing an update mount on a read-only file system. Requested by: yar
* For a mounted file system which is read-only, whenrodrigc2008-03-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | doing the MNT_RELOAD, pass in "ro" and "update" string mount options to nmount() instead of MNT_RDONLY and MNT_UPDATE flags. Due to the complexity of the mount parsing code especially with respect to the root file system, passing in MNT_RDONLY and MNT_UPDATE flags would do weird things and would cause fsck to convert the root file system from a read-only mount to read-write. To test: - boot into single user mode - show mounted file systems with: mount - root file system should be mounted read-only - fsck / - show mounted file systems with: mount - root file system should still be mounted read-only PR: 120319 MFC after: 1 month Reported by: yar
* Remove hacks to filter out MNT_ROOTFS, since we nowrodrigc2008-03-051-10/+0
| | | | do that internally inside nmount() in revision 1.267 of vfs_mount.c.
* Convert fsck_ffs to nmount(). This seems to solverodrigc2007-09-191-18/+51
| | | | | | | | an intermittent problem where MNT_RELOAD fails for the root file system. Reported and tested by: phk Approved by: re (bmah)
* Fix fscking gjournaled root file system: root file system is already mountedpjd2007-08-101-19/+36
| | | | | | | | | read-only, so we can't simply exit right after calling gjournal_check(), instead we need to ask about super block reload. Submitted by: Niki Denev <niki@totalterror.net> PR: misc/113889 Approved by: re (kensmith)
* Implements gjournal support. If file system has gjournal support enabledpjd2006-10-311-1/+24
| | | | | | | | | | and -p flag was given perform fast file system checking (bascially only garbage collecting of orphaned objects). Rename bread() to blread() and bwrite() to blwrite() as we now link to the libufs library, which also implement functions with that names. Sponsored by: home.pl
* Sync program's usage() with manpage's SYNOPSIS.ru2005-02-101-1/+1
|
* Do not pass random bits as mount arguments.phk2004-12-121-0/+1
|
* Eliminate linked list used to track inodes with an initial linktruckman2004-10-081-8/+0
| | | | | | | | | count of zero and instead encode this information in the inode state. Pass 4 performed a linear search of this list for each inode in the file system, which performs poorly if the list is long. Reviewed by: sam & keramida (an earlier version of the patch), mckusick MFC after: 1 month
* Remove advertising clause from University of California Regent's license,markm2004-04-091-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core, imp
* In the case of a background fsck, periodically update the process titlescottl2004-02-281-0/+9
| | | | with a progress update.
* Create a .snap directory mode 770 group operator in the root of eachmckusick2003-10-081-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | filesystem that is checked in background. Create the snapshot in this directory rather than in the root. There are two benefits: 1) For terabyte-sized filesystems, the snapshot may require many minutes to build. Although the filesystem will not be suspended during most of the snapshot build, the snapshot file itself is locked during the entire snapshot build period. Thus, if it is accessed during the period that it is being built, the process trying to access it will block holding its containing directory locked. If the snapshot is in the root, the root will lock and the system will come to a halt until the snapshot finishes. By putting the snapshot in a subdirectory, it is out of the likely path of any process traversing through the root and hence much less likely to cause a lock race to the root. 2) The dump program is usually run by a non-root user running with operator group privilege. Such a user is typically not permitted to create files in the root of a filesystem. By having a directory in group operator with group write access available, such a user will be able to create a snapshot there. Having the dump program create its snapshot in a subdirectory below the root will benefit from point (1) as well. Sponsored by: DARPA & NAI Labs.
* Spell "file system" correctly.ru2003-08-011-1/+1
|
* Use __FBSDID() to quiet GCC 3.3 warnings.obrien2003-05-031-3/+2
|
* s/filesystem/file system/g as discussed on -developerstrhodes2002-08-211-9/+9
|
* Fix a bunch of format string warnings which brokemux2002-07-311-6/+9
| | | | | | the sparc64 build. Tested on: sparc64, i386
* Warning cleanup.phk2002-07-301-18/+18
| | | | Format changes by peter
* This commit adds basic support for the UFS2 filesystem. The UFS2mckusick2002-06-211-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* more file system > filesystemtrhodes2002-05-161-1/+1
|
* Usage style sweep: spell "usage" with a small 'u'.des2002-04-221-1/+1
| | | | | Also change one case of blatant __progname abuse (several more remain) This commit does not touch anything in src/{contrib,crypto,gnu}/.
* Replace __progname with the documented, more acceptable and functionally ↵markm2002-03-241-5/+4
| | | | identical getprogname(3).
* o __P removedimp2002-03-201-17/+9
| | | | | | | o ansi function prototypes o unifdef -D__STDC__ o __dead2 on usage prototype o remove now-bogus main prototype
* Fix a large number of -Wall, -Wformat and -W compiler warnings.iedowse2001-11-171-15/+12
| | | | | | | | | These were mainly missing casts or wrong format strings in printf statements, but there were also missing includes, unused variables, functions and arguments. The choice of `long' vs `int' still seems almost random in a lot of places though.
* Update usage message with new options.mckusick2001-04-301-1/+1
| | | | Submitted by: Ruslan Ermilov <ru@FreeBSD.org>
* Add support for the -F flag which determines whether a specifiedmckusick2001-04-241-18/+58
| | | | | | | | | | | | filesystem needs foreground checking (usually at boot time) or can defer to background checking (after the system is up and running). See the manual page, fsck_ffs(8), for details on the -F and -B options. These options are primarily intended for use by the fsck front end. All output is directed to stdout so that the output is coherent when redirected to a file or a pipe. Unify the code with the fsck front end that allows either a device or a mount point to be specified as the argument to be checked.
* Minor background cleanups:mckusick2001-04-161-5/+29
| | | | | | | | | | | 1) Set the FS_NEEDSFSCK flag when unexpected problems are encountered. 2) Clear the FS_NEEDSFSCK flag after a successful foreground cleanup. 3) Refuse to run in background when the FS_NEEDSFSCK flag is set. 4) Avoid taking and removing a snapshot when the filesystem is already clean. 5) Properly implement the force cleaning (-f) flag when in preen mode. Note that you need to have revision 1.21 (date: 2001/04/14 05:26:28) of fs.h installed in <ufs/ffs/fs.h> defining FS_NEEDSFSCK for this to compile.
* Additions to run checks on live filesystems. This change will notmckusick2001-03-211-25/+69
| | | | | | | | | affect current systems until fsck is modified to use these new facilities. To try out this change, set the fsck passno to zero in /etc/fstab to cause the filesystem to be mounted without running fsck, then run `fsck_ffs -p -B <filesystem>' after the system has been brought up multiuser to run a background cleanup on <filesystem>. Note that the <filesystem> in question must have soft updates enabled.
* Add a simple SIGINFO handler to fsck_ffs. Shortly after receipt ofiedowse2000-12-151-0/+1
| | | | | | | | a SIGINFO (normally via Ctrl-T), a line will be output indicating the current phase number and progress information relevant to the current phase. Approved by: mckusick
OpenPOWER on IntegriCloud