summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix boo-boo in previous commit.des2011-04-271-7/+7
| | | | MFC after: 3 weeks
* Alphabetize the options. No date bump since no actual change to the text.des2011-04-271-4/+4
| | | | MFC after: 3 weeks
* In checker, read journal by sectors.kib2011-02-123-12/+19
| | | | | | | | | | | Due to UFS insistence to pretend that device sector size is 512 bytes, sector size is obtained from ioctl(DIOCGSECTORSIZE) for real devices, and from the label otherwise. The file images without label have to be made with 512 sector size. In collaboration with: pho Reviewed by: jeff Tested by: bz, pho
* The dump, fsck_ffs, fsdb, fsirand, newfs, makefs, and quot utilitiesmckusick2011-01-243-5/+6
| | | | | | | | | | | | | | 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
* Move most of the remaining USD/PSD/SMM papers into share/docuqs2010-12-046-2367/+0
|
* Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki whilejoel2010-08-161-1/+1
| | | | | | translating these manual pages. Minor corrections by me. Submitted by: Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
* Fix typos and spelling mistakes.joel2010-08-061-1/+1
|
* 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.
* Note that foreground fsck should be run after a filesystem related panic.mckusick2010-07-231-0/+9
| | | | | Suggested by: Mikhail Teterin (mi@) MFC after: 1 week
* - Permit zero length directories as a handled inconsistency. This allowsjeff2010-07-061-46/+115
| | | | | | | | | directory truncation to proceed before the link has been cleared. This is accomplished by detecting a directory with no . or .. links and clearing the named directory entry in the parent. - Add a new function ino_remref() which handles the details of removing a reference to an inode as a result of a lost directory. There were some minor errors in various subcases of this routine.
* Improve fsck robustness for SU+J cases:delphij2010-06-222-60/+117
| | | | | | | | | | - 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.
* Add support to background fsck to delete zero-length directories.mckusick2010-05-202-1/+33
|
* suj.c seems to contain two versions of the code.pjd2010-04-241-2065/+0
| | | | Remove the one that doesn't compile.
* Protect fsck.h from being included twice.pjd2010-04-241-0/+5
|
* - Merge soft-updates journaling from projects/suj/head into head. Thisjeff2010-04-246-289/+4739
| | | | | | | | 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
* Cast 64-bit quantity to intptr_t rather than int so as to work properlymckusick2010-01-111-2/+2
| | | | | | with 64-bit architectures (such as amd64). Reported by: Xin LI and Josh Paetzel
* This update utilizes new fsck sysctl commands that allow fsck runningmckusick2010-01-111-7/+82
| | | | | | | | | | in background mode to correct expected inconsistencies that arise during directory rename (see immediately previous update to this file for details). If run on a kernel without the new functionality, background fsck will simply ignore these inconsistencies rather than fail. Reported by: jeff
* When renaming a directory it passes through several intermediatemckusick2010-01-111-21/+109
| | | | | | | | | | | | | | | | | | | | | | | | states. First its new name will be created causing it to have two names (from possibly different parents). Next, if it has different parents, its value of ".." will be changed from pointing to the old parent to pointing to the new parent. Concurrently, its old name will be removed bringing it back into a consistent state. When fsck encounters an extra name for a directory, it offers to remove the "extraneous hard link"; when it finds that the names have been changed but the update to ".." has not happened, it offers to rewrite ".." to point at the correct parent. Both of these changes were considered unexpected so would cause fsck in preen mode or fsck in background mode to fail with the need to run fsck manually to fix these problems. This update changes these errors to be expected so that in preen mode fsck will simply fix these transitional errors. For now, background fsck will note these errors, but will need additional kernel support to fix them, so will simply ignore them rather than fail. A future update will allow background fsck to fix these problems. Reported by: jeff
* Add some error messages suggested in PR bin/138043. The code tomckusick2010-01-072-3/+12
| | | | | | | correct the problem was added in r176575 by delphij on 2008-02-25. PR: 138043 Reported by: Heikki Suonsivu
* This corrects a bug that manifested itself as identifying the lastmckusick2010-01-071-1/+1
| | | | | | | | | | cylinder group of a UFS1 filesystem as bad. The error was in the check and not in the cylinder group itself. So even though fsck fixed the cylinder group correctly, it was still endlessly reported as bad. PR: 141992 MFC after: 2 weeks Reported by: Dan Strick
* (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.antoine2009-12-281-1/+1
| | | | | | | | | Fix some wrong usages. Note: this does not affect generated binaries as this argument is not used. PR: 137213 Submitted by: Eygene Ryabinkin (initial version) MFC after: 1 month
* Correct comment.pjd2009-06-031-1/+1
|
* - Use volatile for signal variables.lulf2009-06-021-2/+2
| | | | Suggested by: Jaakko Heinonen <jh -at- saunalahti.fi>
* - Use sig_atomic_t for signal handler variables.lulf2009-05-291-2/+2
| | | | MFC after: 1 week
* Update the actions previously attempted by the -D option to make themmckusick2009-02-046-76/+205
| | | | | | | | | | | | | | | | | | 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-304-11/+24
| | | | | | | | system checking. However, if the file system is not clean, perform a full fsck. Reviewed by: delphij Obtained from: Juniper Networks
* Follow up with previous commit: mention -D, not -C when cg checkdelphij2009-01-271-1/+1
| | | | | | failed. Submitted by: obrien
* Rename option 'C' to 'D' (damaged) in order to avoid a conflict with upcomingdelphij2009-01-204-28/+28
| | | | | | | Juniper 'C' (clean) flag. Requested by: obrien MFC after: 1 week
* Fix typo.delphij2009-01-121-1/+1
| | | | | Submitted by: Ben Kaduk <minimarmot gmail com> MFC after: 3 days
* Garbage collect 'fflags'.obrien2008-12-241-6/+2
|
* Background fsck applies twice some summary totals changes. The nextkib2008-10-131-4/+11
| | | | | | | | | | | background fsck on the same file system might then print negative numbers for reclaimed directories/files/fragments. Address the issue in a limited degree, by using old summary data for cg when bgfsck is performed. Submitted by: tegge MFC after: 1 week
* check_maps() in /usr/src/sbin/fsck_ffs/pass5.c seems to be limited to filekib2008-10-131-15/+27
| | | | | | | | | | | systems less than 1 TB, due to using 32-bits integers for file system block numbers. This also causes incorrect error reporting for foreground fsck. Convert it to use ufs2_daddr_t for block numbers. PR: kern/127951 Submitted by: tegge MFC after: 1 week
* Document the -F 's return statement.remko2008-09-171-0/+6
| | | | | | | | | | If the application returns succesfully the return code is 7 (which means the filesystem is clean). PR: 127432 Submitted by: edwin MFC after: 3 days
* 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-105-7/+61
| | | | | | | | | | 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.
* In pass1(), cap inosused to fs_ipg rather than allowing arbitrarydelphij2008-02-261-2/+4
| | | | | | number read from cylinder group. Chances that we read a smarshed cylinder group, and we can not 100% trust information it has supplied. fsck_ffs(8) will crash otherwise for some cases.
* In pass2check(): Be more strict with the inode information before furtherdelphij2008-02-261-0/+2
| | | | | | processing the information. chk1 is more prone to crash when insane information is provided by the on-disk inode, and does not even work if the inode is being smarshed badly.
* Be more careful when checking superblock. We have already checkeddelphij2008-02-261-1/+1
| | | | | | | | | | | | | | | | | whether fs_bsize is larger than MINBSIZE, which is larger than the value that is used to compared with fs_bsize, the sizeof fs, so the check followed, will be always true. By inspecting the code and some old commit log, I believe that the check must be that *fs_sbsize* is larger than sizeof fs. We round up the size to nearest dev_bsize, as the smallest accepted fs_sbsize, personally, I think this can be even changed to equal, because this number is mostly an invariant in file systems. With this check, fsck_ffs(8) will be more picky and has better chance rejecting bad first superblock rather than referring to bad value it supplied, thus gives better chance for it to check the filesystem carefully.
* Convert fsck_ffs to nmount(). This seems to solverodrigc2007-09-192-21/+55
| | | | | | | | 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)
* Fix -fstrict-aliasing warning.ru2006-11-011-1/+3
|
* Forgot to add file with gjournal specific fsck code.pjd2006-10-311-0/+774
| | | | Sponsored by: home.pl
* Implements gjournal support. If file system has gjournal support enabledpjd2006-10-317-14/+41
| | | | | | | | | | 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
* Mention the default location of alternative super block on adelphij2005-09-201-2/+2
| | | | | | | | UFS2 file system, in fsck_ffs(8). Submitted by: KOMATSU Shinichiro <koma2 at lovepeers ! org> PR: docs/86362 MFC After: 3 days
* Make background fsck based summary adjustments actually work bydelphij2005-03-073-5/+24
| | | | | | | | | | | | | | | | | | | | | | | initializing the sysctl mibs data before actually using them. The original patchset (which is the actual version that is running on my testboxes) have checked whether all of these sysctls and refuses to do background fsck if we don't have them. Kirk has pointed out that refusing running fsck on old kernels is pointless, as old kernels will recompute the summary at mount time, so I have removed these checks. Unfortunatelly, as the checks will initialize the mib values of those sysctl's, and which are vital for the runtime summary adjustment to work, we can not simply remove the check, which will lead to problem when running background fsck over a dirty volume. Add these checks in a different way: give a warning rather than refusing to work, and complain if the functionality is not available when adjustments are necessary. Noticed by: A power failure at my lab Pointy hat: me MFC After: 3 days
* The recomputation of file system summary at mount time can be adelphij2005-02-202-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | very slow process, especially for large file systems that is just recovered from a crash. Since the summary is already re-sync'ed every 30 second, we will not lag behind too much after a crash. With this consideration in mind, it is more reasonable to transfer the responsibility to background fsck, to reduce the delay after a crash. Add a new sysctl variable, vfs.ffs.compute_summary_at_mount, to control this behavior. When set to nonzero, we will get the "old" behavior, that the summary is computed immediately at mount time. Add five new sysctl variables to adjust ndir, nbfree, nifree, nffree and numclusters respectively. Teach fsck_ffs about these API, however, intentionally not to check the existence, since kernels without these sysctls must have recomputed the summary and hence no adjustments are necessary. This change has eliminated the usual tens of minutes of delay of mounting large dirty volumes. Reviewed by: mckusick MFC After: 1 week
OpenPOWER on IntegriCloud