summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Sync program's usage() with manpage's SYNOPSIS.ru2005-02-102-2/+2
|
* Added the EXIT STATUS section where appropriate.ru2005-01-171-2/+2
|
* Do not pass random bits as mount arguments.phk2004-12-121-0/+1
|
* Explicitly break out NETA license from Berkeley license to clearlyrwatson2004-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
* The got_siginfo = 0 should have been got_sigalarm=0 to match the otherimp2004-10-101-1/+1
| | | | | | passes. Submitted by: Dworkin Muller
* Eliminate linked list used to track inodes with an initial linktruckman2004-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
* Move back to WARNS=2scottl2004-09-011-1/+1
|
* Create DIP_SET() and IBLK_SET() macros to fix lvalue warnings.scottl2004-09-015-40/+59
| | | | Inspired by: kan
* Generalize the UFS bad magic value used to determine when a filesystemjhb2004-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?
* Downgrade WARNS level until GCC 3.4.2 warning have been fixed.kan2004-07-281-1/+1
|
* Mechanically kill hard sentence breaks.ru2004-07-021-2/+4
|
* Improve the delay algorithm used in bgfsck. From the author:scottl2004-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
* Remove advertising clause from University of California Regent's license,markm2004-04-0919-76/+0
| | | | | | per letter dated July 22, 1999. Approved by: core, imp
* Remove a stray \n from a setproctitle.dwmalone2004-03-301-1/+1
| | | | Submitted by: Niki Denev <nike_d@cytexbg.com>
* In the case of a background fsck, periodically update the process titlescottl2004-02-289-0/+47
| | | | with a progress update.
* style.Makefile(5):johan2004-02-231-1/+1
| | | | Use WARNS?= instead of WARNS=.
* Avoid dereferencing null pointers in fsck_ffs. (pfatal may return,cperciva2004-01-262-2/+7
| | | | | | | so it isn't a safe way of handling [mc]alloc failures.) PR: misc/61800 Approved by: rwatson (mentor)
* Add manual page links from fsck_ufs.8 and fsck_4.2bsd.8 to fsck_ffs.8,simon2004-01-101-0/+1
| | | | | | since there are already the same links for the program binary. Suggested by: mat
* Catch and report on filesystems that were interrupted during newfs,wes2003-11-161-0/+12
| | | | | sporting the new 'BAD' magic number. Exit with a unique error code (11) so callers who care about this can respond appropriately.
* Change the default mode for lost+found from 01777 to 0700. Theiedowse2003-10-191-1/+1
| | | | | | | | | | original intention of the less restrictive permissions was to allow users to move or delete recovered files that they own. However, it is better to not create world-writable directories by default; the administrator can always pre-create lost+found if different permissions are desired. Reviewed by: mckusick
* 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-013-3/+3
|
* Use __FBSDID() to quiet GCC 3.3 warnings.obrien2003-05-0313-47/+43
|
* Correct lines incorrectly added to the copyright message. Add missing period.mckusick2003-02-141-4/+1
| | | | | Submitted by: Bruce Evans <bde@zeta.org.au> Sponsored by: DARPA & NAI Labs.
* MFp4: Make ifs consistant with rest of file.imp2002-12-131-3/+3
|
* Uniformly refer to a file system as "file system".ru2002-12-121-1/+1
| | | | Approved by: re
* Slow down the operation of background fsck so as to leave some diskiedowse2002-12-071-1/+46
| | | | | | | | | | | | | | | bandwidth for other processes. Since the sleeping is done from userland, this avoids the locking issues that affected the kernel version. The algorithm used here is to measure a moving average of the times taken by a sample of read operations and then delay 1 in 8 reads by 16 times the measured average. This should correspond to a factor of 3 slowdown, but in practice the factor is larger (3.5 to 4) due to hz rounding effects. Reviewed by: mckusick Approved by: re
* Verify that alternate superblocks have a correct magic number beforemckusick2002-12-021-9/+10
| | | | | | | | | trying to use them. Set a minimum value for numdirs when using an alternate superblock to avoid spurious numdirs == 0 error. Calculate new fields when using an alternate superblock from a UFS1 filesystem to avoid segment faulting. Sponsored by: DARPA & NAI Labs.
* Create a new 32-bit fs_flags word in the superblock. Add code to movemckusick2002-11-272-4/+3
| | | | | | | | | | | | | | | | | the old 8-bit fs_old_flags to the new location the first time that the filesystem is mounted by a new kernel. One of the unused flags in fs_old_flags is used to indicate that the flags have been moved. Leave the fs_old_flags word intact so that it will work properly if used on an old kernel. Change the fs_sblockloc superblock location field to be in units of bytes instead of in units of filesystem fragments. The old units did not work properly when the fragment size exceeeded the superblock size (8192). Update old fs_sblockloc values at the same time that the flags are moved. Suggested by: BOUWSMA Barry <freebsd-misuser@netscum.dyndns.dk> Sponsored by: DARPA & NAI Labs.
* Fsck needs to check each CG's rotor values to ensure thay are not -ve.julian2002-11-241-3/+3
| | | | | | | | | | | It seems a common corruption to have them -ve (I've seen it several times) and if fsck doesn't fix it, it leads to a kernel pagefault. Reviewd by: kirk Submitted by: Eric Jacobs <eaja@erols.com> and me independently. MFC in: 2 days PR: bin/40967 Approved by: re
OpenPOWER on IntegriCloud