aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs
Commit message (Collapse)AuthorAgeFilesLines
* Cast 64-bit quantity to intptr_t rather than int so as to work properlyKirk McKusick2010-01-111-2/+2
| | | | | | | | | with 64-bit architectures (such as amd64). Reported by: Xin LI and Josh Paetzel Notes: svn path=/head/; revision=202131
* This update utilizes new fsck sysctl commands that allow fsck runningKirk McKusick2010-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 Notes: svn path=/head/; revision=202109
* When renaming a directory it passes through several intermediateKirk McKusick2010-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 Notes: svn path=/head/; revision=202107
* Add some error messages suggested in PR bin/138043. The code toKirk McKusick2010-01-072-3/+12
| | | | | | | | | | correct the problem was added in r176575 by delphij on 2008-02-25. PR: 138043 Reported by: Heikki Suonsivu Notes: svn path=/head/; revision=201708
* This corrects a bug that manifested itself as identifying the lastKirk McKusick2010-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 Notes: svn path=/head/; revision=201700
* (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.Antoine Brodin2009-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 Notes: svn path=/head/; revision=201145
* Correct comment.Pawel Jakub Dawidek2009-06-031-1/+1
| | | | Notes: svn path=/head/; revision=193372
* - Use volatile for signal variables.Ulf Lilleengen2009-06-021-2/+2
| | | | | | | Suggested by: Jaakko Heinonen <jh -at- saunalahti.fi> Notes: svn path=/head/; revision=193325
* - Use sig_atomic_t for signal handler variables.Ulf Lilleengen2009-05-291-2/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=193059
* Update the actions previously attempted by the -D option to make themKirk McKusick2009-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 Notes: svn path=/head/; revision=188110
* Add the '-C' "check clean" flag. If the FS is marked clean, skip fileDavid E. O'Brien2009-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 Notes: svn path=/head/; revision=187931
* Follow up with previous commit: mention -D, not -C when cg checkXin LI2009-01-271-1/+1
| | | | | | | | | failed. Submitted by: obrien Notes: svn path=/head/; revision=187748
* Rename option 'C' to 'D' (damaged) in order to avoid a conflict with upcomingXin LI2009-01-204-28/+28
| | | | | | | | | | Juniper 'C' (clean) flag. Requested by: obrien MFC after: 1 week Notes: svn path=/head/; revision=187501
* Fix typo.Xin LI2009-01-121-1/+1
| | | | | | | | Submitted by: Ben Kaduk <minimarmot gmail com> MFC after: 3 days Notes: svn path=/head/; revision=187079
* Garbage collect 'fflags'.David E. O'Brien2008-12-241-6/+2
| | | | Notes: svn path=/head/; revision=186471
* Background fsck applies twice some summary totals changes. The nextKonstantin Belousov2008-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 Notes: svn path=/head/; revision=183821
* check_maps() in /usr/src/sbin/fsck_ffs/pass5.c seems to be limited to fileKonstantin Belousov2008-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 Notes: svn path=/head/; revision=183820
* Document the -F 's return statement.Remko Lodder2008-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 Notes: svn path=/head/; revision=183110
* Instead of passing MNT_UPDATE, MNT_SNAPSHOT, MNT_RELOAD fromCraig Rodrigues2008-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. Notes: svn path=/head/; revision=182027
* - Display '-C' option in usage().Stanislav Sedov2008-06-081-1/+1
| | | | | | | Approved by: kib Notes: svn path=/head/; revision=179656
* Add a new flag, '-C' which enables a special mode that is intended forXin LI2008-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. Notes: svn path=/head/; revision=178088
* Add comment about specifying "ro" mount option whenCraig Rodrigues2008-04-041-0/+4
| | | | | | | | | doing an update mount on a read-only file system. Requested by: yar Notes: svn path=/head/; revision=177905
* For a mounted file system which is read-only, whenCraig Rodrigues2008-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 Notes: svn path=/head/; revision=176822
* Remove hacks to filter out MNT_ROOTFS, since we nowCraig Rodrigues2008-03-051-10/+0
| | | | | | | do that internally inside nmount() in revision 1.267 of vfs_mount.c. Notes: svn path=/head/; revision=176814
* In pass1(), cap inosused to fs_ipg rather than allowing arbitraryXin LI2008-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. Notes: svn path=/head/; revision=176575
* In pass2check(): Be more strict with the inode information before furtherXin LI2008-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. Notes: svn path=/head/; revision=176574
* Be more careful when checking superblock. We have already checkedXin LI2008-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. Notes: svn path=/head/; revision=176573
* Convert fsck_ffs to nmount(). This seems to solveCraig Rodrigues2007-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) Notes: svn path=/head/; revision=172236
* Fix fscking gjournaled root file system: root file system is already mountedPawel Jakub Dawidek2007-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) Notes: svn path=/head/; revision=171800
* Fix -fstrict-aliasing warning.Ruslan Ermilov2006-11-011-1/+3
| | | | Notes: svn path=/head/; revision=163866
* Forgot to add file with gjournal specific fsck code.Pawel Jakub Dawidek2006-10-311-0/+774
| | | | | | | Sponsored by: home.pl Notes: svn path=/head/; revision=163849
* Implements gjournal support. If file system has gjournal support enabledPawel Jakub Dawidek2006-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 Notes: svn path=/head/; revision=163845
* Mention the default location of alternative super block on aXin LI2005-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 Notes: svn path=/head/; revision=150365
* Make background fsck based summary adjustments actually work byXin LI2005-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 Notes: svn path=/head/; revision=143235
* The recomputation of file system summary at mount time can be aXin LI2005-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 Notes: svn path=/head/; revision=142123
* Sync program's usage() with manpage's SYNOPSIS.Ruslan Ermilov2005-02-102-2/+2
| | | | Notes: svn path=/head/; revision=141611
* Added the EXIT STATUS section where appropriate.Ruslan Ermilov2005-01-171-2/+2
| | | | Notes: svn path=/head/; revision=140368
* Do not pass random bits as mount arguments.Poul-Henning Kamp2004-12-121-0/+1
| | | | Notes: svn path=/head/; revision=138734
* Explicitly break out NETA license from Berkeley license to clearlyRobert Watson2004-10-201-0/+21
| | | | | | | | | | indicate license grant, as well as to indicate that NETA is asserting only two clauses, not four clauses. Requested by: imp Notes: svn path=/head/; revision=136721
* The got_siginfo = 0 should have been got_sigalarm=0 to match the otherWarner Losh2004-10-101-1/+1
| | | | | | | | | passes. Submitted by: Dworkin Muller Notes: svn path=/head/; revision=136346
* Eliminate linked list used to track inodes with an initial linkDon Lewis2004-10-0810-60/+43
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=136281
* Move back to WARNS=2Scott Long2004-09-011-1/+1
| | | | Notes: svn path=/head/; revision=134597
* Create DIP_SET() and IBLK_SET() macros to fix lvalue warnings.Scott Long2004-09-015-40/+59
| | | | | | | Inspired by: kan Notes: svn path=/head/; revision=134589
* Generalize the UFS bad magic value used to determine when a filesystemJohn Baldwin2004-08-191-2/+2
| | | | | | | | | | | has only been partly initialized via newfs(8) so that it applies to both UFS1 and UFS2. Submitted by: "Xin LI" delphij at frontfree dot net MFC: maybe? Notes: svn path=/head/; revision=134011
* Downgrade WARNS level until GCC 3.4.2 warning have been fixed.Alexander Kabaev2004-07-281-1/+1
| | | | Notes: svn path=/head/; revision=132761
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-2/+4
| | | | Notes: svn path=/head/; revision=131488
* Improve the delay algorithm used in bgfsck. From the author:Scott Long2004-05-181-4/+6
| | | | | | | | | | | | | | | | | | shuffles the timing and sleep calls in bgfsck from: sleep timer_on io timer_off io io io io io io io to sleep io io io io io io io timer_on io timer_off The original method basically guaranteed that the timed I/O included a disk seek every time, which made bgfsck sleep for much longer than necessary. Submitted by: Dan Nelson Reviewed by: kirk Notes: svn path=/head/; revision=129401
* Remove advertising clause from University of California Regent's license,Mark Murray2004-04-0919-76/+0
| | | | | | | | | per letter dated July 22, 1999. Approved by: core, imp Notes: svn path=/head/; revision=128073
* Remove a stray \n from a setproctitle.David Malone2004-03-301-1/+1
| | | | | | | Submitted by: Niki Denev <nike_d@cytexbg.com> Notes: svn path=/head/; revision=127638
* In the case of a background fsck, periodically update the process titleScott Long2004-02-289-0/+47
| | | | | | | with a progress update. Notes: svn path=/head/; revision=126345